aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/proxy
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/modules/proxy')
-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
3 files changed, 35 insertions, 16 deletions
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;