[nginx] Core: use uppercase hexadecimal digits for percent-encod...

Maxim Dounin mdounin at mdounin.ru
Sun Jul 27 17:01:22 UTC 2014

details:   http://hg.nginx.org/nginx/rev/d421be0d842a
changeset: 5772:d421be0d842a
user:      Piotr Sikora <piotr at cloudflare.com>
date:      Thu Jun 26 23:39:23 2014 -0700
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>


 src/core/ngx_string.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c
--- a/src/core/ngx_string.c
+++ b/src/core/ngx_string.c
@@ -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