From d11adaf66b2bdd5e88dc8f41cfc97f9e763ce26c Mon Sep 17 00:00:00 2001 From: jiahao Date: Tue, 26 Oct 2021 11:50:29 +0800 Subject: [PATCH] remove static_mod_escape_loc_hdr patch since nginx 1.21.0 is already patched. --- ...inx-1.21.3-static_mod_escape_loc_hdr.patch | 50 ------------------- util/mirror-tarballs | 9 ++-- util/ver | 4 +- 3 files changed, 8 insertions(+), 55 deletions(-) delete mode 100644 patches/nginx-1.21.3-static_mod_escape_loc_hdr.patch diff --git a/patches/nginx-1.21.3-static_mod_escape_loc_hdr.patch b/patches/nginx-1.21.3-static_mod_escape_loc_hdr.patch deleted file mode 100644 index 04d9ef1..0000000 --- a/patches/nginx-1.21.3-static_mod_escape_loc_hdr.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff --git a/src/http/modules/ngx_http_static_module.c b/src/http/modules/ngx_http_static_module.c -index 282d6ee..899e11e 100644 ---- a/src/http/modules/ngx_http_static_module.c -+++ b/src/http/modules/ngx_http_static_module.c -@@ -58,6 +58,8 @@ ngx_http_static_handler(ngx_http_request_t *r) - ngx_chain_t out; - ngx_open_file_info_t of; - ngx_http_core_loc_conf_t *clcf; -+ u_char *uri; -+ uintptr_t escape; - - if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD|NGX_HTTP_POST))) { - return NGX_HTTP_NOT_ALLOWED; -@@ -162,9 +164,21 @@ ngx_http_static_handler(ngx_http_request_t *r) - - *last = '/'; - -+ escape = 2 * ngx_escape_uri(NULL, location, len, NGX_ESCAPE_URI); -+ if (escape > 0) { -+ uri = ngx_pnalloc(r->pool, len + escape); -+ if (uri == NULL) { -+ return NGX_ERROR; -+ } -+ ngx_escape_uri(uri, location, len, NGX_ESCAPE_URI); -+ location = uri; -+ len += escape; -+ } -+ - } else { -+ escape = 2 * ngx_escape_uri(NULL, r->uri.data, r->uri.len, NGX_ESCAPE_URI); - if (r->args.len) { -- len += r->args.len + 1; -+ len += r->args.len + 1 + escape; - } - - location = ngx_pnalloc(r->pool, len); -@@ -173,7 +187,12 @@ ngx_http_static_handler(ngx_http_request_t *r) - return NGX_HTTP_INTERNAL_SERVER_ERROR; - } - -- last = ngx_copy(location, r->uri.data, r->uri.len); -+ if (escape > 0) { -+ last = (u_char *) ngx_escape_uri(location, r->uri.data, r->uri.len, NGX_ESCAPE_URI); -+ -+ } else { -+ last = ngx_copy(location, r->uri.data, r->uri.len); -+ } - - *last = '/'; - diff --git a/util/mirror-tarballs b/util/mirror-tarballs index 78894e5..3e1fb93 100755 --- a/util/mirror-tarballs +++ b/util/mirror-tarballs @@ -452,9 +452,12 @@ rm -f *.patch || exit 1 answer=`$root/util/ver-ge "$main_ver" 1.17.8` if [ "$answer" = "Y" ]; then - echo "$info_txt applying the patch for nginx security issue https://hackerone.com/reports/513236" - patch -p1 < $root/patches/nginx-$main_ver-static_mod_escape_loc_hdr.patch - echo + answer=`$root/util/ver-ge "$main_ver" 1.21.0` + if [ "$answer" = "N" ]; then + echo "$info_txt applying the patch for nginx security issue https://hackerone.com/reports/513236" + patch -p1 < $root/patches/nginx-$main_ver-static_mod_escape_loc_hdr.patch + echo + fi fi echo "$info_txt applying the always_enable_cc_feature_tests patch to nginx" diff --git a/util/ver b/util/ver index 8fe4c8f..c1d55a3 100755 --- a/util/ver +++ b/util/ver @@ -1,7 +1,7 @@ #!/bin/bash -main_ver=1.19.9 -minor_ver=1 +main_ver=1.21.3 +minor_ver=1rc1 version=$main_ver.$minor_ver echo $version