summaryrefslogtreecommitdiffhomepage
path: root/src/http/modules
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2022-05-30 21:25:45 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2022-05-30 21:25:45 +0300
commite59c2096ae9d561997ad2d64d61094503e6be4c3 (patch)
treee02d6b996a9a4a1876d1b569809fdffe7b033263 /src/http/modules
parentbbf8ed48c455dbb95accf886d25be95d15abde1f (diff)
downloadnginx-e59c2096ae9d561997ad2d64d61094503e6be4c3.tar.gz
nginx-e59c2096ae9d561997ad2d64d61094503e6be4c3.tar.bz2
All known output headers can be linked lists now.
The h->next pointer properly provided as NULL in all cases where known output headers are added. Note that there are 3rd party modules which might not do this, and it might be risky to rely on this for arbitrary headers.
Diffstat (limited to 'src/http/modules')
-rw-r--r--src/http/modules/ngx_http_auth_basic_module.c1
-rw-r--r--src/http/modules/ngx_http_auth_request_module.c1
-rw-r--r--src/http/modules/ngx_http_dav_module.c1
-rw-r--r--src/http/modules/ngx_http_gzip_filter_module.c1
-rw-r--r--src/http/modules/ngx_http_gzip_static_module.c1
-rw-r--r--src/http/modules/ngx_http_headers_filter_module.c2
-rw-r--r--src/http/modules/ngx_http_memcached_module.c1
-rw-r--r--src/http/modules/ngx_http_range_filter_module.c3
-rw-r--r--src/http/modules/ngx_http_static_module.c1
-rw-r--r--src/http/modules/perl/nginx.xs1
10 files changed, 13 insertions, 0 deletions
diff --git a/src/http/modules/ngx_http_auth_basic_module.c b/src/http/modules/ngx_http_auth_basic_module.c
index 069331982..02d41e88a 100644
--- a/src/http/modules/ngx_http_auth_basic_module.c
+++ b/src/http/modules/ngx_http_auth_basic_module.c
@@ -339,6 +339,7 @@ ngx_http_auth_basic_set_realm(ngx_http_request_t *r, ngx_str_t *realm)
*p = '"';
r->headers_out.www_authenticate->hash = 1;
+ r->headers_out.www_authenticate->next = NULL;
ngx_str_set(&r->headers_out.www_authenticate->key, "WWW-Authenticate");
r->headers_out.www_authenticate->value.data = basic;
r->headers_out.www_authenticate->value.len = len;
diff --git a/src/http/modules/ngx_http_auth_request_module.c b/src/http/modules/ngx_http_auth_request_module.c
index bab79e496..f64ab09aa 100644
--- a/src/http/modules/ngx_http_auth_request_module.c
+++ b/src/http/modules/ngx_http_auth_request_module.c
@@ -154,6 +154,7 @@ ngx_http_auth_request_handler(ngx_http_request_t *r)
}
*ho = *h;
+ ho->next = NULL;
r->headers_out.www_authenticate = ho;
}
diff --git a/src/http/modules/ngx_http_dav_module.c b/src/http/modules/ngx_http_dav_module.c
index 0cc9ae18b..cfb98929e 100644
--- a/src/http/modules/ngx_http_dav_module.c
+++ b/src/http/modules/ngx_http_dav_module.c
@@ -1082,6 +1082,7 @@ ngx_http_dav_location(ngx_http_request_t *r)
}
r->headers_out.location->hash = 1;
+ r->headers_out.location->next = NULL;
ngx_str_set(&r->headers_out.location->key, "Location");
escape = 2 * ngx_escape_uri(NULL, r->uri.data, r->uri.len, NGX_ESCAPE_URI);
diff --git a/src/http/modules/ngx_http_gzip_filter_module.c b/src/http/modules/ngx_http_gzip_filter_module.c
index b8c5ccc5c..b7758690f 100644
--- a/src/http/modules/ngx_http_gzip_filter_module.c
+++ b/src/http/modules/ngx_http_gzip_filter_module.c
@@ -280,6 +280,7 @@ ngx_http_gzip_header_filter(ngx_http_request_t *r)
}
h->hash = 1;
+ h->next = NULL;
ngx_str_set(&h->key, "Content-Encoding");
ngx_str_set(&h->value, "gzip");
r->headers_out.content_encoding = h;
diff --git a/src/http/modules/ngx_http_gzip_static_module.c b/src/http/modules/ngx_http_gzip_static_module.c
index 7652a9af3..66fcc5d1b 100644
--- a/src/http/modules/ngx_http_gzip_static_module.c
+++ b/src/http/modules/ngx_http_gzip_static_module.c
@@ -242,6 +242,7 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
}
h->hash = 1;
+ h->next = NULL;
ngx_str_set(&h->key, "Content-Encoding");
ngx_str_set(&h->value, "gzip");
r->headers_out.content_encoding = h;
diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c
index 995beb41b..50295f452 100644
--- a/src/http/modules/ngx_http_headers_filter_module.c
+++ b/src/http/modules/ngx_http_headers_filter_module.c
@@ -362,6 +362,7 @@ ngx_http_set_expires(ngx_http_request_t *r, ngx_http_headers_conf_t *conf)
}
r->headers_out.expires = e;
+ e->next = NULL;
e->hash = 1;
ngx_str_set(&e->key, "Expires");
@@ -621,6 +622,7 @@ ngx_http_set_response_header(ngx_http_request_t *r, ngx_http_header_val_t *hv,
}
*old = h;
+ h->next = NULL;
}
h->hash = 1;
diff --git a/src/http/modules/ngx_http_memcached_module.c b/src/http/modules/ngx_http_memcached_module.c
index c82df6e33..11bbd9165 100644
--- a/src/http/modules/ngx_http_memcached_module.c
+++ b/src/http/modules/ngx_http_memcached_module.c
@@ -401,6 +401,7 @@ found:
}
h->hash = 1;
+ h->next = NULL;
ngx_str_set(&h->key, "Content-Encoding");
ngx_str_set(&h->value, "gzip");
r->headers_out.content_encoding = h;
diff --git a/src/http/modules/ngx_http_range_filter_module.c b/src/http/modules/ngx_http_range_filter_module.c
index ae08ebbc5..fa408b792 100644
--- a/src/http/modules/ngx_http_range_filter_module.c
+++ b/src/http/modules/ngx_http_range_filter_module.c
@@ -258,6 +258,7 @@ next_filter:
}
r->headers_out.accept_ranges->hash = 1;
+ r->headers_out.accept_ranges->next = NULL;
ngx_str_set(&r->headers_out.accept_ranges->key, "Accept-Ranges");
ngx_str_set(&r->headers_out.accept_ranges->value, "bytes");
@@ -427,6 +428,7 @@ ngx_http_range_singlepart_header(ngx_http_request_t *r,
r->headers_out.content_range = content_range;
content_range->hash = 1;
+ content_range->next = NULL;
ngx_str_set(&content_range->key, "Content-Range");
content_range->value.data = ngx_pnalloc(r->pool,
@@ -599,6 +601,7 @@ ngx_http_range_not_satisfiable(ngx_http_request_t *r)
r->headers_out.content_range = content_range;
content_range->hash = 1;
+ content_range->next = NULL;
ngx_str_set(&content_range->key, "Content-Range");
content_range->value.data = ngx_pnalloc(r->pool,
diff --git a/src/http/modules/ngx_http_static_module.c b/src/http/modules/ngx_http_static_module.c
index cf29d5a6d..e30565d4e 100644
--- a/src/http/modules/ngx_http_static_module.c
+++ b/src/http/modules/ngx_http_static_module.c
@@ -195,6 +195,7 @@ ngx_http_static_handler(ngx_http_request_t *r)
}
r->headers_out.location->hash = 1;
+ r->headers_out.location->next = NULL;
ngx_str_set(&r->headers_out.location->key, "Location");
r->headers_out.location->value.len = len;
r->headers_out.location->value.data = location;
diff --git a/src/http/modules/perl/nginx.xs b/src/http/modules/perl/nginx.xs
index c398e77d7..da1227952 100644
--- a/src/http/modules/perl/nginx.xs
+++ b/src/http/modules/perl/nginx.xs
@@ -573,6 +573,7 @@ header_out(r, key, value)
}
header->hash = 1;
+ header->next = NULL;
if (ngx_http_perl_sv2str(aTHX_ r, &header->key, key) != NGX_OK) {
header->hash = 0;