]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Add pre_translate_name hook running before URI-path decoding.
authorYann Ylavic <ylavic@apache.org>
Mon, 22 Jun 2020 10:32:15 +0000 (10:32 +0000)
committerYann Ylavic <ylavic@apache.org>
Mon, 22 Jun 2020 10:32:15 +0000 (10:32 +0000)
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.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879076 13f79535-47bb-0310-9956-ffa450edef68

include/ap_mmn.h
include/http_request.h
server/request.c

index 15d2641d1a2016a0d737d1d2016fe129849c159d..a3ab84498f36698359930cae255691d06e3f2291 100644 (file)
  * 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" */
 #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
index aedafed89e10bef561ef4f8e01f65252c7b552d5..323a0cfcd523a84382fb89aff9cd8199a4b013b6 100644 (file)
@@ -362,6 +362,16 @@ AP_DECLARE(apr_status_t) ap_check_pipeline(conn_rec *c, apr_bucket_brigade *bb,
  */
 AP_DECLARE_HOOK(int,create_request,(request_rec *r))
 
+/**
+ * This hook allow modules an opportunity to translate the URI into an
+ * actual filename, before URL decoding happens.
+ * rules will be followed.
+ * @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
index 1e9a15a28ac0d9e66c73cbf7e75d95d4a07f6acd..e00ed69d3e59db97bcc845540547d21f3d9b760e 100644 (file)
@@ -59,6 +59,7 @@
 #define APLOG_MODULE_INDEX AP_CORE_MODULE_INDEX
 
 APR_HOOK_STRUCT(
+    APR_HOOK_LINK(pre_translate_name)
     APR_HOOK_LINK(translate_name)
     APR_HOOK_LINK(map_to_storage)
     APR_HOOK_LINK(check_user_id)
@@ -74,6 +75,8 @@ APR_HOOK_STRUCT(
     APR_HOOK_LINK(force_authn)
 )
 
+AP_IMPLEMENT_HOOK_RUN_FIRST(int,pre_translate_name,
+                            (request_rec *r), (r), DECLINED)
 AP_IMPLEMENT_HOOK_RUN_FIRST(int,translate_name,
                             (request_rec *r), (r), DECLINED)
 AP_IMPLEMENT_HOOK_RUN_FIRST(int,map_to_storage,