From 85ef94ba857237882c7e68dea87a1dbc68a38fe7 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 23 Jun 2005 13:41:06 +0000 Subject: nginx-0.1.37-RELEASE import *) Change: now the "\n" is added to the end of the "nginx.pid" file. *) Bugfix: the responses may be transferred not completely, if many parts or the big parts were included by SSI. *) Bugfix: if all backends had returned the 404 reponse and the "http_404" parameter of the "proxy_next_upstream" or "fastcgi_next_upstream" directives was used, then nginx started to request all backends again. --- src/http/ngx_http_request.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/http/ngx_http_request.c') diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index c3e1ab79e..9ced028a5 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -31,7 +31,7 @@ static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r); static ngx_int_t ngx_http_find_virtual_server(ngx_http_request_t *r); static void ngx_http_request_handler(ngx_event_t *ev); -static void ngx_http_set_write_handler(ngx_http_request_t *r); +static ngx_int_t ngx_http_set_write_handler(ngx_http_request_t *r); static void ngx_http_writer(ngx_http_request_t *r); static ngx_int_t ngx_http_postponed_handler(ngx_http_request_t *r); @@ -1433,7 +1433,9 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) } if (r->parent || rc == NGX_AGAIN) { - r->write_event_handler = ngx_http_writer; + if (ngx_http_set_write_handler(r) != NGX_OK) { + return; + } } r->done = 1; @@ -1497,7 +1499,7 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) return; } else if (rc == NGX_AGAIN || r->out) { - ngx_http_set_write_handler(r); + (void) ngx_http_set_write_handler(r); return; } @@ -1541,7 +1543,7 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) } -static void +static ngx_int_t ngx_http_set_write_handler(ngx_http_request_t *r) { ngx_event_t *wev; @@ -1549,10 +1551,12 @@ ngx_http_set_write_handler(ngx_http_request_t *r) r->http_state = NGX_HTTP_WRITING_REQUEST_STATE; + r->write_event_handler = ngx_http_writer; + wev = r->connection->write; if (wev->ready && wev->delayed) { - return; + return NGX_OK; } clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); @@ -1563,7 +1567,10 @@ ngx_http_set_write_handler(ngx_http_request_t *r) if (ngx_handle_write_event(wev, clcf->send_lowat) == NGX_ERROR) { ngx_http_close_request(r, 0); ngx_http_close_connection(r->connection); + return NGX_ERROR; } + + return NGX_OK; } -- cgit v1.2.3