[PATCH] Core: use uppercase hexadecimal digits for percent-encoding

Piotr Sikora piotr at cloudflare.com
Fri Jun 27 06:40:27 UTC 2014


# HG changeset patch
# User Piotr Sikora <piotr at cloudflare.com>
# Date 1403851163 25200
#      Thu Jun 26 23:39:23 2014 -0700
# Node ID 177382006b7d7a421688831d5793b2e417074b48
# Parent  42114bf12da0cf3d428d0e695139f5366cbd0513
Core: use uppercase hexadecimal digits for percent-encoding.

RFC3986 says that, for consistency, URI producers and normalizers
should use uppercase hexadecimal digits for all percent-encodings.

This is also what modern web browsers and other tools use.

Using lowercase hexadecimal digits makes it harder to interact with
those tools in case when use of the percent-encoded URI is required,
for example when $request_uri is part of the cache key.

Signed-off-by: Piotr Sikora <piotr at cloudflare.com>

diff -r 42114bf12da0 -r 177382006b7d src/core/ngx_string.c
--- a/src/core/ngx_string.c	Mon Jun 16 19:43:25 2014 +0400
+++ b/src/core/ngx_string.c	Thu Jun 26 23:39:23 2014 -0700
@@ -1407,7 +1407,7 @@ ngx_escape_uri(u_char *dst, u_char *src,
 {
     ngx_uint_t      n;
     uint32_t       *escape;
-    static u_char   hex[] = "0123456789abcdef";
+    static u_char   hex[] = "0123456789ABCDEF";
 
                     /* " ", "#", "%", "?", %00-%1F, %7F-%FF */
 



More information about the nginx-devel mailing list