Re: user/6515: fix for pr6009 creates a new problem

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Björn Ketelaars
Date: Tuesday, January 4, 2011 - 6:48 am

On Thu, Nov 25, 2010 at 12:25 PM, <gnats@cvs.openbsd.org> wrote:

On Tue, Jan 4, 2011 at 12:11 PM, Jasper Lievisse Adriaanse
<jasper@humppa.nl> wrote:
but


As requested by Jasper a new diff using strtonum().

Index: proxy_http.c
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/src/modules/proxy/proxy_http.c,v
retrieving revision 1.21
diff -u -r1.21 proxy_http.c
--- proxy_http.c	25 Feb 2010 07:53:07 -0000	1.21
+++ proxy_http.c	4 Jan 2011 13:33:23 -0000
@@ -169,6 +169,8 @@
     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 @@
 		    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);
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
user/6515: fix for pr6009 creates a new problem , bjorn.ketelaars, (Thu Nov 25, 3:17 am)
Re: user/6515: fix for pr6009 creates a new problem, Björn Ketelaars, (Tue Jan 4, 6:48 am)