Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 60884 invoked from network); 2 Feb 2005 15:29:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Feb 2005 15:29:37 -0000 Received: (qmail 75074 invoked by uid 500); 2 Feb 2005 15:29:31 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 75043 invoked by uid 500); 2 Feb 2005 15:29:30 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 75023 invoked by uid 99); 2 Feb 2005 15:29:30 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from jimsys.jaguNET.com (HELO jimsys.jaguNET.com) (209.133.199.10) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 02 Feb 2005 07:29:30 -0800 Received: from [127.0.0.1] (localhost [127.0.0.1]) by jimsys.jaguNET.com (Postfix) with ESMTP id B083443A881 for ; Wed, 2 Feb 2005 10:29:25 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v619.2) In-Reply-To: <96515f944eace0ff4f156fe565fbc296@jaguNET.com> References: <200502012115.j11LFl28016549@mx1.redhat.com> <20050201212443.GA23023@redhat.com> <20050201212913.GA23266@redhat.com> <96515f944eace0ff4f156fe565fbc296@jaguNET.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <50d743cfc3b2054617ed676ee62a6f5f@jaguNET.com> Content-Transfer-Encoding: 7bit From: Jim Jagielski Subject: [PATCH] Re: mod_proxy and friends, FIX_15207 Date: Wed, 2 Feb 2005 10:29:24 -0500 To: dev@httpd.apache.org X-Mailer: Apple Mail (2.619.2) X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Does not include the required removal of the unused FIX_15207 code snippets... Index: modules/proxy/proxy_ajp.c =================================================================== --- modules/proxy/proxy_ajp.c (revision 149512) +++ modules/proxy/proxy_ajp.c (working copy) @@ -79,7 +79,7 @@ search = r->args; /* process path */ - path = ap_proxy_canonenc(r->pool, url, strlen(url), enc_path, r->proxyreq); + path = ap_proxy_canonenc(r->pool, url, strlen(url), enc_path, 0, r->proxyreq); if (path == NULL) return HTTP_BAD_REQUEST; Index: modules/proxy/proxy_ftp.c =================================================================== --- modules/proxy/proxy_ftp.c (revision 149512) +++ modules/proxy/proxy_ftp.c (working copy) @@ -166,7 +166,7 @@ strp = strchr(url, ';'); if (strp != NULL) { *(strp++) = '\0'; - parms = ap_proxy_canonenc(p, strp, strlen(strp), enc_parm, + parms = ap_proxy_canonenc(p, strp, strlen(strp), enc_parm, 0, r->proxyreq); if (parms == NULL) return HTTP_BAD_REQUEST; @@ -174,7 +174,7 @@ else parms = ""; - path = ap_proxy_canonenc(p, url, strlen(url), enc_path, r->proxyreq); + path = ap_proxy_canonenc(p, url, strlen(url), enc_path, 0, r->proxyreq); if (path == NULL) return HTTP_BAD_REQUEST; if (!ftp_check_string(path)) @@ -182,13 +182,13 @@ if (r->proxyreq && r->args != NULL) { if (strp != NULL) { - strp = ap_proxy_canonenc(p, r->args, strlen(r->args), enc_parm, 1); + strp = ap_proxy_canonenc(p, r->args, strlen(r->args), enc_parm, 1, r->proxyreq); if (strp == NULL) return HTTP_BAD_REQUEST; parms = apr_pstrcat(p, parms, "?", strp, NULL); } else { - strp = ap_proxy_canonenc(p, r->args, strlen(r->args), enc_fpath, 1); + strp = ap_proxy_canonenc(p, r->args, strlen(r->args), enc_fpath, 1, r->proxyreq); if (strp == NULL) return HTTP_BAD_REQUEST; path = apr_pstrcat(p, path, "?", strp, NULL); Index: modules/proxy/proxy_util.c =================================================================== --- modules/proxy/proxy_util.c (revision 149512) +++ modules/proxy/proxy_util.c (working copy) @@ -130,10 +130,10 @@ * Convert a URL-encoded string to canonical form. * It decodes characters which need not be encoded, * and encodes those which must be encoded, and does not touch - * those which must not be touched. + * those which must not be touched. */ PROXY_DECLARE(char *)ap_proxy_canonenc(apr_pool_t *p, const char *x, int len, enum enctype t, - int isenc) + int forcedec, int proxyreq) { int i, j, ch; char *y; @@ -174,8 +174,11 @@ y[j] = ch; continue; } -/* decode it if not already done */ - if (isenc && ch == '%') { +/* + * decode it if not already done. do not decode reverse proxied URLs + * unless specifically forced + */ + if ((forcedec || (proxyreq && proxyreq != PROXYREQ_REVERSE)) && ch == '%') { if (!apr_isxdigit(x[i + 1]) || !apr_isxdigit(x[i + 2])) return NULL; ch = ap_proxy_hex2c(&x[i + 1]); @@ -238,12 +241,12 @@ strp = strchr(user, ':'); if (strp != NULL) { *strp = '\0'; - password = ap_proxy_canonenc(p, strp + 1, strlen(strp + 1), enc_user, 1); + password = ap_proxy_canonenc(p, strp + 1, strlen(strp + 1), enc_user, 1, 0); if (password == NULL) return "Bad %-escape in URL (password)"; } - user = ap_proxy_canonenc(p, user, strlen(user), enc_user, 1); + user = ap_proxy_canonenc(p, user, strlen(user), enc_user, 1, 0); if (user == NULL) return "Bad %-escape in URL (username)"; } Index: modules/proxy/proxy_http.c =================================================================== --- modules/proxy/proxy_http.c (revision 149512) +++ modules/proxy/proxy_http.c (working copy) @@ -79,7 +79,7 @@ search = r->args; /* process path */ - path = ap_proxy_canonenc(r->pool, url, strlen(url), enc_path, r->proxyreq); + path = ap_proxy_canonenc(r->pool, url, strlen(url), enc_path, 0, r->proxyreq); if (path == NULL) return HTTP_BAD_REQUEST; Index: modules/proxy/mod_proxy.c =================================================================== --- modules/proxy/mod_proxy.c (revision 149512) +++ modules/proxy/mod_proxy.c (working copy) @@ -1,4 +1,3 @@ -#define FIX_15207 /* Copyright 1999-2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); Index: modules/proxy/mod_proxy.h =================================================================== --- modules/proxy/mod_proxy.h (revision 149512) +++ modules/proxy/mod_proxy.h (working copy) @@ -381,7 +381,7 @@ PROXY_DECLARE(int) ap_proxy_hex2c(const char *x); PROXY_DECLARE(void) ap_proxy_c2hex(int ch, char *x); PROXY_DECLARE(char *)ap_proxy_canonenc(apr_pool_t *p, const char *x, int len, enum enctype t, - int isenc); + int forcedec, int proxyreq); PROXY_DECLARE(char *)ap_proxy_canon_netloc(apr_pool_t *p, char **const urlp, char **userp, char **passwordp, char **hostp, apr_port_t *port); PROXY_DECLARE(const char *)ap_proxy_date_canon(apr_pool_t *p, const char *x);