Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/http
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-09-05 23:54:02 +0400
committerIgor Sysoev <igor@sysoev.ru>2004-09-05 23:54:02 +0400
commit980a92472cc30271ad7e88eb2dcc43f00e984d4d (patch)
treeb8940cd9e6b8859c78e3c023c1373bae02371f2e /src/http
parentb9e344175f4e971284aa14c8fe685936a4957d52 (diff)
nginx-0.0.10-2004-09-05-23:54:02 import
Diffstat (limited to 'src/http')
-rw-r--r--src/http/modules/ngx_http_gzip_filter.c3
-rw-r--r--src/http/modules/ngx_http_headers_filter.c6
-rw-r--r--src/http/modules/ngx_http_range_filter.c24
-rw-r--r--src/http/modules/ngx_http_static_handler.c3
-rw-r--r--src/http/modules/ngx_http_status_handler.c3
-rw-r--r--src/http/modules/ngx_http_userid_filter.c28
-rw-r--r--src/http/modules/proxy/ngx_http_proxy_upstream.c32
-rw-r--r--src/http/ngx_http_core_module.c6
-rw-r--r--src/http/ngx_http_header_filter.c49
-rw-r--r--src/http/ngx_http_log_handler.c38
-rw-r--r--src/http/ngx_http_request.c58
-rw-r--r--src/http/ngx_http_request.h18
-rw-r--r--src/http/ngx_http_special_response.c2
13 files changed, 180 insertions, 90 deletions
diff --git a/src/http/modules/ngx_http_gzip_filter.c b/src/http/modules/ngx_http_gzip_filter.c
index 611f157ef..8fbf3a9a3 100644
--- a/src/http/modules/ngx_http_gzip_filter.c
+++ b/src/http/modules/ngx_http_gzip_filter.c
@@ -297,8 +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_http_add_header(&r->headers_out, ngx_http_headers_out);
+ r->headers_out.content_encoding = ngx_push_list(&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 7dcb88d10..b821c0db1 100644
--- a/src/http/modules/ngx_http_headers_filter.c
+++ b/src/http/modules/ngx_http_headers_filter.c
@@ -75,15 +75,13 @@ static ngx_int_t ngx_http_headers_filter(ngx_http_request_t *r)
if (conf->expires != NGX_HTTP_EXPIRES_OFF) {
- expires = ngx_http_add_header(&r->headers_out, ngx_http_headers_out);
- if (expires == NULL) {
+ if (!(expires = ngx_push_list(&r->headers_out.headers))) {
return NGX_ERROR;
}
r->headers_out.expires = expires;
- cc = ngx_http_add_header(&r->headers_out, ngx_http_headers_out);
- if (cc == NULL) {
+ if (!(cc = ngx_push_list(&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 8d3e3dd93..913c90a96 100644
--- a/src/http/modules/ngx_http_range_filter.c
+++ b/src/http/modules/ngx_http_range_filter.c
@@ -123,9 +123,8 @@ 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)
{
- if (!(r->headers_out.accept_ranges =
- ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
- {
+ r->headers_out.accept_ranges = ngx_push_list(&r->headers_out.headers);
+ if (r->headers_out.accept_ranges == NULL) {
return NGX_ERROR;
}
@@ -245,18 +244,19 @@ 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;
- if (!(r->headers_out.content_range =
- ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
- {
+ r->headers_out.content_range = ngx_push_list(&r->headers_out.headers);
+ if (r->headers_out.content_range == NULL) {
return NGX_ERROR;
}
r->headers_out.content_range->key.len = sizeof("Content-Range") - 1;
r->headers_out.content_range->key.data = (u_char *) "Content-Range";
- ngx_test_null(r->headers_out.content_range->value.data,
- ngx_palloc(r->pool, 8 + 20 + 1),
- NGX_ERROR);
+ r->headers_out.content_range->value.data =
+ ngx_palloc(r->pool, 8 + 20 + 1);
+ if (r->headers_out.content_range->value.data == NULL) {
+ return NGX_ERROR;
+ }
r->headers_out.content_range->value.len =
ngx_snprintf((char *) r->headers_out.content_range->value.data,
@@ -276,9 +276,9 @@ static ngx_int_t ngx_http_range_header_filter(ngx_http_request_t *r)
if (r->headers_out.ranges.nelts == 1) {
- if (!(r->headers_out.content_range =
- ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
- {
+ r->headers_out.content_range =
+ ngx_push_list(&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 cf942ad24..ad7d9cf53 100644
--- a/src/http/modules/ngx_http_static_handler.c
+++ b/src/http/modules/ngx_http_static_handler.c
@@ -341,8 +341,7 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r)
*last++ = '/';
*last = '\0';
- if (!(r->headers_out.location =
- ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
+ if (!(r->headers_out.location = ngx_push_list(&r->headers_out.headers)))
{
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 57d7aa077..97492ebb9 100644
--- a/src/http/modules/ngx_http_status_handler.c
+++ b/src/http/modules/ngx_http_status_handler.c
@@ -70,8 +70,7 @@ static ngx_int_t ngx_http_status_handler(ngx_http_request_t *r)
return rc;
}
- if (!(r->headers_out.content_type =
- ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
+ if (!(r->headers_out.content_type = ngx_push_list(&r->headers_out.headers)))
{
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 ba0d5838e..842719e52 100644
--- a/src/http/modules/ngx_http_userid_filter.c
+++ b/src/http/modules/ngx_http_userid_filter.c
@@ -196,25 +196,22 @@ static ngx_int_t ngx_http_userid_get_uid(ngx_http_request_t *r,
ngx_http_userid_ctx_t *ctx,
ngx_http_userid_conf_t *conf)
{
- u_char *start, *last, *end;
- ngx_uint_t *cookies, i;
- ngx_str_t src, dst;
- ngx_table_elt_t *headers;
+ u_char *start, *last, *end;
+ ngx_uint_t i;
+ ngx_str_t src, dst;
+ ngx_table_elt_t **cookies;
- headers = r->headers_in.headers.elts;
cookies = r->headers_in.cookies.elts;
for (i = 0; i < r->headers_in.cookies.nelts; i++) {
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "cookie: %d:\"%s\"",
- cookies[i],
- headers[cookies[i]].value.data);
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "cookie: \"%s\"", cookies[i]->value.data);
- end = headers[cookies[i]].value.data + headers[cookies[i]].value.len;
+ end = cookies[i]->value.data + cookies[i]->value.len;
- for (start = headers[cookies[i]].value.data; start < end; /* void */) {
+ for (start = cookies[i]->value.data; start < end; /* void */) {
- if (conf->name.len >= headers[cookies[i]].value.len
+ if (conf->name.len >= cookies[i]->value.len
|| ngx_strncmp(start, conf->name.data, conf->name.len) != 0)
{
start += conf->name.len;
@@ -241,7 +238,7 @@ static ngx_int_t ngx_http_userid_get_uid(ngx_http_request_t *r,
if (last - start < 22) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"client sent too short userid cookie \"%s\"",
- headers[cookies[i]].value.data);
+ cookies[i]->value.data);
break;
}
@@ -258,7 +255,7 @@ static ngx_int_t ngx_http_userid_get_uid(ngx_http_request_t *r,
if (ngx_decode_base64(&src, &dst) == NGX_ERROR) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"client sent invalid userid cookie \"%s\"",
- headers[cookies[i]].value.data);
+ cookies[i]->value.data);
break;
}
@@ -384,8 +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);
- set_cookie = ngx_http_add_header(&r->headers_out, ngx_http_headers_out);
- if (set_cookie == NULL) {
+ if (!(set_cookie = ngx_push_list(&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 8ac6d506a..5930ceb14 100644
--- a/src/http/modules/proxy/ngx_http_proxy_upstream.c
+++ b/src/http/modules/proxy/ngx_http_proxy_upstream.c
@@ -113,6 +113,7 @@ static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p)
ngx_uint_t i;
ngx_buf_t *b;
ngx_chain_t *chain;
+ ngx_list_part_t *part;
ngx_table_elt_t *header;
ngx_http_request_t *r;
ngx_http_proxy_upstream_conf_t *uc;
@@ -165,8 +166,20 @@ static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p)
}
- header = r->headers_in.headers.elts;
- for (i = 0; i < r->headers_in.headers.nelts; i++) {
+ part = &r->headers_in.headers.part;
+ header = part->elts;
+
+ for (i = 0; /* void */; i++) {
+
+ if (i >= part->nelts) {
+ if (part->next == NULL) {
+ break;
+ }
+
+ part = part->next;
+ header = part->elts;
+ i = 0;
+ }
if (&header[i] == r->headers_in.host) {
continue;
@@ -274,7 +287,20 @@ static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p)
}
- for (i = 0; i < r->headers_in.headers.nelts; i++) {
+ part = &r->headers_in.headers.part;
+ header = part->elts;
+
+ for (i = 0; /* void */; i++) {
+
+ if (i >= part->nelts) {
+ if (part->next == NULL) {
+ break;
+ }
+
+ part = part->next;
+ header = part->elts;
+ i = 0;
+ }
if (&header[i] == r->headers_in.host) {
continue;
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index d242ebf44..62daa8dc1 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -531,8 +531,7 @@ ngx_int_t ngx_http_find_location_config(ngx_http_request_t *r)
if (rc == NGX_HTTP_LOCATION_AUTO_REDIRECT) {
- if (!(r->headers_out.location =
- ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
+ if (!(r->headers_out.location = ngx_push_list(&r->headers_out.headers)))
{
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
@@ -674,8 +673,7 @@ ngx_int_t ngx_http_set_content_type(ngx_http_request_t *r)
ngx_http_type_t *type;
ngx_http_core_loc_conf_t *clcf;
- if (!(r->headers_out.content_type =
- ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
+ if (!(r->headers_out.content_type = ngx_push_list(&r->headers_out.headers)))
{
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
diff --git a/src/http/ngx_http_header_filter.c b/src/http/ngx_http_header_filter.c
index 738f1ebf5..bc78ce974 100644
--- a/src/http/ngx_http_header_filter.c
+++ b/src/http/ngx_http_header_filter.c
@@ -92,12 +92,13 @@ static ngx_str_t http_codes[] = {
static ngx_int_t ngx_http_header_filter(ngx_http_request_t *r)
{
- u_char *p;
- size_t len;
- ngx_uint_t status, i;
- ngx_buf_t *b;
- ngx_chain_t *ln;
- ngx_table_elt_t *header;
+ u_char *p;
+ size_t len;
+ ngx_uint_t status, i;
+ ngx_buf_t *b;
+ ngx_chain_t *ln;
+ ngx_list_part_t *part;
+ ngx_table_elt_t *header;
if (r->http_version < NGX_HTTP_VERSION_10) {
return NGX_OK;
@@ -205,8 +206,26 @@ static ngx_int_t ngx_http_header_filter(ngx_http_request_t *r)
len += sizeof("Connection: closed" CRLF) - 1;
}
+ part = &r->headers_out.headers.part;
+ header = part->elts;
+
+ for (i = 0; /* void */; i++) {
+
+ if (i >= part->nelts) {
+ if (part->next == NULL) {
+ break;
+ }
+
+ part = part->next;
+ header = part->elts;
+ i = 0;
+ }
+
+#if 0
header = r->headers_out.headers.elts;
for (i = 0; i < r->headers_out.headers.nelts; i++) {
+#endif
+
if (header[i].key.len == 0) {
continue;
}
@@ -321,7 +340,25 @@ static ngx_int_t ngx_http_header_filter(ngx_http_request_t *r)
sizeof("Connection: close" CRLF) - 1);
}
+ part = &r->headers_out.headers.part;
+ header = part->elts;
+
+ for (i = 0; /* void */; i++) {
+
+ if (i >= part->nelts) {
+ if (part->next == NULL) {
+ break;
+ }
+
+ part = part->next;
+ header = part->elts;
+ i = 0;
+ }
+
+#if 0
for (i = 0; i < r->headers_out.headers.nelts; i++) {
+#endif
+
if (header[i].key.len == 0) {
continue;
}
diff --git a/src/http/ngx_http_log_handler.c b/src/http/ngx_http_log_handler.c
index 057da7815..35014cf2a 100644
--- a/src/http/ngx_http_log_handler.c
+++ b/src/http/ngx_http_log_handler.c
@@ -94,7 +94,7 @@ ngx_module_t ngx_http_log_module = {
};
-static ngx_str_t http_access_log = ngx_string("access.log");
+static ngx_str_t http_access_log = ngx_string(NGX_HTTP_LOG_PATH);
static ngx_str_t ngx_http_combined_fmt =
@@ -339,12 +339,26 @@ static u_char *ngx_http_log_unknown_header_in(ngx_http_request_t *r,
{
ngx_uint_t i;
ngx_str_t *s;
+ ngx_list_part_t *part;
ngx_table_elt_t *h;
s = (ngx_str_t *) data;
- h = r->headers_in.headers.elts;
- for (i = 0; i < r->headers_in.headers.nelts; i++) {
+ part = &r->headers_in.headers.part;
+ h = part->elts;
+
+ for (i = 0; /* void */; i++) {
+
+ if (i >= part->nelts) {
+ if (part->next == NULL) {
+ break;
+ }
+
+ part = part->next;
+ h = part->elts;
+ i = 0;
+ }
+
if (h[i].key.len != s->len) {
continue;
}
@@ -547,12 +561,26 @@ static u_char *ngx_http_log_unknown_header_out(ngx_http_request_t *r,
{
ngx_uint_t i;
ngx_str_t *s;
+ ngx_list_part_t *part;
ngx_table_elt_t *h;
s = (ngx_str_t *) data;
- h = r->headers_out.headers.elts;
- for (i = 0; i < r->headers_out.headers.nelts; i++) {
+ part = &r->headers_out.headers.part;
+ h = part->elts;
+
+ for (i = 0; /* void */; i++) {
+
+ if (i >= part->nelts) {
+ if (part->next == NULL) {
+ break;
+ }
+
+ part = part->next;
+ h = part->elts;
+ i = 0;
+ }
+
if (h[i].key.len != s->len) {
continue;
}
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index b05ea92ce..185db72a7 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -40,6 +40,7 @@ static char *client_header_errors[] = {
"client %s sent invalid header, URL: %s",
"client %s sent too long header line, URL: %s",
+ "client %s sent too many headers, URL: %s",
"client %s sent HTTP/1.1 request without \"Host\" header, URL: %s",
"client %s sent invalid \"Content-Length\" header, URL: %s",
"client %s sent POST method without \"Content-Length\" header, URL: %s",
@@ -309,6 +310,16 @@ static void ngx_http_init_request(ngx_event_t *rev)
r->cleanup.pool = r->pool;
+ if (ngx_init_list(&r->headers_out.headers, r->pool, 2,
+ sizeof(ngx_table_elt_t)) == NGX_ERROR)
+ {
+ ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+ ngx_http_close_connection(c);
+ return;
+ }
+
+
+#if 0
/* init the r->headers_out.headers table */
r->headers_out.headers.elts = ngx_pcalloc(r->pool,
@@ -322,6 +333,7 @@ static void ngx_http_init_request(ngx_event_t *rev)
r->headers_out.headers.nalloc = 20;
r->headers_out.headers.size = sizeof(ngx_table_elt_t);
r->headers_out.headers.pool = r->pool;
+#endif
r->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module);
@@ -607,37 +619,23 @@ static void ngx_http_process_request_line(ngx_event_t *rev)
}
- /* init the r->headers_in.headers table */
-
- r->headers_in.headers.elts = ngx_pcalloc(r->pool,
- 20 * sizeof(ngx_table_elt_t));
- if (r->headers_in.headers.elts == NULL) {
+ if (ngx_init_list(&r->headers_in.headers, r->pool, 2,
+ sizeof(ngx_table_elt_t)) == NGX_ERROR)
+ {
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
ngx_http_close_connection(c);
return;
}
- /* r->headers_in.headers.nelts = 0; */
- r->headers_in.headers.size = sizeof(ngx_table_elt_t);
- r->headers_in.headers.nalloc = 20;
- r->headers_in.headers.pool = r->pool;
-
- /* init the r->headers_in.cookies array */
-
- r->headers_in.cookies.elts = ngx_pcalloc(r->pool,
- 5 * sizeof(ngx_uint_t));
- if (r->headers_in.cookies.elts == NULL) {
+ if (ngx_init_array0(&r->headers_in.cookies, r->pool, 5,
+ sizeof(ngx_table_elt_t *)) == NGX_ERROR)
+ {
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
ngx_http_close_connection(c);
return;
}
- /* r->headers_in.cookies.nelts = 0; */
- r->headers_in.cookies.size = sizeof(ngx_uint_t);
- r->headers_in.cookies.nalloc = 5;
- r->headers_in.cookies.pool = r->pool;
-
ctx = c->log->data;
ctx->action = "reading client request headers";
@@ -731,8 +729,7 @@ static void ngx_http_process_request_headers(ngx_event_t *rev)
{
ssize_t n;
ngx_int_t rc, i, offset;
- ngx_uint_t *cookie;
- ngx_table_elt_t *h;
+ ngx_table_elt_t *h, **cookie;
ngx_connection_t *c;
ngx_http_request_t *r;
ngx_http_core_srv_conf_t *cscf;
@@ -761,14 +758,21 @@ static void ngx_http_process_request_headers(ngx_event_t *rev)
}
}
+ if (r->headers_n > 100) {
+ ngx_http_client_error(r, NGX_HTTP_PARSE_TOO_MANY_HEADERS,
+ NGX_HTTP_BAD_REQUEST);
+ return;
+ }
+
rc = ngx_http_parse_header_line(r, r->header_in);
if (rc == NGX_OK) {
/* a header line has been parsed successfully */
- h = ngx_http_add_header(&r->headers_in, ngx_http_headers_in);
- if (h == NULL) {
+ r->headers_n++;
+
+ if (!(h = ngx_push_list(&r->headers_in.headers))) {
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
ngx_http_close_connection(c);
return;
@@ -809,7 +813,7 @@ static void ngx_http_process_request_headers(ngx_event_t *rev)
return;
}
- *cookie = r->headers_in.headers.nelts - 1;
+ *cookie = h;
} else {
@@ -1369,7 +1373,7 @@ ngx_int_t ngx_http_discard_body(ngx_http_request_t *r)
static void ngx_http_read_discarded_body_event(ngx_event_t *rev)
{
- int rc;
+ ngx_int_t rc;
ngx_connection_t *c;
ngx_http_request_t *r;
@@ -1446,7 +1450,7 @@ static ngx_int_t ngx_http_read_discarded_body(ngx_http_request_t *r)
static void ngx_http_set_keepalive(ngx_http_request_t *r)
{
- int len;
+ size_t len;
ngx_buf_t *b;
ngx_event_t *rev, *wev;
ngx_connection_t *c;
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h
index 470dcc16d..145d17155 100644
--- a/src/http/ngx_http_request.h
+++ b/src/http/ngx_http_request.h
@@ -28,11 +28,12 @@
#define NGX_HTTP_PARSE_HEADER_ERROR 14
#define NGX_HTTP_PARSE_INVALID_HEADER 14
#define NGX_HTTP_PARSE_TOO_LONG_HEADER 15
-#define NGX_HTTP_PARSE_NO_HOST_HEADER 16
-#define NGX_HTTP_PARSE_INVALID_CL_HEADER 17
-#define NGX_HTTP_PARSE_POST_WO_CL_HEADER 18
-#define NGX_HTTP_PARSE_HTTP_TO_HTTPS 19
-#define NGX_HTTP_PARSE_INVALID_HOST 20
+#define NGX_HTTP_PARSE_TOO_MANY_HEADERS 16
+#define NGX_HTTP_PARSE_NO_HOST_HEADER 17
+#define NGX_HTTP_PARSE_INVALID_CL_HEADER 18
+#define NGX_HTTP_PARSE_POST_WO_CL_HEADER 19
+#define NGX_HTTP_PARSE_HTTP_TO_HTTPS 20
+#define NGX_HTTP_PARSE_INVALID_HOST 21
#define NGX_HTTP_OK 200
@@ -114,7 +115,7 @@ typedef struct {
typedef struct {
- ngx_table_t headers; /* it must be first field */
+ ngx_list_t headers;
ngx_table_elt_t *host;
ngx_table_elt_t *connection;
@@ -158,7 +159,10 @@ typedef struct {
typedef struct {
+ ngx_list_t headers;
+#if 0
ngx_table_t headers; /* it must be first field */
+#endif
ngx_uint_t status;
ngx_str_t status_line;
@@ -307,6 +311,8 @@ struct ngx_http_request_s {
unsigned filter_need_temporary:1;
unsigned filter_allow_ranges:1;
+ ngx_uint_t headers_n;
+
/* used to parse HTTP headers */
ngx_int_t state;
u_char *uri_start;
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c
index 81476696b..d589dcb97 100644
--- a/src/http/ngx_http_special_response.c
+++ b/src/http/ngx_http_special_response.c
@@ -283,7 +283,7 @@ ngx_int_t ngx_http_special_response_handler(ngx_http_request_t *r, int error)
}
if (!(r->headers_out.content_type =
- ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
+ ngx_push_list(&r->headers_out.headers)))
{
return NGX_ERROR;
}