Mercurial > hg > nginx-quic
comparison 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 |
comparison
equal
deleted
inserted
replaced
164:84036764e215 | 165:894a01c6aea3 |
---|---|
656 p->status _ p->status_line.data); | 656 p->status _ p->status_line.data); |
657 | 657 |
658 if (p->headers_in.headers) { | 658 if (p->headers_in.headers) { |
659 p->headers_in.headers->nelts = 0; | 659 p->headers_in.headers->nelts = 0; |
660 } else { | 660 } else { |
661 p->headers_in.headers = ngx_create_table(p->request->pool, 10); | 661 p->headers_in.headers = ngx_create_table(p->request->pool, 20); |
662 } | 662 } |
663 | 663 |
664 c->read->event_handler = ngx_http_proxy_process_upstream_headers; | 664 c->read->event_handler = ngx_http_proxy_process_upstream_headers; |
665 ngx_http_proxy_process_upstream_headers(rev); | 665 ngx_http_proxy_process_upstream_headers(rev); |
666 | 666 |
711 | 711 |
712 if (rc == NGX_OK) { | 712 if (rc == NGX_OK) { |
713 | 713 |
714 /* a header line has been parsed successfully */ | 714 /* a header line has been parsed successfully */ |
715 | 715 |
716 h = ngx_push_table(p->headers_in.headers); | 716 if (!(h = ngx_http_add_header(&p->headers_in, headers_in))) { |
717 if (h == NULL) { | |
718 ngx_http_proxy_finalize_request(p, | 717 ngx_http_proxy_finalize_request(p, |
719 NGX_HTTP_INTERNAL_SERVER_ERROR); | 718 NGX_HTTP_INTERNAL_SERVER_ERROR); |
720 return; | 719 return; |
721 } | 720 } |
722 | 721 |
829 | 828 |
830 | 829 |
831 static void ngx_http_proxy_send_response(ngx_http_proxy_ctx_t *p) | 830 static void ngx_http_proxy_send_response(ngx_http_proxy_ctx_t *p) |
832 { | 831 { |
833 int rc, i; | 832 int rc, i; |
834 ngx_table_elt_t *ch, *h; | 833 ngx_table_elt_t *ho, *h; |
835 ngx_event_pipe_t *ep; | 834 ngx_event_pipe_t *ep; |
836 ngx_http_request_t *r; | 835 ngx_http_request_t *r; |
837 ngx_http_core_loc_conf_t *clcf; | 836 ngx_http_core_loc_conf_t *clcf; |
838 | 837 |
839 r = p->request; | 838 r = p->request; |
867 r->headers_out.content_type = &h[i]; | 866 r->headers_out.content_type = &h[i]; |
868 r->headers_out.content_type->key.len = 0; | 867 r->headers_out.content_type->key.len = 0; |
869 continue; | 868 continue; |
870 } | 869 } |
871 | 870 |
872 ch = ngx_push_table(r->headers_out.headers); | 871 if (!(ho = ngx_http_add_header(&r->headers_out, ngx_http_headers_out))) |
873 if (ch == NULL) { | 872 { |
874 ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR); | 873 ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR); |
875 return; | 874 return; |
876 } | 875 } |
877 | 876 |
878 *ch = h[i]; | 877 *ho = h[i]; |
879 | 878 |
880 /* | 879 /* |
881 * ngx_http_header_filter() output the following headers | 880 * ngx_http_header_filter() output the following headers |
882 * from r->headers_out.headers if they are set: | 881 * from r->headers_out.headers if they are set: |
883 * r->headers_out.server, | 882 * r->headers_out.server, |
884 * r->headers_out.date, | 883 * r->headers_out.date, |
885 * r->headers_out.content_length | 884 * r->headers_out.content_length |
886 */ | 885 */ |
887 | 886 |
888 if (&h[i] == p->headers_in.server) { | 887 if (&h[i] == p->headers_in.server) { |
889 r->headers_out.server = ch; | 888 r->headers_out.server = ho; |
890 continue; | 889 continue; |
891 } | 890 } |
892 | 891 |
893 if (&h[i] == p->headers_in.date) { | 892 if (&h[i] == p->headers_in.date) { |
894 r->headers_out.date = ch; | 893 r->headers_out.date = ho; |
895 continue; | 894 continue; |
896 } | 895 } |
897 | 896 |
898 if (&h[i] == p->headers_in.content_length) { | 897 if (&h[i] == p->headers_in.content_length) { |
899 | 898 r->headers_out.content_length = ho; |
900 r->headers_out.content_length_n = | 899 r->headers_out.content_length_n = ngx_atoi(ho->value.data, |
901 ngx_atoi(p->headers_in.content_length->value.data, | 900 ho->value.len); |
902 p->headers_in.content_length->value.len); | |
903 r->headers_out.content_length = ch; | |
904 continue; | 901 continue; |
905 } | 902 } |
906 } | 903 } |
907 | 904 |
908 | 905 |