From 757e0fa6272454330145cf15bf92a4571e979914 Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 5 Jan 2011 12:47:14 +0000 Subject: - properly fix pr6009. a different fix was commited as the original patch used atoi(). this fix uses strtonum() instead. from bjorn ketelaars, pr6515. ok henning@ --- usr.sbin/httpd/src/modules/proxy/proxy_http.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'usr.sbin') diff --git a/usr.sbin/httpd/src/modules/proxy/proxy_http.c b/usr.sbin/httpd/src/modules/proxy/proxy_http.c index b7b299a5e94..fadbbb4046e 100644 --- a/usr.sbin/httpd/src/modules/proxy/proxy_http.c +++ b/usr.sbin/httpd/src/modules/proxy/proxy_http.c @@ -169,6 +169,8 @@ int ap_proxy_http_handler(request_rec *r, cache_req *c, char *url, int result, major, minor; const char *content_length; const char *peer; + int destportstrtonum; + const char *errstr; void *sconf = r->server->module_config; proxy_server_conf *conf = @@ -367,7 +369,11 @@ int ap_proxy_http_handler(request_rec *r, cache_req *c, char *url, AP_HOOK_DECLINE(DECLINED), &rc, r, f, desthost, destportstr, destportstr); if (rc == DECLINED) { - if (destportstr != NULL && destport != DEFAULT_HTTP_PORT) + destportstrtonum = strtonum(destportstr, 0, 65535, &errstr); + if (errstr) + errx(1, "The destination port is %s: %s", errstr, destportstr); + + if (destportstr != NULL && destportstrtonum != destport) ap_bvputs(f, "Host: ", desthost, ":", destportstr, CRLF, NULL); else ap_bvputs(f, "Host: ", desthost, CRLF, NULL); -- cgit v1.2.3