mirror of https://github.com/openresty/openresty
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.5 KiB
Diff
71 lines
2.5 KiB
Diff
12 years ago
|
--- nginx-1.2.7/src/http/ngx_http_upstream.c 2013-02-11 06:39:49.000000000 -0800
|
||
12 years ago
|
+++ nginx-1.2.7-patched/src/http/ngx_http_upstream.c 2013-04-05 12:24:34.108742922 -0700
|
||
12 years ago
|
@@ -2399,7 +2399,7 @@ ngx_http_upstream_process_non_buffered_u
|
||
|
|
||
|
if (c->read->timedout) {
|
||
|
ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out");
|
||
|
- ngx_http_upstream_finalize_request(r, u, 0);
|
||
|
+ ngx_http_upstream_finalize_request(r, u, NGX_HTTP_GATEWAY_TIME_OUT);
|
||
|
return;
|
||
|
}
|
||
|
|
||
12 years ago
|
@@ -2446,13 +2446,20 @@ ngx_http_upstream_process_non_buffered_r
|
||
12 years ago
|
if (u->busy_bufs == NULL) {
|
||
|
|
||
|
if (u->length == 0
|
||
|
- || upstream->read->eof
|
||
|
- || upstream->read->error)
|
||
|
+ || (upstream->read->eof
|
||
|
+ && u->length == -1
|
||
12 years ago
|
+ && u->pipe
|
||
|
+ && u->pipe->length == -1))
|
||
12 years ago
|
{
|
||
|
ngx_http_upstream_finalize_request(r, u, 0);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
+ if (upstream->read->eof || upstream->read->error) {
|
||
|
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
|
||
|
+ return;
|
||
|
+ }
|
||
|
+
|
||
|
b->pos = b->start;
|
||
|
b->last = b->start;
|
||
|
}
|
||
12 years ago
|
@@ -2720,7 +2727,9 @@ ngx_http_upstream_process_request(ngx_ht
|
||
12 years ago
|
|
||
|
#endif
|
||
|
|
||
|
- if (p->upstream_done || p->upstream_eof || p->upstream_error) {
|
||
|
+ if (p->upstream_done
|
||
|
+ || (p->upstream_eof && u->length == -1 && p->length == -1))
|
||
|
+ {
|
||
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||
|
"http upstream exit: %p", p->out);
|
||
|
#if 0
|
||
12 years ago
|
@@ -2729,6 +2738,14 @@ ngx_http_upstream_process_request(ngx_ht
|
||
12 years ago
|
ngx_http_upstream_finalize_request(r, u, 0);
|
||
|
return;
|
||
|
}
|
||
|
+
|
||
|
+ if (p->upstream_eof || p->upstream_error) {
|
||
|
+ 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);
|
||
|
+ return;
|
||
|
+ }
|
||
|
}
|
||
|
|
||
|
if (p->downstream_error) {
|
||
12 years ago
|
@@ -3087,7 +3104,8 @@ ngx_http_upstream_finalize_request(ngx_h
|
||
12 years ago
|
|
||
|
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;
|
||
|
}
|