comparison src/http/modules/proxy/ngx_http_proxy_handler.c @ 150:ad5f382c9e7d

nginx-0.0.1-2003-10-19-23:57:23 import
author Igor Sysoev <igor@sysoev.ru>
date Sun, 19 Oct 2003 19:57:23 +0000
parents 5afee0074707
children 2d9e4a8b6d11
comparison
equal deleted inserted replaced
149:86404ba5c517 150:ad5f382c9e7d
773 ngx_http_proxy_close_connection(c); 773 ngx_http_proxy_close_connection(c);
774 p->upstream.connection = NULL; 774 p->upstream.connection = NULL;
775 return; 775 return;
776 } 776 }
777 777
778 if (ngx_event_proxy_read_upstream(p->event_proxy) == NGX_ABORT) { 778 if (ngx_event_proxy(p->event_proxy, 0) == NGX_ABORT) {
779 ngx_http_proxy_finalize_request(p, 0); 779 ngx_http_proxy_finalize_request(p, 0);
780 return; 780 return;
781 } 781 }
782 782
783 if (p->event_proxy->upstream_eof 783 if (p->event_proxy->upstream_eof
784 || p->event_proxy->upstream_error 784 || p->event_proxy->upstream_error
785 || p->event_proxy->upstream_done) 785 || p->event_proxy->upstream_done)
786 { 786 {
787 ngx_http_proxy_finalize_request(p, ngx_http_send_last(p->request)); 787 ngx_http_proxy_close_connection(c);
788 p->upstream.connection = NULL;
788 return; 789 return;
789 } 790 }
790 791
791 return; 792 return;
792 } 793 }
793 794
794 795
795 static void ngx_http_proxy_process_downstream(ngx_event_t *wev) 796 static void ngx_http_proxy_process_downstream(ngx_event_t *wev)
796 { 797 {
797 ngx_connection_t *c; 798 ngx_connection_t *c;
799 ngx_http_request_t *r;
798 ngx_http_proxy_ctx_t *p; 800 ngx_http_proxy_ctx_t *p;
799 801
800 c = wev->data; 802 c = wev->data;
801 p = c->data; 803 r = c->data;
802 804 p = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
805
803 ngx_log_debug(wev->log, "http proxy process downstream"); 806 ngx_log_debug(wev->log, "http proxy process downstream");
804 807
805 if (wev->timedout) { 808 if (wev->timedout) {
806 ngx_http_close_connection(c); 809 ngx_http_close_connection(c);
807 return; 810 return;
808 } 811 }
809 812
810 if (ngx_event_proxy_write_to_downstream(p->event_proxy) == NGX_ABORT) { 813 if (ngx_event_proxy(p->event_proxy, 1) == NGX_ABORT) {
811 ngx_http_proxy_finalize_request(p, 0); 814 ngx_http_proxy_finalize_request(p, 0);
812 return; 815 return;
813 } 816 }
814 817
815 if (p->event_proxy->downstream_done) { 818 if (p->event_proxy->downstream_done) {
816 ngx_http_proxy_finalize_request(p, 0); 819 ngx_log_debug(wev->log, "http proxy downstream done");
820 ngx_http_proxy_finalize_request(p, r->main ? 0:
821 ngx_http_send_last(p->request));
817 return; 822 return;
818 } 823 }
819 824
820 if (p->event_proxy->downstream_error) { 825 if (p->event_proxy->downstream_error) {
821 ngx_http_close_connection(c); 826 ngx_http_close_connection(c);