This commit is contained in:
ejose19 2024-11-18 13:22:47 -03:00 committed by GitHub
commit 027f9b37a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1469,8 +1469,15 @@ connect_to_upstream (struct conn_s *connptr, struct request_s *request)
return -1;
}
snprintf (combined_string, len, "%s:%d", request->host,
request->port);
/*
* if(HTTPS on port 443) don't include the port number
*/
if (request->port == HTTP_PORT_SSL) {
snprintf (combined_string, len, "%s", request->host);
} else {
snprintf (combined_string, len, "%s:%d", request->host,
request->port);
}
} else {
len = strlen (request->host) + strlen (request->path) + 14;
combined_string = (char *) safemalloc (len);
@ -1478,8 +1485,16 @@ connect_to_upstream (struct conn_s *connptr, struct request_s *request)
return -1;
}
snprintf (combined_string, len, "http://%s:%d%s", request->host,
request->port, request->path);
/*
* if(HTTP on port 80) don't include the port number
*/
if (request->port == HTTP_PORT) {
snprintf (combined_string, len, "http://%s%s", request->host,
request->path);
} else {
snprintf (combined_string, len, "http://%s:%d%s", request->host,
request->port, request->path);
}
}
if (request->path)