2012-09-06 06:15:17 +02:00
|
|
|
--- nginx-1.2.3/src/http/ngx_http_upstream.c 2012-08-06 10:34:08.000000000 -0700
|
2012-09-10 06:58:41 +02:00
|
|
|
+++ nginx-1.2.3-patched/src/http/ngx_http_upstream.c 2012-09-09 21:58:04.727761891 -0700
|
2012-09-06 06:15:17 +02:00
|
|
|
@@ -2383,7 +2383,7 @@
|
2012-09-06 00:11:52 +02:00
|
|
|
|
|
|
|
if (c->read->timedout) {
|
|
|
|
ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out");
|
2012-09-06 06:15:17 +02:00
|
|
|
- ngx_http_upstream_finalize_request(r, u, 0);
|
|
|
|
+ ngx_http_upstream_finalize_request(r, u, NGX_HTTP_GATEWAY_TIME_OUT);
|
2012-09-06 00:11:52 +02:00
|
|
|
return;
|
2012-09-06 06:15:17 +02:00
|
|
|
}
|
|
|
|
|
2012-09-09 21:53:03 +02:00
|
|
|
@@ -2430,13 +2430,17 @@
|
2012-09-06 00:11:52 +02:00
|
|
|
if (u->busy_bufs == NULL) {
|
|
|
|
|
2012-09-09 21:53:03 +02:00
|
|
|
if (u->length == 0
|
2012-09-06 00:11:52 +02:00
|
|
|
- || upstream->read->eof
|
|
|
|
- || upstream->read->error)
|
2012-09-09 21:53:03 +02:00
|
|
|
+ || (upstream->read->eof && u->headers_in.content_length_n == -1))
|
|
|
|
{
|
2012-09-06 00:11:52 +02:00
|
|
|
ngx_http_upstream_finalize_request(r, u, 0);
|
|
|
|
return;
|
|
|
|
}
|
2012-09-06 06:15:17 +02:00
|
|
|
|
|
|
|
+ if (upstream->read->eof || upstream->read->error) {
|
|
|
|
+ ngx_http_upstream_finalize_request(r, u, NGX_HTTP_BAD_GATEWAY);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
b->pos = b->start;
|
|
|
|
b->last = b->start;
|
|
|
|
}
|
2012-09-10 06:58:41 +02:00
|
|
|
@@ -2710,7 +2714,16 @@
|
2012-09-09 21:53:03 +02:00
|
|
|
#if 0
|
|
|
|
ngx_http_busy_unlock(u->conf->busy_lock, &u->busy_lock);
|
|
|
|
#endif
|
|
|
|
- ngx_http_upstream_finalize_request(r, u, 0);
|
|
|
|
+
|
|
|
|
+ if (p->upstream_done
|
|
|
|
+ || (p->upstream_eof && u->headers_in.content_length_n == -1))
|
|
|
|
+ {
|
|
|
|
+ ngx_http_upstream_finalize_request(r, u, 0);
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ ngx_http_upstream_finalize_request(r, u, NGX_HTTP_BAD_GATEWAY);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2012-09-10 06:58:41 +02:00
|
|
|
@@ -3073,6 +3086,13 @@
|
2012-09-06 06:15:17 +02:00
|
|
|
&& rc != NGX_HTTP_REQUEST_TIME_OUT
|
|
|
|
&& (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE))
|
|
|
|
{
|
|
|
|
+ if (rc == NGX_ERROR) {
|
|
|
|
+ r->headers_out.status = NGX_HTTP_INTERNAL_SERVER_ERROR;
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ r->headers_out.status = rc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
rc = 0;
|
|
|
|
}
|
|
|
|
|