]> granicus.if.org Git - apache/commitdiff
* Do not parse URL in case of regular expression as they likely do not follow
authorRuediger Pluem <rpluem@apache.org>
Tue, 4 Feb 2014 19:36:50 +0000 (19:36 +0000)
committerRuediger Pluem <rpluem@apache.org>
Tue, 4 Feb 2014 19:36:50 +0000 (19:36 +0000)
  the URL syntax.

PR: 56074

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1564437 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/proxy/mod_proxy.c
modules/proxy/proxy_util.c

diff --git a/CHANGES b/CHANGES
index 1a31c7afab2adb61d4d2e28cb561438bef08a26a..6329fc201e41368f0c82d7d672db28abbcb8303b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_proxy: Do not try to parse the regular expressions passed by
+     ProxyPassMatch as URL as they do not follow their syntax.
+     PR 56074. [Ruediger Pluem]
+
   *) mod_remoteip: Correct the trusted proxy match test. PR 54651.
      [Yoshinori Ehara <yoshinori ehara gmail com>, Eugene L <eugenel amazon com>]
 
index 9d7c92fd58d81f9a8987c472abd835f3e28a148c..329e805c069da157c2a4d41f39b07d99c9a3dc63 100644 (file)
@@ -1584,13 +1584,26 @@ static const char *
     /* Distinguish the balancer from worker */
     if (ap_proxy_valid_balancer_name(r, 9)) {
         proxy_balancer *balancer = ap_proxy_get_balancer(cmd->pool, conf, r, 0);
+        char *fake_copy;
+
+        /*
+         * In the regex case supplying a fake URL doesn't make sense as it
+         * cannot be parsed anyway with apr_uri_parse later on in
+         * ap_proxy_define_balancer / ap_proxy_update_balancer
+         */
+        if (use_regex) {
+            fake_copy = NULL;
+        }
+        else {
+            fake_copy = f;
+        }
         if (!balancer) {
-            const char *err = ap_proxy_define_balancer(cmd->pool, &balancer, conf, r, f, 0);
+            const char *err = ap_proxy_define_balancer(cmd->pool, &balancer, conf, r, fake_copy, 0);
             if (err)
                 return apr_pstrcat(cmd->temp_pool, "ProxyPass ", err, NULL);
         }
         else {
-            ap_proxy_update_balancer(cmd->pool, balancer, f);
+            ap_proxy_update_balancer(cmd->pool, balancer, fake_copy);
         }
         for (i = 0; i < arr->nelts; i++) {
             const char *err = set_balancer_param(conf, cmd->pool, balancer, elts[i].key,
index a465161866deababc8280c0e625a5d06bc331d75..6017b823c853a10e66ea122ac461b549a1bd24a3 100644 (file)
@@ -1116,6 +1116,9 @@ PROXY_DECLARE(char *) ap_proxy_update_balancer(apr_pool_t *p,
                                                 const char *url)
 {
     apr_uri_t puri;
+    if (!url) {
+        return NULL;
+    }
     if (apr_uri_parse(p, url, &puri) != APR_SUCCESS) {
         return apr_psprintf(p, "unable to parse: %s", url);
     }