aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/modules')
-rw-r--r--src/http/modules/ngx_http_gzip_filter.c2
-rw-r--r--src/http/modules/ngx_http_headers_filter.c4
-rw-r--r--src/http/modules/ngx_http_range_filter.c6
-rw-r--r--src/http/modules/ngx_http_static_handler.c4
-rw-r--r--src/http/modules/ngx_http_status_handler.c4
-rw-r--r--src/http/modules/ngx_http_userid_filter.c2
-rw-r--r--src/http/modules/proxy/ngx_http_proxy_handler.h3
-rw-r--r--src/http/modules/proxy/ngx_http_proxy_header.c24
-rw-r--r--src/http/modules/proxy/ngx_http_proxy_upstream.c24
9 files changed, 46 insertions, 27 deletions
diff --git a/src/http/modules/ngx_http_gzip_filter.c b/src/http/modules/ngx_http_gzip_filter.c
index 8fbf3a9a3..b170df872 100644
--- a/src/http/modules/ngx_http_gzip_filter.c
+++ b/src/http/modules/ngx_http_gzip_filter.c
@@ -297,7 +297,7 @@ static ngx_int_t ngx_http_gzip_header_filter(ngx_http_request_t *r)
sizeof(ngx_http_gzip_ctx_t), NGX_ERROR);
ctx->request = r;
- r->headers_out.content_encoding = ngx_push_list(&r->headers_out.headers);
+ r->headers_out.content_encoding = ngx_list_push(&r->headers_out.headers);
if (r->headers_out.content_encoding == NULL) {
return NGX_ERROR;
}
diff --git a/src/http/modules/ngx_http_headers_filter.c b/src/http/modules/ngx_http_headers_filter.c
index b821c0db1..00c0070ea 100644
--- a/src/http/modules/ngx_http_headers_filter.c
+++ b/src/http/modules/ngx_http_headers_filter.c
@@ -75,13 +75,13 @@ static ngx_int_t ngx_http_headers_filter(ngx_http_request_t *r)
if (conf->expires != NGX_HTTP_EXPIRES_OFF) {
- if (!(expires = ngx_push_list(&r->headers_out.headers))) {
+ if (!(expires = ngx_list_push(&r->headers_out.headers))) {
return NGX_ERROR;
}
r->headers_out.expires = expires;
- if (!(cc = ngx_push_list(&r->headers_out.headers))) {
+ if (!(cc = ngx_list_push(&r->headers_out.headers))) {
return NGX_ERROR;
}
diff --git a/src/http/modules/ngx_http_range_filter.c b/src/http/modules/ngx_http_range_filter.c
index 913c90a96..ce13766eb 100644
--- a/src/http/modules/ngx_http_range_filter.c
+++ b/src/http/modules/ngx_http_range_filter.c
@@ -123,7 +123,7 @@ static ngx_int_t ngx_http_range_header_filter(ngx_http_request_t *r)
|| ngx_strncasecmp(r->headers_in.range->value.data, "bytes=", 6) != 0)
{
- r->headers_out.accept_ranges = ngx_push_list(&r->headers_out.headers);
+ r->headers_out.accept_ranges = ngx_list_push(&r->headers_out.headers);
if (r->headers_out.accept_ranges == NULL) {
return NGX_ERROR;
}
@@ -244,7 +244,7 @@ static ngx_int_t ngx_http_range_header_filter(ngx_http_request_t *r)
r->headers_out.status = rc;
r->headers_out.ranges.nelts = 0;
- r->headers_out.content_range = ngx_push_list(&r->headers_out.headers);
+ r->headers_out.content_range = ngx_list_push(&r->headers_out.headers);
if (r->headers_out.content_range == NULL) {
return NGX_ERROR;
}
@@ -277,7 +277,7 @@ static ngx_int_t ngx_http_range_header_filter(ngx_http_request_t *r)
if (r->headers_out.ranges.nelts == 1) {
r->headers_out.content_range =
- ngx_push_list(&r->headers_out.headers);
+ ngx_list_push(&r->headers_out.headers);
if (r->headers_out.content_range == NULL) {
return NGX_ERROR;
}
diff --git a/src/http/modules/ngx_http_static_handler.c b/src/http/modules/ngx_http_static_handler.c
index ad7d9cf53..5d27ccafc 100644
--- a/src/http/modules/ngx_http_static_handler.c
+++ b/src/http/modules/ngx_http_static_handler.c
@@ -341,8 +341,8 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r)
*last++ = '/';
*last = '\0';
- if (!(r->headers_out.location = ngx_push_list(&r->headers_out.headers)))
- {
+ r->headers_out.location = ngx_list_push(&r->headers_out.headers);
+ if (r->headers_out.location == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
diff --git a/src/http/modules/ngx_http_status_handler.c b/src/http/modules/ngx_http_status_handler.c
index 97492ebb9..6fc1e777d 100644
--- a/src/http/modules/ngx_http_status_handler.c
+++ b/src/http/modules/ngx_http_status_handler.c
@@ -70,8 +70,8 @@ static ngx_int_t ngx_http_status_handler(ngx_http_request_t *r)
return rc;
}
- if (!(r->headers_out.content_type = ngx_push_list(&r->headers_out.headers)))
- {
+ r->headers_out.content_type = ngx_list_push(&r->headers_out.headers);
+ if (r->headers_out.content_type == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
diff --git a/src/http/modules/ngx_http_userid_filter.c b/src/http/modules/ngx_http_userid_filter.c
index 842719e52..718cca7e2 100644
--- a/src/http/modules/ngx_http_userid_filter.c
+++ b/src/http/modules/ngx_http_userid_filter.c
@@ -381,7 +381,7 @@ static ngx_int_t ngx_http_userid_set_uid(ngx_http_request_t *r,
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"uid cookie: \"%s\"", cookie);
- if (!(set_cookie = ngx_push_list(&r->headers_out.headers))) {
+ if (!(set_cookie = ngx_list_push(&r->headers_out.headers))) {
return NGX_ERROR;
}
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.h b/src/http/modules/proxy/ngx_http_proxy_handler.h
index fa8698231..6e3725899 100644
--- a/src/http/modules/proxy/ngx_http_proxy_handler.h
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.h
@@ -107,7 +107,10 @@ typedef struct {
typedef struct {
+ ngx_list_t headers;
+#if 0
ngx_table_t headers; /* it must be first field */
+#endif
ngx_table_elt_t *date;
ngx_table_elt_t *server;
diff --git a/src/http/modules/proxy/ngx_http_proxy_header.c b/src/http/modules/proxy/ngx_http_proxy_header.c
index a3e05e513..9e72f629b 100644
--- a/src/http/modules/proxy/ngx_http_proxy_header.c
+++ b/src/http/modules/proxy/ngx_http_proxy_header.c
@@ -12,13 +12,31 @@ int ngx_http_proxy_copy_header(ngx_http_proxy_ctx_t *p,
ngx_http_proxy_headers_in_t *headers_in)
{
ngx_uint_t i;
+ ngx_list_part_t *part;
ngx_table_elt_t *ho, *h;
ngx_http_request_t *r;
r = p->request;
+ part = &headers_in->headers.part;
+ h = part->elts;
+
+#if 0
h = headers_in->headers.elts;
for (i = 0; i < headers_in->headers.nelts; i++) {
+#endif
+
+ for (i = 0 ; /* void */; i++) {
+
+ if (i >= part->nelts) {
+ if (part->next == NULL) {
+ break;
+ }
+
+ part = part->next;
+ h = part->elts;
+ i = 0;
+ }
/* ignore some headers */
@@ -69,8 +87,7 @@ int ngx_http_proxy_copy_header(ngx_http_proxy_ctx_t *p,
/* copy some header pointers and set up r->headers_out */
- if (!(ho = ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
- {
+ if (!(ho = ngx_list_push(&r->headers_out.headers))) {
return NGX_ERROR;
}
@@ -138,8 +155,7 @@ static int ngx_http_proxy_rewrite_location_header(ngx_http_proxy_ctx_t *p,
r = p->request;
uc = p->lcf->upstream;
- location = ngx_http_add_header(&r->headers_out, ngx_http_headers_out);
- if (location == NULL) {
+ if (!(location = ngx_list_push(&r->headers_out.headers))) {
return NGX_ERROR;
}
diff --git a/src/http/modules/proxy/ngx_http_proxy_upstream.c b/src/http/modules/proxy/ngx_http_proxy_upstream.c
index 5930ceb14..0cffbce78 100644
--- a/src/http/modules/proxy/ngx_http_proxy_upstream.c
+++ b/src/http/modules/proxy/ngx_http_proxy_upstream.c
@@ -954,20 +954,22 @@ static void ngx_http_proxy_process_upstream_status_line(ngx_event_t *rev)
/* init or reinit the p->upstream->headers_in.headers table */
- if (p->upstream->headers_in.headers.elts) {
- p->upstream->headers_in.headers.nelts = 0;
+ if (p->upstream->headers_in.headers.part.elts) {
+ p->upstream->headers_in.headers.part.nelts = 0;
+ p->upstream->headers_in.headers.part.next = NULL;
+ p->upstream->headers_in.headers.last =
+ &p->upstream->headers_in.headers.part;
+
+ ngx_memzero(&p->upstream->headers_in.date,
+ sizeof(ngx_http_proxy_headers_in_t) - sizeof(ngx_list_t));
} else {
- p->upstream->headers_in.headers.elts = ngx_pcalloc(p->request->pool,
- 20 * sizeof(ngx_table_elt_t));
- if (p->upstream->headers_in.headers.elts == NULL) {
+ if (ngx_list_init(&p->upstream->headers_in.headers, p->request->pool,
+ 20, sizeof(ngx_table_elt_t)) == NGX_ERROR)
+ {
ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
}
- /* p->upstream->headers_in.headers.nelts = 0; */
- p->upstream->headers_in.headers.nalloc = 20;
- p->upstream->headers_in.headers.size = sizeof(ngx_table_elt_t);
- p->upstream->headers_in.headers.pool = p->request->pool;
}
@@ -1025,9 +1027,7 @@ static void ngx_http_proxy_process_upstream_headers(ngx_event_t *rev)
/* a header line has been parsed successfully */
- h = ngx_http_add_header(&p->upstream->headers_in,
- ngx_http_proxy_headers_in);
- if (h == NULL) {
+ if (!(h = ngx_list_push(&p->upstream->headers_in.headers))) {
ngx_http_proxy_finalize_request(p,
NGX_HTTP_INTERNAL_SERVER_ERROR);
return;