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-06 22:45:00 +0400
committerIgor Sysoev <igor@sysoev.ru>2004-09-06 22:45:00 +0400
commitaab4d8c0c4aa068cc7ddcb1c5daee330d9dec47a (patch)
tree30f6fb63eb08c72af5855f0a784df32a64057706 /src/http
parent980a92472cc30271ad7e88eb2dcc43f00e984d4d (diff)
nginx-0.0.10-2004-09-06-22:45:00 import
Diffstat (limited to 'src/http')
-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
-rw-r--r--src/http/ngx_http.c34
-rw-r--r--src/http/ngx_http.h2
-rw-r--r--src/http/ngx_http_core_module.c8
-rw-r--r--src/http/ngx_http_header_filter.c22
-rw-r--r--src/http/ngx_http_headers.c116
-rw-r--r--src/http/ngx_http_request.c60
-rw-r--r--src/http/ngx_http_request.h3
-rw-r--r--src/http/ngx_http_special_response.c5
17 files changed, 132 insertions, 191 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;
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 492ba6f8a..fabb2dd05 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -500,13 +500,16 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
in_addr = in_port[p].addrs.elts;
while (a < in_port[p].addrs.nelts) {
- ngx_test_null(ls, ngx_push_array(&cf->cycle->listening),
- NGX_CONF_ERROR);
+ if (!(ls = ngx_push_array(&cf->cycle->listening))) {
+ return NGX_CONF_ERROR;
+ }
+
ngx_memzero(ls, sizeof(ngx_listening_t));
- ngx_test_null(addr_in,
- ngx_pcalloc(cf->pool, sizeof(struct sockaddr_in)),
- NGX_CONF_ERROR);
+ addr_in = ngx_pcalloc(cf->pool, sizeof(struct sockaddr_in));
+ if (addr_in == NULL) {
+ return NGX_CONF_ERROR;
+ }
#if (HAVE_SIN_LEN)
addr_in->sin_len = sizeof(struct sockaddr_in);
@@ -515,17 +518,18 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
addr_in->sin_addr.s_addr = in_addr[a].addr;
addr_in->sin_port = htons((u_short) in_port[p].port);
- ngx_test_null(ls->addr_text.data,
- ngx_palloc(cf->pool, INET_ADDRSTRLEN + 6),
- NGX_CONF_ERROR);
+ ls->addr_text.data = ngx_palloc(cf->pool, INET_ADDRSTRLEN + 6);
+ if (ls->addr_text.data == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ ls->addr_text.len = ngx_inet_ntop(AF_INET, &in_addr[a].addr,
+ ls->addr_text.data,
+ INET_ADDRSTRLEN),
- ls->addr_text.len =
- ngx_snprintf((char *) ls->addr_text.data
- + ngx_inet_ntop(AF_INET,
- &in_addr[a].addr,
- ls->addr_text.data,
- INET_ADDRSTRLEN),
- 6, ":%d", in_port[p].port);
+ ls->addr_text.len += ngx_snprintf((char *) ls->addr_text.data
+ + ls->addr_text.len,
+ 6, ":%d", in_port[p].port);
ls->fd = (ngx_socket_t) -1;
ls->family = AF_INET;
diff --git a/src/http/ngx_http.h b/src/http/ngx_http.h
index 145082fa0..b1f8a7d1b 100644
--- a/src/http/ngx_http.h
+++ b/src/http/ngx_http.h
@@ -81,8 +81,6 @@ ngx_int_t ngx_http_special_response_handler(ngx_http_request_t *r, int error);
time_t ngx_http_parse_time(u_char *value, size_t len);
size_t ngx_http_get_time(char *buf, time_t t);
-ngx_table_elt_t *ngx_http_add_header(void *header,
- ngx_http_header_t *http_headers);
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 62daa8dc1..78bb2a737 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -531,8 +531,8 @@ 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_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;
}
@@ -673,8 +673,8 @@ 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_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/ngx_http_header_filter.c b/src/http/ngx_http_header_filter.c
index bc78ce974..a08c73e15 100644
--- a/src/http/ngx_http_header_filter.c
+++ b/src/http/ngx_http_header_filter.c
@@ -89,6 +89,28 @@ static ngx_str_t http_codes[] = {
};
+ngx_http_header_t ngx_http_headers_out[] = {
+ { ngx_string("Server"), offsetof(ngx_http_headers_out_t, server) },
+ { ngx_string("Date"), offsetof(ngx_http_headers_out_t, date) },
+ { ngx_string("Content-Type"),
+ offsetof(ngx_http_headers_out_t, content_type) },
+ { ngx_string("Content-Length"),
+ offsetof(ngx_http_headers_out_t, content_length) },
+ { ngx_string("Content-Encoding"),
+ offsetof(ngx_http_headers_out_t, content_encoding) },
+ { ngx_string("Location"), offsetof(ngx_http_headers_out_t, location) },
+ { ngx_string("Last-Modified"),
+ offsetof(ngx_http_headers_out_t, last_modified) },
+ { ngx_string("Accept-Ranges"),
+ offsetof(ngx_http_headers_out_t, accept_ranges) },
+ { ngx_string("Expires"), offsetof(ngx_http_headers_out_t, expires) },
+ { ngx_string("Cache-Control"),
+ offsetof(ngx_http_headers_out_t, cache_control) },
+ { ngx_string("ETag"), offsetof(ngx_http_headers_out_t, etag) },
+
+ { ngx_null_string, 0 }
+};
+
static ngx_int_t ngx_http_header_filter(ngx_http_request_t *r)
{
diff --git a/src/http/ngx_http_headers.c b/src/http/ngx_http_headers.c
deleted file mode 100644
index fd617b161..000000000
--- a/src/http/ngx_http_headers.c
+++ /dev/null
@@ -1,116 +0,0 @@
-
-#include <ngx_config.h>
-#include <ngx_core.h>
-#include <ngx_http.h>
-
-
-ngx_http_header_t ngx_http_headers_in[] = {
- { ngx_string("Host"), offsetof(ngx_http_headers_in_t, host) },
- { ngx_string("Connection"), offsetof(ngx_http_headers_in_t, connection) },
- { ngx_string("If-Modified-Since"),
- offsetof(ngx_http_headers_in_t, if_modified_since) },
- { ngx_string("User-Agent"), offsetof(ngx_http_headers_in_t, user_agent) },
- { ngx_string("Referer"), offsetof(ngx_http_headers_in_t, referer) },
- { ngx_string("Content-Length"),
- offsetof(ngx_http_headers_in_t, content_length) },
-
- { ngx_string("Range"), offsetof(ngx_http_headers_in_t, range) },
-#if 0
- { ngx_string("If-Range"), offsetof(ngx_http_headers_in_t, if_range) },
-#endif
-
-#if (NGX_HTTP_GZIP)
- { ngx_string("Accept-Encoding"),
- offsetof(ngx_http_headers_in_t, accept_encoding) },
- { ngx_string("Via"), offsetof(ngx_http_headers_in_t, via) },
-#endif
-
- { ngx_string("Authorization"),
- offsetof(ngx_http_headers_in_t, authorization) },
-
- { ngx_string("Keep-Alive"), offsetof(ngx_http_headers_in_t, keep_alive) },
-
-#if (NGX_HTTP_PROXY)
- { ngx_string("X-Forwarded-For"),
- offsetof(ngx_http_headers_in_t, x_forwarded_for) },
-#endif
-
- { ngx_null_string, 0 }
-};
-
-
-ngx_http_header_t ngx_http_headers_out[] = {
- { ngx_string("Server"), offsetof(ngx_http_headers_out_t, server) },
- { ngx_string("Date"), offsetof(ngx_http_headers_out_t, date) },
- { ngx_string("Content-Type"),
- offsetof(ngx_http_headers_out_t, content_type) },
- { ngx_string("Content-Length"),
- offsetof(ngx_http_headers_out_t, content_length) },
- { ngx_string("Content-Encoding"),
- offsetof(ngx_http_headers_out_t, content_encoding) },
- { ngx_string("Location"), offsetof(ngx_http_headers_out_t, location) },
- { ngx_string("Last-Modified"),
- offsetof(ngx_http_headers_out_t, last_modified) },
- { ngx_string("Accept-Ranges"),
- offsetof(ngx_http_headers_out_t, accept_ranges) },
- { ngx_string("Expires"), offsetof(ngx_http_headers_out_t, expires) },
- { ngx_string("Cache-Control"),
- offsetof(ngx_http_headers_out_t, cache_control) },
- { ngx_string("ETag"), offsetof(ngx_http_headers_out_t, etag) },
-
- { ngx_null_string, 0 }
-};
-
-
-ngx_table_elt_t *ngx_http_add_header(void *header,
- ngx_http_header_t *http_headers)
-{
- void *prev;
- ngx_uint_t i, j;
- ngx_table_t *headers;
- ngx_table_elt_t *h, *new;
-
- headers = header;
-
- prev = headers->elts;
-
- if (!(new = ngx_push_table(headers))) {
- return NULL;
- }
-
- if (prev == headers->elts) {
- return new;
- }
-
- /*
- * When table is relocated we need to update pointers in r->headers_in,
- * r->headers_out, etc. However this relocation should be very rare
- * because we preallocate enough space for the number of the real world
- * HTTP headers.
- */
-
- ngx_log_error(NGX_LOG_ALERT, headers->pool->log, 0,
- "header table is small, %d elements", headers->nelts - 1);
-
- h = headers->elts;
- for (i = 0; i < headers->nelts - 1; i++) {
- if (h[i].key.len == 0) {
- continue;
- }
-
- for (j = 0; http_headers[j].name.len != 0; j++) {
- if (http_headers[j].name.len != h[i].key.len) {
- continue;
- }
-
- if (ngx_strcasecmp(http_headers[j].name.data, h[i].key.data) == 0) {
- *((ngx_table_elt_t **)
- ((char *) header + http_headers[j].offset)) = &h[i];
- break;
- }
- }
- }
-
- return new;
-}
-
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 185db72a7..52c7c4256 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -49,6 +49,41 @@ static char *client_header_errors[] = {
};
+ngx_http_header_t ngx_http_headers_in[] = {
+ { ngx_string("Host"), offsetof(ngx_http_headers_in_t, host) },
+ { ngx_string("Connection"), offsetof(ngx_http_headers_in_t, connection) },
+ { ngx_string("If-Modified-Since"),
+ offsetof(ngx_http_headers_in_t, if_modified_since) },
+ { ngx_string("User-Agent"), offsetof(ngx_http_headers_in_t, user_agent) },
+ { ngx_string("Referer"), offsetof(ngx_http_headers_in_t, referer) },
+ { ngx_string("Content-Length"),
+ offsetof(ngx_http_headers_in_t, content_length) },
+
+ { ngx_string("Range"), offsetof(ngx_http_headers_in_t, range) },
+#if 0
+ { ngx_string("If-Range"), offsetof(ngx_http_headers_in_t, if_range) },
+#endif
+
+#if (NGX_HTTP_GZIP)
+ { ngx_string("Accept-Encoding"),
+ offsetof(ngx_http_headers_in_t, accept_encoding) },
+ { ngx_string("Via"), offsetof(ngx_http_headers_in_t, via) },
+#endif
+
+ { ngx_string("Authorization"),
+ offsetof(ngx_http_headers_in_t, authorization) },
+
+ { ngx_string("Keep-Alive"), offsetof(ngx_http_headers_in_t, keep_alive) },
+
+#if (NGX_HTTP_PROXY)
+ { ngx_string("X-Forwarded-For"),
+ offsetof(ngx_http_headers_in_t, x_forwarded_for) },
+#endif
+
+ { ngx_null_string, 0 }
+};
+
+
#if 0
static void ngx_http_dummy(ngx_event_t *wev)
{
@@ -310,7 +345,7 @@ 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,
+ if (ngx_list_init(&r->headers_out.headers, r->pool, 20,
sizeof(ngx_table_elt_t)) == NGX_ERROR)
{
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
@@ -319,23 +354,6 @@ static void ngx_http_init_request(ngx_event_t *rev)
}
-#if 0
- /* init the r->headers_out.headers table */
-
- r->headers_out.headers.elts = ngx_pcalloc(r->pool,
- 20 * sizeof(ngx_table_elt_t));
- if (r->headers_out.headers.elts == NULL) {
- ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
- ngx_http_close_connection(c);
- return;
- }
- /* r->headers_out.headers.nelts = 0; */
- 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);
if (r->ctx == NULL) {
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
@@ -619,7 +637,7 @@ static void ngx_http_process_request_line(ngx_event_t *rev)
}
- if (ngx_init_list(&r->headers_in.headers, r->pool, 2,
+ if (ngx_list_init(&r->headers_in.headers, r->pool, 20,
sizeof(ngx_table_elt_t)) == NGX_ERROR)
{
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
@@ -628,7 +646,7 @@ static void ngx_http_process_request_line(ngx_event_t *rev)
}
- if (ngx_init_array0(&r->headers_in.cookies, r->pool, 5,
+ if (ngx_array_init(&r->headers_in.cookies, r->pool, 5,
sizeof(ngx_table_elt_t *)) == NGX_ERROR)
{
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
@@ -772,7 +790,7 @@ static void ngx_http_process_request_headers(ngx_event_t *rev)
r->headers_n++;
- if (!(h = ngx_push_list(&r->headers_in.headers))) {
+ if (!(h = ngx_list_push(&r->headers_in.headers))) {
ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
ngx_http_close_connection(c);
return;
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h
index 145d17155..abd52bc5e 100644
--- a/src/http/ngx_http_request.h
+++ b/src/http/ngx_http_request.h
@@ -160,9 +160,6 @@ 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;
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c
index d589dcb97..17efa5a90 100644
--- a/src/http/ngx_http_special_response.c
+++ b/src/http/ngx_http_special_response.c
@@ -282,9 +282,8 @@ ngx_int_t ngx_http_special_response_handler(ngx_http_request_t *r, int error)
msie_padding = 1;
}
- 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_ERROR;
}