From: Stefan Eissing Date: Wed, 17 Nov 2021 08:42:35 +0000 (+0000) Subject: Merge of r1894074 from trunk: X-Git-Tag: candidate-2.4.52-rc1~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8966e290a6e947fad0289bf4e243b0b552e13726;p=thirdparty%2Fapache%2Fhttpd.git Merge of r1894074 from trunk: *) mod_proxy_uwsgi: Remove duplicate slashes at the beginning of PATH_INFO. PR 65616. [Ruediger Pluem] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1895097 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/changes-entries/uwsgi-path_info.txt b/changes-entries/uwsgi-path_info.txt new file mode 100644 index 00000000000..beb0a67434f --- /dev/null +++ b/changes-entries/uwsgi-path_info.txt @@ -0,0 +1,2 @@ + *) mod_proxy_uwsgi: Remove duplicate slashes at the beginning of PATH_INFO. + PR 65616. [Ruediger Pluem] diff --git a/modules/proxy/mod_proxy_uwsgi.c b/modules/proxy/mod_proxy_uwsgi.c index 4d7589c82c5..e02450ef061 100644 --- a/modules/proxy/mod_proxy_uwsgi.c +++ b/modules/proxy/mod_proxy_uwsgi.c @@ -471,14 +471,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);