diff 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
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
@@ -775,7 +775,7 @@ static void ngx_http_proxy_process_upstr
         return;
     }
 
-    if (ngx_event_proxy_read_upstream(p->event_proxy) == NGX_ABORT) {
+    if (ngx_event_proxy(p->event_proxy, 0) == NGX_ABORT) {
         ngx_http_proxy_finalize_request(p, 0);
         return;
     }
@@ -784,7 +784,8 @@ static void ngx_http_proxy_process_upstr
         || p->event_proxy->upstream_error
         || p->event_proxy->upstream_done)
     {
-        ngx_http_proxy_finalize_request(p, ngx_http_send_last(p->request));
+        ngx_http_proxy_close_connection(c);
+        p->upstream.connection = NULL;
         return;
     }
 
@@ -795,11 +796,13 @@ static void ngx_http_proxy_process_upstr
 static void ngx_http_proxy_process_downstream(ngx_event_t *wev)
 {
     ngx_connection_t      *c;
+    ngx_http_request_t    *r;
     ngx_http_proxy_ctx_t  *p;
 
     c = wev->data;
-    p = c->data;
-
+    r = c->data;
+    p = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
+ 
     ngx_log_debug(wev->log, "http proxy process downstream");
 
     if (wev->timedout) {
@@ -807,13 +810,15 @@ static void ngx_http_proxy_process_downs
         return;
     }
 
-    if (ngx_event_proxy_write_to_downstream(p->event_proxy) == NGX_ABORT) {
+    if (ngx_event_proxy(p->event_proxy, 1) == NGX_ABORT) {
         ngx_http_proxy_finalize_request(p, 0);
         return;
     }
 
     if (p->event_proxy->downstream_done) {
-        ngx_http_proxy_finalize_request(p, 0);
+ngx_log_debug(wev->log, "http proxy downstream done");
+        ngx_http_proxy_finalize_request(p, r->main ? 0:
+                                           ngx_http_send_last(p->request));
         return;
     }