diff src/http/ngx_http_upstream.c @ 4045:2d062c031fff stable-1.0

Merge of r3964, r3977, r3978: Proxy related fixes: *) finalizing with rc == 0 in unbuffered proxy mode caused nginx to wait for another send_timeout before actually closing client's connection if client timed out while still talking to upstream server *) update r3945 with more descriptive error message *) test length of proxy_pass with variables; patch by Lanshun Zhou
author Igor Sysoev <igor@sysoev.ru>
date Mon, 29 Aug 2011 12:56:09 +0000
parents f1f194ceab16
children d3568507db51
line wrap: on
line diff
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -661,10 +661,12 @@ ngx_http_upstream_cache(ngx_http_request
 
         ngx_http_file_cache_create_key(r);
 
-        if (r->cache->header_start >= u->conf->buffer_size) {
+        if (r->cache->header_start + 256 >= u->conf->buffer_size) {
             ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
-                "cache key too large, increase upstream buffer size %uz",
-                u->conf->buffer_size);
+                          "%V_buffer_size %uz is not enough for cache key, "
+                          "it should increased at least to %uz",
+                          &u->conf->module, u->conf->buffer_size,
+                          ngx_align(r->cache->header_start + 256, 1024));
 
             r->cache = NULL;
             return NGX_DECLINED;
@@ -2317,7 +2319,7 @@ ngx_http_upstream_process_non_buffered_d
     if (wev->timedout) {
         c->timedout = 1;
         ngx_connection_error(c, NGX_ETIMEDOUT, "client timed out");
-        ngx_http_upstream_finalize_request(r, u, 0);
+        ngx_http_upstream_finalize_request(r, u, NGX_HTTP_REQUEST_TIME_OUT);
         return;
     }
 
@@ -3013,6 +3015,7 @@ ngx_http_upstream_finalize_request(ngx_h
 #endif
 
     if (u->header_sent
+        && rc != NGX_HTTP_REQUEST_TIME_OUT
         && (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE))
     {
         rc = 0;