comparison 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
comparison
equal deleted inserted replaced
4044:0ea785433fcf 4045:2d062c031fff
659 659
660 /* TODO: add keys */ 660 /* TODO: add keys */
661 661
662 ngx_http_file_cache_create_key(r); 662 ngx_http_file_cache_create_key(r);
663 663
664 if (r->cache->header_start >= u->conf->buffer_size) { 664 if (r->cache->header_start + 256 >= u->conf->buffer_size) {
665 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 665 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
666 "cache key too large, increase upstream buffer size %uz", 666 "%V_buffer_size %uz is not enough for cache key, "
667 u->conf->buffer_size); 667 "it should increased at least to %uz",
668 &u->conf->module, u->conf->buffer_size,
669 ngx_align(r->cache->header_start + 256, 1024));
668 670
669 r->cache = NULL; 671 r->cache = NULL;
670 return NGX_DECLINED; 672 return NGX_DECLINED;
671 } 673 }
672 674
2315 c->log->action = "sending to client"; 2317 c->log->action = "sending to client";
2316 2318
2317 if (wev->timedout) { 2319 if (wev->timedout) {
2318 c->timedout = 1; 2320 c->timedout = 1;
2319 ngx_connection_error(c, NGX_ETIMEDOUT, "client timed out"); 2321 ngx_connection_error(c, NGX_ETIMEDOUT, "client timed out");
2320 ngx_http_upstream_finalize_request(r, u, 0); 2322 ngx_http_upstream_finalize_request(r, u, NGX_HTTP_REQUEST_TIME_OUT);
2321 return; 2323 return;
2322 } 2324 }
2323 2325
2324 ngx_http_upstream_process_non_buffered_request(r, 1); 2326 ngx_http_upstream_process_non_buffered_request(r, 1);
2325 } 2327 }
3011 } 3013 }
3012 3014
3013 #endif 3015 #endif
3014 3016
3015 if (u->header_sent 3017 if (u->header_sent
3018 && rc != NGX_HTTP_REQUEST_TIME_OUT
3016 && (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE)) 3019 && (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE))
3017 { 3020 {
3018 rc = 0; 3021 rc = 0;
3019 } 3022 }
3020 3023