You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2023/02/07 14:20:37 UTC
svn commit: r1907505 - /httpd/httpd/trunk/modules/http/mod_mime.c
Author: rpluem
Date: Tue Feb 7 14:20:37 2023
New Revision: 1907505
URL: http://svn.apache.org/viewvc?rev=1907505&view=rev
Log:
* In the reverse proxy case r->filename might contain a query string if
the nocanon option was used with ProxyPass.
If this is the case cut off the query string as the last parameter in
this query string might end up on an extension we take care about, but
we only want to match against path components not against query
parameters.
Modified:
httpd/httpd/trunk/modules/http/mod_mime.c
Modified: httpd/httpd/trunk/modules/http/mod_mime.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/mod_mime.c?rev=1907505&r1=1907504&r2=1907505&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/mod_mime.c (original)
+++ httpd/httpd/trunk/modules/http/mod_mime.c Tue Feb 7 14:20:37 2023
@@ -813,7 +813,7 @@ static int find_ct(request_rec *r)
mime_dir_config *conf;
apr_array_header_t *exception_list;
char *ext;
- const char *fn, *fntmp, *type, *charset = NULL, *resource_name;
+ const char *fn, *fntmp, *type, *charset = NULL, *resource_name, *qm;
int found_metadata = 0;
if (r->finfo.filetype == APR_DIR) {
@@ -837,6 +837,19 @@ static int find_ct(request_rec *r)
if (conf->use_path_info & 1) {
resource_name = apr_pstrcat(r->pool, r->filename, r->path_info, NULL);
}
+ /*
+ * In the reverse proxy case r->filename might contain a query string if
+ * the nocanon option was used with ProxyPass.
+ * If this is the case cut off the query string as the last parameter in
+ * this query string might end up on an extension we take care about, but
+ * we only want to match against path components not against query
+ * parameters.
+ */
+ else if ((r->proxyreq == PROXYREQ_REVERSE)
+ && (apr_table_get(r->notes, "proxy-nocanon"))
+ && ((qm = ap_strchr_c(r->filename, '?')) != NULL)) {
+ resource_name = apr_pstrmemdup(r->pool, r->filename, qm - r->filename);
+ }
else {
resource_name = r->filename;
}