Mercurial > hg > nginx
comparison src/http/modules/proxy/ngx_http_proxy_upstream.c @ 416:b9bd635011de
nginx-0.0.10-2004-09-06-22:45:00 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 06 Sep 2004 18:45:00 +0000 |
parents | 3c56e834be46 |
children | da8c5707af39 |
comparison
equal
deleted
inserted
replaced
415:3c56e834be46 | 416:b9bd635011de |
---|---|
952 p->upstream->status, p->upstream->status_line.data); | 952 p->upstream->status, p->upstream->status_line.data); |
953 | 953 |
954 | 954 |
955 /* init or reinit the p->upstream->headers_in.headers table */ | 955 /* init or reinit the p->upstream->headers_in.headers table */ |
956 | 956 |
957 if (p->upstream->headers_in.headers.elts) { | 957 if (p->upstream->headers_in.headers.part.elts) { |
958 p->upstream->headers_in.headers.nelts = 0; | 958 p->upstream->headers_in.headers.part.nelts = 0; |
959 p->upstream->headers_in.headers.part.next = NULL; | |
960 p->upstream->headers_in.headers.last = | |
961 &p->upstream->headers_in.headers.part; | |
962 | |
963 ngx_memzero(&p->upstream->headers_in.date, | |
964 sizeof(ngx_http_proxy_headers_in_t) - sizeof(ngx_list_t)); | |
959 | 965 |
960 } else { | 966 } else { |
961 p->upstream->headers_in.headers.elts = ngx_pcalloc(p->request->pool, | 967 if (ngx_list_init(&p->upstream->headers_in.headers, p->request->pool, |
962 20 * sizeof(ngx_table_elt_t)); | 968 20, sizeof(ngx_table_elt_t)) == NGX_ERROR) |
963 if (p->upstream->headers_in.headers.elts == NULL) { | 969 { |
964 ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR); | 970 ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR); |
965 return; | 971 return; |
966 } | 972 } |
967 /* p->upstream->headers_in.headers.nelts = 0; */ | |
968 p->upstream->headers_in.headers.nalloc = 20; | |
969 p->upstream->headers_in.headers.size = sizeof(ngx_table_elt_t); | |
970 p->upstream->headers_in.headers.pool = p->request->pool; | |
971 } | 973 } |
972 | 974 |
973 | 975 |
974 c->read->event_handler = ngx_http_proxy_process_upstream_headers; | 976 c->read->event_handler = ngx_http_proxy_process_upstream_headers; |
975 ngx_http_proxy_process_upstream_headers(rev); | 977 ngx_http_proxy_process_upstream_headers(rev); |
1023 | 1025 |
1024 if (rc == NGX_OK) { | 1026 if (rc == NGX_OK) { |
1025 | 1027 |
1026 /* a header line has been parsed successfully */ | 1028 /* a header line has been parsed successfully */ |
1027 | 1029 |
1028 h = ngx_http_add_header(&p->upstream->headers_in, | 1030 if (!(h = ngx_list_push(&p->upstream->headers_in.headers))) { |
1029 ngx_http_proxy_headers_in); | |
1030 if (h == NULL) { | |
1031 ngx_http_proxy_finalize_request(p, | 1031 ngx_http_proxy_finalize_request(p, |
1032 NGX_HTTP_INTERNAL_SERVER_ERROR); | 1032 NGX_HTTP_INTERNAL_SERVER_ERROR); |
1033 return; | 1033 return; |
1034 } | 1034 } |
1035 | 1035 |