summaryrefslogtreecommitdiff
path: root/www-servers/nginx/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-07-14 01:38:22 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-07-14 01:38:22 +0100
commitae5005f56ad29d19861ad8a8acb541cf0e99c8d9 (patch)
tree519be2a26050e34055ea7f44d9272c9365e10e5d /www-servers/nginx/files
parentd01ca4361883c2aec4ffb1c2dcd75980773fdc31 (diff)
gentoo auto-resync : 14:07:2022 - 01:38:22
Diffstat (limited to 'www-servers/nginx/files')
-rw-r--r--www-servers/nginx/files/http_headers_more-nginx-1.23.0.patch187
-rw-r--r--www-servers/nginx/files/http_sticky-nginx-1.23.0.patch25
-rw-r--r--www-servers/nginx/files/http_uploadprogress-nginx-1.23.0.patch74
3 files changed, 286 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;
+ }
+
diff --git a/www-servers/nginx/files/http_sticky-nginx-1.23.0.patch b/www-servers/nginx/files/http_sticky-nginx-1.23.0.patch
new file mode 100644
index 000000000000..da6126eacabb
--- /dev/null
+++ b/www-servers/nginx/files/http_sticky-nginx-1.23.0.patch
@@ -0,0 +1,25 @@
+From 105c946c0c1af93099502417784888acf60da540 Mon Sep 17 00:00:00 2001
+From: Younes El-karama <yelkarama@gmail.com>
+Date: Sat, 2 Jul 2022 04:56:12 +0000
+Subject: [PATCH] make it compatible with nginx 1.23
+
+---
+ ngx_http_sticky_module.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ngx_http_sticky_module.c b/ngx_http_sticky_module.c
+index c9a0a04..37b5bc3 100644
+--- a/ngx_http_sticky_module.c
++++ b/ngx_http_sticky_module.c
+@@ -204,7 +204,7 @@ static ngx_int_t ngx_http_init_sticky_peer(ngx_http_request_t *r, ngx_http_upstr
+ iphp->request = r;
+
+ /* check weather a cookie is present or not and save it */
+- if (ngx_http_parse_multi_header_lines(&r->headers_in.cookies, &iphp->sticky_conf->cookie_name, &route) != NGX_DECLINED) {
++ if (ngx_http_parse_multi_header_lines(r, r->headers_in.cookie, &iphp->sticky_conf->cookie_name, &route) != NULL) {
+ /* a route cookie has been found. Let's give it a try */
+ ngx_log_debug(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "[sticky/init_sticky_peer] got cookie route=%V, let's try to find a matching peer", &route);
+
+--
+2.36.1
+
diff --git a/www-servers/nginx/files/http_uploadprogress-nginx-1.23.0.patch b/www-servers/nginx/files/http_uploadprogress-nginx-1.23.0.patch
new file mode 100644
index 000000000000..3635aa45b53d
--- /dev/null
+++ b/www-servers/nginx/files/http_uploadprogress-nginx-1.23.0.patch
@@ -0,0 +1,74 @@
+diff -pNura http-uploadprogress.orig/ngx_http_uploadprogress_module.c http-uploadprogress/ngx_http_uploadprogress_module.c
+--- http-uploadprogress.orig/ngx_http_uploadprogress_module.c 2020-10-03 02:05:45.000000000 +0700
++++ http-uploadprogress/ngx_http_uploadprogress_module.c 2022-06-24 16:24:16.196626939 +0700
+@@ -550,12 +550,12 @@ ngx_http_reportuploads_handler(ngx_http_
+ ngx_chain_t out;
+ ngx_int_t rc, found=0, done=0, err_status=0;
+ off_t rest=0, length=0;
+- ngx_uint_t len, i;
++ ngx_uint_t len;
+ ngx_slab_pool_t *shpool;
+ ngx_http_uploadprogress_conf_t *upcf;
+ ngx_http_uploadprogress_ctx_t *ctx;
+ ngx_http_uploadprogress_node_t *up;
+- ngx_table_elt_t *expires, *cc, **ccp;
++ ngx_table_elt_t *expires, *cc;
+ ngx_http_uploadprogress_state_t state;
+ ngx_http_uploadprogress_template_t *t;
+
+@@ -628,6 +628,7 @@ ngx_http_reportuploads_handler(ngx_http_
+ }
+
+ r->headers_out.expires = expires;
++ expires->next = NULL;
+
+ expires->hash = 1;
+ expires->key.len = sizeof("Expires") - 1;
+@@ -637,37 +638,30 @@ ngx_http_reportuploads_handler(ngx_http_
+ len = sizeof("Mon, 28 Sep 1970 06:00:00 GMT");
+ expires->value.len = len - 1;
+
+- ccp = r->headers_out.cache_control.elts;
+- if (ccp == NULL) {
++ cc = r->headers_out.cache_control;
+
+- if (ngx_array_init(&r->headers_out.cache_control, r->pool,
+- 1, sizeof(ngx_table_elt_t *))
+- != NGX_OK) {
+- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+- }
+-
+- ccp = ngx_array_push(&r->headers_out.cache_control);
+- if (ccp == NULL) {
+- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+- }
++ if (cc == NULL) {
+
+ cc = ngx_list_push(&r->headers_out.headers);
+ if (cc == NULL) {
++ expires->hash = 0;
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
+
++ r->headers_out.cache_control = cc;
++ cc->next = NULL;
++
+ cc->hash = 1;
+ cc->key.len = sizeof("Cache-Control") - 1;
+ cc->key.data = (u_char *) "Cache-Control";
+
+- *ccp = cc;
+-
+ } else {
+- for (i = 1; i < r->headers_out.cache_control.nelts; i++) {
+- ccp[i]->hash = 0;
++ for (cc = cc->next; cc; cc = cc->next) {
++ cc->hash = 0;
+ }
+
+- cc = ccp[0];
++ cc = r->headers_out.cache_control;
++ cc->next = NULL;
+ }
+
+ expires->value.data = (u_char *) "Thu, 01 Jan 1970 00:00:01 GMT";