You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2020/06/24 07:47:58 UTC
svn commit: r1879137 - in /httpd/httpd/trunk: include/http_request.h
modules/proxy/mod_proxy.c server/request.c
Author: ylavic
Date: Wed Jun 24 07:47:58 2020
New Revision: 1879137
URL: http://svn.apache.org/viewvc?rev=1879137&view=rev
Log:
Follow up to r1879079, r1879080: change to DONE semantics for pre_trans hooks.
Don't decode r->uri when pre_trans returns DONE instead of OK, which allows to
preserve previous behaviour where decoding was avoided for "ProxyRequests on"
or post_read_request RewriteRule [P] only, but not ProxyPass'ed requests.
This also preserves decoded location walk in most/same cases.
Modified:
httpd/httpd/trunk/include/http_request.h
httpd/httpd/trunk/modules/proxy/mod_proxy.c
httpd/httpd/trunk/server/request.c
Modified: httpd/httpd/trunk/include/http_request.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_request.h?rev=1879137&r1=1879136&r2=1879137&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_request.h (original)
+++ httpd/httpd/trunk/include/http_request.h Wed Jun 24 07:47:58 2020
@@ -366,7 +366,10 @@ AP_DECLARE_HOOK(int,create_request,(requ
* This hook allow modules an opportunity to translate the URI into an
* actual filename, before URL decoding happens.
* @param r The current request
- * @return OK, DECLINED, or HTTP_...
+ * @return DECLINED to let other modules handle the pre-translation,
+ * OK if it was handled and no other module should process it,
+ * DONE if no further transformation should happen on the URI,
+ * HTTP_... in case of error.
* @ingroup hooks
*/
AP_DECLARE_HOOK(int,pre_translate_name,(request_rec *r))
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=1879137&r1=1879136&r2=1879137&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Wed Jun 24 07:47:58 2020
@@ -1007,9 +1007,10 @@ static int proxy_trans(request_rec *r, i
if (r->proxyreq) {
/* someone has already set up the proxy, it was possibly ourselves
- * in proxy_detect
+ * in proxy_detect (DONE will prevent further decoding of r->uri,
+ * only if proxyreq is set before pre_trans already).
*/
- return OK;
+ return pre_trans ? DONE : OK;
}
/* In early pre_trans hook, r->uri was not manipulated yet so we are
Modified: httpd/httpd/trunk/server/request.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/request.c?rev=1879137&r1=1879136&r2=1879137&view=diff
==============================================================================
--- httpd/httpd/trunk/server/request.c (original)
+++ httpd/httpd/trunk/server/request.c Wed Jun 24 07:47:58 2020
@@ -227,11 +227,11 @@ AP_DECLARE(int) ap_process_request_inter
return access_status;
}
- /* Let pre_translate_name hooks work with non-decoded URIs,
- * and eventually apply their own transformations (return OK).
+ /* Let pre_translate_name hooks work with non-decoded URIs, and
+ * eventually prevent further URI transformations (return DONE).
*/
access_status = ap_run_pre_translate_name(r);
- if (access_status != OK && access_status != DECLINED) {
+ if (ap_is_HTTP_ERROR(access_status)) {
return access_status;
}
@@ -240,7 +240,7 @@ AP_DECLARE(int) ap_process_request_inter
}
/* Ignore URL unescaping for translated URIs already */
- if (access_status == DECLINED && r->parsed_uri.path) {
+ if (access_status != DONE && r->parsed_uri.path) {
core_dir_config *d = ap_get_core_module_config(r->per_dir_config);
if (d->allow_encoded_slashes) {