diff src/http/modules/proxy/ngx_http_proxy_handler.c @ 165:894a01c6aea3

nginx-0.0.1-2003-10-29-20:39:05 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 29 Oct 2003 17:39:05 +0000
parents 84036764e215
children 389d7ee9fa60
line wrap: on
line diff
--- a/src/http/modules/proxy/ngx_http_proxy_handler.c
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.c
@@ -658,7 +658,7 @@ static void ngx_http_proxy_process_upstr
     if (p->headers_in.headers) {
         p->headers_in.headers->nelts = 0;
     } else {
-        p->headers_in.headers = ngx_create_table(p->request->pool, 10);
+        p->headers_in.headers = ngx_create_table(p->request->pool, 20);
     }
 
     c->read->event_handler = ngx_http_proxy_process_upstream_headers;
@@ -713,8 +713,7 @@ static void ngx_http_proxy_process_upstr
 
             /* a header line has been parsed successfully */
 
-            h = ngx_push_table(p->headers_in.headers);
-            if (h == NULL) {
+            if (!(h = ngx_http_add_header(&p->headers_in, headers_in))) {
                 ngx_http_proxy_finalize_request(p,
                                                 NGX_HTTP_INTERNAL_SERVER_ERROR);
                 return;
@@ -831,7 +830,7 @@ static ssize_t ngx_http_proxy_read_upstr
 static void ngx_http_proxy_send_response(ngx_http_proxy_ctx_t *p)
 {
     int                        rc, i;
-    ngx_table_elt_t           *ch, *h;
+    ngx_table_elt_t           *ho, *h;
     ngx_event_pipe_t          *ep;
     ngx_http_request_t        *r;
     ngx_http_core_loc_conf_t  *clcf;
@@ -869,13 +868,13 @@ static void ngx_http_proxy_send_response
             continue;
         }
 
-        ch = ngx_push_table(r->headers_out.headers);
-        if (ch == NULL) {
+        if (!(ho = ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
+        {
             ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
             return;
         }
 
-        *ch = h[i];
+        *ho = h[i];
 
         /*
          * ngx_http_header_filter() output the following headers
@@ -886,21 +885,19 @@ static void ngx_http_proxy_send_response
          */
 
         if (&h[i] == p->headers_in.server) {
-            r->headers_out.server = ch;
+            r->headers_out.server = ho;
             continue;
         }
 
         if (&h[i] == p->headers_in.date) {
-            r->headers_out.date = ch;
+            r->headers_out.date = ho;
             continue;
         }
 
         if (&h[i] == p->headers_in.content_length) {
-
-            r->headers_out.content_length_n =
-                             ngx_atoi(p->headers_in.content_length->value.data,
-                                      p->headers_in.content_length->value.len);
-            r->headers_out.content_length = ch;
+            r->headers_out.content_length = ho;
+            r->headers_out.content_length_n = ngx_atoi(ho->value.data,
+                                                       ho->value.len);
             continue;
         }
     }