]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_proxy_uwsgi: Remove duplicate slashes at the beginning of PATH_INFO.
authorYann Ylavic <ylavic@apache.org>
Sat, 9 Oct 2021 15:22:00 +0000 (15:22 +0000)
committerYann Ylavic <ylavic@apache.org>
Sat, 9 Oct 2021 15:22:00 +0000 (15:22 +0000)
To accommodate for configs like:
    ProxyPass /uwsgi-pp uwsgi://localhost:8001/
which before r1892805 did not produce a leading double-slash in PATH_INFO.

Submitted by: rpluem

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

changes-entries/uwsgi-path_info.txt [new file with mode: 0644]
modules/proxy/mod_proxy_uwsgi.c

diff --git a/changes-entries/uwsgi-path_info.txt b/changes-entries/uwsgi-path_info.txt
new file mode 100644 (file)
index 0000000..beb0a67
--- /dev/null
@@ -0,0 +1,2 @@
+  *) mod_proxy_uwsgi: Remove duplicate slashes at the beginning of PATH_INFO.
+     PR 65616.  [Ruediger Pluem]
index 2c493cdab44941531cb34a2c0c3dfa8eef161d07..e8ce6c710efe1b42e2859ceb1b08fe4483f46e18 100644 (file)
@@ -476,14 +476,22 @@ static int uwsgi_handler(request_rec *r, proxy_worker * worker,
 
     /* ADD PATH_INFO (unescaped) */
     u_path_info = ap_strchr(url + sizeof(UWSGI_SCHEME) + 2, '/');
-    if (!u_path_info || ap_unescape_url(u_path_info) != OK) {
+    if (!u_path_info) {
+        u_path_info = apr_pstrdup(r->pool, "/");
+    }
+    else if (ap_unescape_url(u_path_info) != OK) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(10100)
                       "unable to decode uwsgi uri: %s", url);
         return HTTP_INTERNAL_SERVER_ERROR;
     }
+    else {
+        /* Remove duplicate slashes at the beginning of PATH_INFO */
+        while (u_path_info[1] == '/') {
+            u_path_info++;
+        }
+    }
     apr_table_add(r->subprocess_env, "PATH_INFO", u_path_info);
 
-
     /* Create space for state information */
     status = ap_proxy_acquire_connection(UWSGI_SCHEME, &backend, worker,
                                          r->server);