On Mon, Jun 22, 2020 at 6:32 AM <yla...@apache.org> wrote: > > Author: ylavic > Date: Mon Jun 22 10:32:15 2020 > New Revision: 1879076 > > URL: http://svn.apache.org/viewvc?rev=1879076&view=rev > Log: > Add pre_translate_name hook running before URI-path decoding. > > This allows any module to work with un-decoded URI-path (besides > unreserved characters) in r->uri, and eventually to avoid decoding by > returning OK. > > The first candidate is mod_proxy (following commit) when > ProxyMappingDecoded is disabled, such that the forwarded URI is > equivalent to the original one. > > > Modified: > httpd/httpd/trunk/include/ap_mmn.h > httpd/httpd/trunk/include/http_request.h > httpd/httpd/trunk/server/request.c > > Modified: httpd/httpd/trunk/include/ap_mmn.h > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1879076&r1=1879075&r2=1879076&view=diff > ============================================================================== > --- httpd/httpd/trunk/include/ap_mmn.h (original) > +++ httpd/httpd/trunk/include/ap_mmn.h Mon Jun 22 10:32:15 2020 > @@ -633,6 +633,7 @@ > * 20200420.2 (2.5.1-dev) Add ap_proxy_worker_can_upgrade() > * 20200420.3 (2.5.1-dev) Add ap_parse_strict_length() > * 20200420.4 (2.5.1-dev) Add ap_normalize_path() > + * 20200420.5 (2.5.1-dev) Add pre_translate_name hook > */ > > #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */ > @@ -640,7 +641,7 @@ > #ifndef MODULE_MAGIC_NUMBER_MAJOR > #define MODULE_MAGIC_NUMBER_MAJOR 20200420 > #endif > -#define MODULE_MAGIC_NUMBER_MINOR 4 /* 0...n */ > +#define MODULE_MAGIC_NUMBER_MINOR 5 /* 0...n */ > > /** > * Determine if the server's current MODULE_MAGIC_NUMBER is at least a > > Modified: httpd/httpd/trunk/include/http_request.h > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_request.h?rev=1879076&r1=1879075&r2=1879076&view=diff > ============================================================================== > --- httpd/httpd/trunk/include/http_request.h (original) > +++ httpd/httpd/trunk/include/http_request.h Mon Jun 22 10:32:15 2020 > @@ -364,6 +364,16 @@ 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. > + * rules will be followed.
^ stray 2nd-half of sentence copied from below. Probably axe since I don't think there is any "default" rules for pre_trans. But maybe we mention the side effect here (IIUC?) that is currently still being discussed? i.e. it's not just a modules chance to set r->filename before decoding but it will short-circuit decoding in other non uri2file ways? > + * @param r The current request > + * @return OK, DECLINED, or HTTP_... > + * @ingroup hooks > + */ > +AP_DECLARE_HOOK(int,pre_translate_name,(request_rec *r)) > + > +/** > + * This hook allow modules an opportunity to translate the URI into an > * actual filename. If no modules do anything special, the server's default > * rules will be followed. > * @param r The current request