-*- coding: utf-8 -*-
Changes with Apache 2.4.63
+ *) mod_proxy_fcgi: Don't re-encode SCRIPT_FILENAME when set via SetHandler.
+ PR 69203. [Yann Ylavic]
+
*) mod_rewrite, mod_proxy: mod_proxy to canonicalize rewritten [P] URLs,
including "unix:" ones. PR 69235, PR 69260. [Yann Ylavic, Ruediger Pluem]
r->proxyreq = PROXYREQ_REVERSE;
r->filename = apr_pstrcat(r->pool, r->handler, r->filename, NULL);
+ apr_table_setn(r->notes, "proxy-sethandler", "1");
/* Still need to canonicalize r->filename */
rc = ap_proxy_canon_url(r);
}
}
else if (r->proxyreq && strncmp(r->filename, "proxy:", 6) == 0) {
+ apr_table_unset(r->notes, "proxy-sethandler");
rc = OK;
}
if (rc != OK) {
apr_port_t port, def_port;
fcgi_req_config_t *rconf = NULL;
const char *pathinfo_type = NULL;
+ fcgi_dirconf_t *dconf = ap_get_module_config(r->per_dir_config,
+ &proxy_fcgi_module);
if (ap_cstr_casecmpn(url, "fcgi:", 5) == 0) {
url += 5;
host = apr_pstrcat(r->pool, "[", host, "]", NULL);
}
- if (apr_table_get(r->notes, "proxy-nocanon")
+ if (apr_table_get(r->notes, "proxy-sethandler")
+ || apr_table_get(r->notes, "proxy-nocanon")
|| apr_table_get(r->notes, "proxy-noencode")) {
- path = url; /* this is the raw/encoded path */
+ char *c = url;
+
+ /* We do not call ap_proxy_canonenc_ex() on the path here, don't
+ * let control characters pass still, and for php-fpm no '?' either.
+ */
+ if (FCGI_MAY_BE_FPM(dconf)) {
+ while (!apr_iscntrl(*c) && *c != '?')
+ c++;
+ }
+ else {
+ while (!apr_iscntrl(*c))
+ c++;
+ }
+ if (*c) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(10414)
+ "To be forwarded path contains control characters%s (%s)",
+ FCGI_MAY_BE_FPM(dconf) ? " or '?'" : "", url);
+ return HTTP_FORBIDDEN;
+ }
+
+ path = url; /* this is the raw path */
}
else {
core_dir_config *d = ap_get_core_module_config(r->per_dir_config);
return HTTP_BAD_REQUEST;
}
}
- /*
- * If we have a raw control character or a ' ' in nocanon path,
- * correct encoding was missed.
- */
- if (path == url && *ap_scan_vchar_obstext(path)) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(10414)
- "To be forwarded path contains control "
- "characters or spaces");
- return HTTP_FORBIDDEN;
- }
r->filename = apr_pstrcat(r->pool, "proxy:fcgi://", host, sport, "/",
path, NULL);