diff options
Diffstat (limited to 'www-servers/nginx/files/http_headers_more-nginx-1.23.0.patch')
-rw-r--r-- | www-servers/nginx/files/http_headers_more-nginx-1.23.0.patch | 187 |
1 files changed, 187 insertions, 0 deletions
diff --git a/www-servers/nginx/files/http_headers_more-nginx-1.23.0.patch b/www-servers/nginx/files/http_headers_more-nginx-1.23.0.patch new file mode 100644 index 000000000000..4c06315323f3 --- /dev/null +++ b/www-servers/nginx/files/http_headers_more-nginx-1.23.0.patch @@ -0,0 +1,187 @@ +diff --git a/src/ngx_http_headers_more_headers_in.c b/src/ngx_http_headers_more_headers_in.c +index c3eb8f7..84c7525 100644 +--- a/src/ngx_http_headers_more_headers_in.c ++++ b/src/ngx_http_headers_more_headers_in.c +@@ -158,9 +158,15 @@ static ngx_http_headers_more_set_header_t ngx_http_headers_more_set_handlers[] + ngx_http_set_builtin_header }, + #endif + ++#if defined(nginx_version) && nginx_version >= 1023000 ++ { ngx_string("Cookie"), ++ offsetof(ngx_http_headers_in_t, cookie), ++ ngx_http_set_builtin_multi_header }, ++#else + { ngx_string("Cookie"), + offsetof(ngx_http_headers_in_t, cookies), + ngx_http_set_builtin_multi_header }, ++#endif + + { ngx_null_string, 0, ngx_http_set_header } + }; +diff --git a/.travis.yml b/.travis.yml +index 9748a99..bf40b31 100644 +--- a/.travis.yml ++++ b/.travis.yml +@@ -23,6 +23,7 @@ env: + matrix: + - NGINX_VERSION=1.19.3 + - NGINX_VERSION=1.19.9 ++ - NGINX_VERSION=1.23.0 + + before_install: + - sudo apt-get update -y +@@ -51,3 +52,4 @@ script: + - export NGX_BUILD_CC=$CC + - sh util/build.sh $NGINX_VERSION > build.log 2>&1 || (cat build.log && exit 1) + - prove -I. -r t ++ +diff --git a/src/ngx_http_headers_more_headers_in.c b/src/ngx_http_headers_more_headers_in.c +index 84c7525..11447ce 100644 +--- a/src/ngx_http_headers_more_headers_in.c ++++ b/src/ngx_http_headers_more_headers_in.c +@@ -758,6 +758,50 @@ static ngx_int_t + ngx_http_set_builtin_multi_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) + { ++#if defined(nginx_version) && nginx_version >= 1023000 ++ ngx_table_elt_t **headers, **ph, *h; ++ int nelts; ++ ++ if (r->headers_out.status == 400 || r->headers_in.headers.last == NULL) { ++ /* must be a 400 Bad Request */ ++ return NGX_OK; ++ } ++ ++ headers = (ngx_table_elt_t **) ((char *) &r->headers_in + hv->offset); ++ ++ if (*headers) { ++ nelts = 0; ++ for (h = *headers; h; h = h->next) { ++ nelts++; ++ } ++ ++ *headers = NULL; ++ ++ dd("clear multi-value headers: %d", nelts); ++ } ++ ++ if (ngx_http_set_header_helper(r, hv, value, &h) == NGX_ERROR) { ++ return NGX_ERROR; ++ } ++ ++ if (value->len == 0) { ++ return NGX_OK; ++ } ++ ++ dd("new multi-value header: %p", h); ++ ++ if (*headers) { ++ for (ph = headers; *ph; ph = &(*ph)->next) { /* void */ } ++ *ph = h; ++ ++ } else { ++ *headers = h; ++ } ++ ++ h->next = NULL; ++ ++ return NGX_OK; ++#else + ngx_array_t *headers; + ngx_table_elt_t **v, *h; + +@@ -810,6 +854,7 @@ ngx_http_set_builtin_multi_header(ngx_http_request_t *r, + + *v = h; + return NGX_OK; ++#endif + } + + +@@ -842,6 +887,7 @@ ngx_http_headers_more_validate_host(ngx_str_t *host, ngx_pool_t *pool, + if (dot_pos == i - 1) { + return NGX_DECLINED; + } ++ + dot_pos = i; + break; + +diff --git a/src/ngx_http_headers_more_headers_out.c b/src/ngx_http_headers_more_headers_out.c +index 0f9bc87..9d58ede 100644 +--- a/src/ngx_http_headers_more_headers_out.c ++++ b/src/ngx_http_headers_more_headers_out.c +@@ -327,6 +327,46 @@ static ngx_int_t + ngx_http_set_builtin_multi_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) + { ++#if defined(nginx_version) && nginx_version >= 1023000 ++ ngx_table_elt_t **headers, *h, *ho, **ph; ++ ++ headers = (ngx_table_elt_t **) ((char *) &r->headers_out + hv->offset); ++ ++ if (*headers) { ++ for (h = (*headers)->next; h; h = h->next) { ++ h->hash = 0; ++ h->value.len = 0; ++ } ++ ++ h = *headers; ++ ++ h->value = *value; ++ ++ if (value->len == 0) { ++ h->hash = 0; ++ ++ } else { ++ h->hash = hv->hash; ++ } ++ ++ return NGX_OK; ++ } ++ ++ for (ph = headers; *ph; ph = &(*ph)->next) { /* void */ } ++ ++ ho = ngx_list_push(&r->headers_out.headers); ++ if (ho == NULL) { ++ return NGX_ERROR; ++ } ++ ++ ho->value = *value; ++ ho->hash = hv->hash; ++ ngx_str_set(&ho->key, "Cache-Control"); ++ ho->next = NULL; ++ *ph = ho; ++ ++ return NGX_OK; ++#else + ngx_array_t *pa; + ngx_table_elt_t *ho, **ph; + ngx_uint_t i; +@@ -378,6 +418,7 @@ ngx_http_set_builtin_multi_header(ngx_http_request_t *r, + *ph = ho; + + return NGX_OK; ++#endif + } + + +diff --git a/src/ngx_http_headers_more_util.c b/src/ngx_http_headers_more_util.c +index caf372e..e1f3636 100644 +--- a/src/ngx_http_headers_more_util.c ++++ b/src/ngx_http_headers_more_util.c +@@ -295,6 +295,7 @@ ngx_http_headers_more_rm_header_helper(ngx_list_t *l, ngx_list_part_t *cur, + if (part->next == NULL) { + return NGX_ERROR; + } ++ + part = part->next; + } + +@@ -338,6 +339,7 @@ ngx_http_headers_more_rm_header_helper(ngx_list_t *l, ngx_list_part_t *cur, + if (part->next == NULL) { + return NGX_ERROR; + } ++ + part = part->next; + } + |