From 48b5dfd6968cb076537b605d368d5fd889ebae86 Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Thu, 7 Oct 2021 12:00:20 +0000 Subject: core: Add ap_unescape_url_ex() for better decoding control, and deprecate unused AP_NORMALIZE_DROP_PARAMETERS flag. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893971 13f79535-47bb-0310-9956-ffa450edef68 --- include/ap_mmn.h | 3 +++ include/httpd.h | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/ap_mmn.h b/include/ap_mmn.h index 496bc4b24f..8dbd8f7f31 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -693,6 +693,9 @@ * adding ap_proxy_tunnel_conn_bytes_{in,out}(). * 20210924.1 (2.5.1-dev) Add ap_proxy_fill_error_brigade() * 20210926.0 (2.5.1-dev) Add dav_get_liveprop_element(), remove DAV_PROP_ELEMENT. + * 20210926.1 (2.5.1-dev) Add ap_unescape_url_ex() and deprecate + * AP_NORMALIZE_DROP_PARAMETERS + * */ #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */ diff --git a/include/httpd.h b/include/httpd.h index 5a4a61979d..e5375d77c2 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -1802,6 +1802,18 @@ AP_DECLARE(int) ap_unescape_url(char *url); */ AP_DECLARE(int) ap_unescape_url_keep2f(char *url, int decode_slashes); +#define AP_UNESCAPE_URL_KEEP_UNRESERVED (1u << 0) +#define AP_UNESCAPE_URL_FORBID_SLASHES (1u << 1) +#define AP_UNESCAPE_URL_KEEP_SLASHES (1u << 2) + +/** + * Unescape a URL, with options + * @param url The url to unescape + * @param flags Bitmask of AP_UNESCAPE_URL_* flags + * @return 0 on success, non-zero otherwise + */ +AP_DECLARE(int) ap_unescape_url_ex(char *url, unsigned int flags); + /** * Unescape an application/x-www-form-urlencoded string * @param query The query to unescape @@ -1831,7 +1843,7 @@ AP_DECLARE(void) ap_no2slash_ex(char *name, int is_fs_path) #define AP_NORMALIZE_NOT_ABOVE_ROOT (1u << 1) #define AP_NORMALIZE_DECODE_UNRESERVED (1u << 2) #define AP_NORMALIZE_MERGE_SLASHES (1u << 3) -#define AP_NORMALIZE_DROP_PARAMETERS (1u << 4) +#define AP_NORMALIZE_DROP_PARAMETERS (0) /* deprecated */ /** * Remove all ////, /./ and /xx/../ substrings from a path, and more -- cgit v1.2.1