rse 97/08/17 14:00:49
Modified: src Tag: APACHE_1_2_X CHANGES src/modules/proxy Tag: APACHE_1_2_X proxy_http.c Log: Fix URL mangling in mod_proxy for HTTP requests. PR: 260,656,699,713,812 Submitted by: Lars Eilebrecht Reviewed by: Marc Slemko, Dean Gaudet Revision Changes Path No revision No revision 1.286.2.49 +5 -0 apache/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache/src/CHANGES,v retrieving revision 1.286.2.48 retrieving revision 1.286.2.49 diff -u -r1.286.2.48 -r1.286.2.49 --- CHANGES 1997/08/17 20:35:48 1.286.2.48 +++ CHANGES 1997/08/17 21:00:46 1.286.2.49 @@ -1,6 +1,11 @@ Changes with Apache 1.2.3 + *) The request to a remote proxy was mangled if it was generated as the + result of a ProxyPass directive. URL schemes other than http:// were not + supported when ProxyRemote was used. PR#260, PR#656, PR#699, PR#713, + PR#812 [Lars Eilebrecht] + *) Fixed proxy-pass-through feature of mod_rewrite; Added error logging information for case where proxy module is not available. [Marc Slemko] No revision No revision 1.17.2.3 +11 -9 apache/src/modules/proxy/proxy_http.c Index: proxy_http.c =================================================================== RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_http.c,v retrieving revision 1.17.2.2 retrieving revision 1.17.2.3 diff -u -r1.17.2.2 -r1.17.2.3 --- proxy_http.c 1997/08/15 17:08:56 1.17.2.2 +++ proxy_http.c 1997/08/17 21:00:48 1.17.2.3 @@ -156,6 +156,7 @@ const long int zero=0L; int destport = 0; char *destportstr = NULL; + char *urlptr = NULL; void *sconf = r->server->module_config; proxy_server_conf *conf = @@ -169,19 +170,21 @@ /* We break the URL into host, port, path-search */ - url += 7; /* skip http:// */ + urlptr = strstr(url,"://"); + if (urlptr == NULL) return BAD_REQUEST; + urlptr += 3; destport = DEFAULT_PORT; - p = strchr(url, '/'); + p = strchr(urlptr, '/'); if (p == NULL) { - desthost = pstrdup(pool, url); - url = "/"; + desthost = pstrdup(pool, urlptr); + urlptr = "/"; } else { - char *q = palloc(pool, p-url+1); - memcpy(q, url, p-url); - q[p-url] = '\0'; - url = p; + char *q = palloc(pool, p-urlptr+1); + memcpy(q, urlptr, p-urlptr); + q[p-urlptr] = '\0'; + urlptr = p; desthost = q; } @@ -207,7 +210,6 @@ if (proxyhost != NULL) { - url = r->uri; /* restore original URL */ server.sin_port = htons(proxyport); err = proxy_host2addr(proxyhost, &server_hp); if (err != NULL) return DECLINED; /* try another */