Don't include default port in upstream url to proxy
This commit is contained in:
parent
2935519eb7
commit
79b52bd783
15
src/reqs.c
15
src/reqs.c
@ -1464,8 +1464,15 @@ connect_to_upstream (struct conn_s *connptr, struct request_s *request)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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,
|
snprintf (combined_string, len, "%s:%d", request->host,
|
||||||
request->port);
|
request->port);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
len = strlen (request->host) + strlen (request->path) + 14;
|
len = strlen (request->host) + strlen (request->path) + 14;
|
||||||
combined_string = (char *) safemalloc (len);
|
combined_string = (char *) safemalloc (len);
|
||||||
@ -1473,9 +1480,17 @@ connect_to_upstream (struct conn_s *connptr, struct request_s *request)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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,
|
snprintf (combined_string, len, "http://%s:%d%s", request->host,
|
||||||
request->port, request->path);
|
request->port, request->path);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (request->path)
|
if (request->path)
|
||||||
safefree (request->path);
|
safefree (request->path);
|
||||||
|
Loading…
Reference in New Issue
Block a user