bugfix: upstream_truncation.patch: 1. 504 error code in ngx_http_upstream_finalize_request resulted in calling special response handler even when the response header has been sent; 2. use 502 status code in ngx_http_upstream_finalize_request when upstream data truncation happens.
This commit is contained in:
parent
5fb8647d23
commit
3be0b7f0e1
|
@ -1,5 +1,5 @@
|
|||
--- nginx-1.2.7/src/http/ngx_http_upstream.c 2013-02-11 06:39:49.000000000 -0800
|
||||
+++ nginx-1.2.7-patched/src/http/ngx_http_upstream.c 2013-04-05 12:24:34.108742922 -0700
|
||||
+++ nginx-1.2.7-patched/src/http/ngx_http_upstream.c 2013-04-06 17:16:54.444520038 -0700
|
||||
@@ -2399,7 +2399,7 @@ ngx_http_upstream_process_non_buffered_u
|
||||
|
||||
if (c->read->timedout) {
|
||||
|
@ -25,7 +25,7 @@
|
|||
}
|
||||
|
||||
+ if (upstream->read->eof || upstream->read->error) {
|
||||
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
|
||||
+ ngx_http_upstream_finalize_request(r, u, NGX_HTTP_BAD_GATEWAY);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
|
@ -52,19 +52,21 @@
|
|||
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
+ "http upstream exit: %p", p->out);
|
||||
+
|
||||
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
|
||||
+ ngx_http_upstream_finalize_request(r, u, NGX_HTTP_BAD_GATEWAY);
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (p->downstream_error) {
|
||||
@@ -3087,7 +3104,8 @@ ngx_http_upstream_finalize_request(ngx_h
|
||||
@@ -3087,9 +3104,9 @@ ngx_http_upstream_finalize_request(ngx_h
|
||||
|
||||
if (u->header_sent
|
||||
&& rc != NGX_HTTP_REQUEST_TIME_OUT
|
||||
- && (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE))
|
||||
+ && rc != NGX_HTTP_GATEWAY_TIME_OUT
|
||||
+ && rc >= NGX_HTTP_SPECIAL_RESPONSE)
|
||||
{
|
||||
rc = 0;
|
||||
- rc = 0;
|
||||
+ rc = NGX_ERROR;
|
||||
}
|
||||
|
||||
if (rc == NGX_DECLINED) {
|
||||
|
|
Loading…
Reference in New Issue