added the nonbuffered-upstream-truncation patch for nginx 1.2.3 to make ngx_http_upstream provide a way in the context of a subrequest to signal the parent of errors when upstream data truncation happens. thanks Bryan Alger for reporting this issue.

This commit is contained in:
agentzh (Yichun Zhang) 2012-09-05 15:11:52 -07:00
parent 2629184a0e
commit ac3efbbea8
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,28 @@
--- nginx-1.2.3/src/http/ngx_http_upstream.c 2012-09-05 14:39:33.234197951 -0700
+++ nginx-1.2.3-patched/src/http/ngx_http_upstream.c 2012-09-05 14:39:24.504183525 -0700
@@ -2384,6 +2384,7 @@
c->log->action = "reading upstream";
if (c->read->timedout) {
+ r->headers_out.status = NGX_HTTP_GATEWAY_TIME_OUT;
ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out");
ngx_http_upstream_finalize_request(r, u, 0);
return;
@@ -2431,10 +2432,13 @@
if (u->busy_bufs == NULL) {
- if (u->length == 0
- || upstream->read->eof
- || upstream->read->error)
- {
+ if (u->length == 0) {
+ ngx_http_upstream_finalize_request(r, u, 0);
+ return;
+ }
+
+ if (upstream->read->eof || upstream->read->error) {
+ r->headers_out.status = NGX_HTTP_BAD_GATEWAY;
ngx_http_upstream_finalize_request(r, u, 0);
return;
}

View File

@ -93,6 +93,9 @@ fi
echo applying location_if_inherits_proxy.patch ...
patch -p1 < $root/patches/nginx-$main_ver-location_if_inherits_proxy.patch
echo applying nonbuffered-upstream-truncation.patch ...
patch -p1 < $root/patches/nginx-$main_ver-nonbuffered-upstream-truncation.patch
echo applying dtrace.patch ...
patch -p1 < $root/patches/nginx-$main_ver-dtrace.patch