diff options
Diffstat (limited to 'src/http/ngx_http_special_response.c')
-rw-r--r-- | src/http/ngx_http_special_response.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c index 6213c4f08..8c86b2437 100644 --- a/src/http/ngx_http_special_response.c +++ b/src/http/ngx_http_special_response.c @@ -120,6 +120,7 @@ int ngx_http_special_response_handler(ngx_http_request_t *r, int error) r->headers_out.status = error; if (error < NGX_HTTP_BAD_REQUEST) { + /* 3XX */ err = error - NGX_HTTP_MOVED_PERMANENTLY; } else { @@ -133,9 +134,11 @@ int ngx_http_special_response_handler(ngx_http_request_t *r, int error) r->headers_out.content_type->value.data = "text/html"; if (error < NGX_HTTP_INTERNAL_SERVER_ERROR) { + /* 4XX */ err = error - NGX_HTTP_BAD_REQUEST + 3; } else { + /* 5XX */ err = error - NGX_HTTP_INTERNAL_SERVER_ERROR + 3 + 17; } } @@ -149,6 +152,15 @@ int ngx_http_special_response_handler(ngx_http_request_t *r, int error) } } + if (r->lingering_close == 1) { + switch (error) { + case NGX_HTTP_BAD_REQUEST: + case NGX_HTTP_REQUEST_URI_TOO_LARGE: + case NGX_HTTP_INTERNAL_SERVER_ERROR: + r->lingering_close = 0; + } + } + if (error_pages[err].len == 0) { r->headers_out.content_length = -1; } else { |