comparison src/http/ngx_http_upstream.c @ 5296:1ccdda1f37f3

Upstream: NGX_HTTP_GATEWAY_TIME_OUT after upstream timeouts. There is no real difference from previously used 0 as NGX_HTTP_* will become 0 in ngx_http_upstream_finalize_request(), but the change preserves information about a timeout a bit longer. Previous use of ETIMEDOUT in one place was just wrong. Note well that with cacheable responses there will be a difference (code in ngx_http_upstream_finalize_request() will store the error in cache), though this change doesn't touch cacheable case.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 25 Jul 2013 14:56:20 +0400
parents a489c31c9783
children 0ae9a2958886
comparison
equal deleted inserted replaced
5295:a489c31c9783 5296:1ccdda1f37f3
2016 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, 2016 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
2017 "http upstream process body on memory"); 2017 "http upstream process body on memory");
2018 2018
2019 if (rev->timedout) { 2019 if (rev->timedout) {
2020 ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out"); 2020 ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out");
2021 ngx_http_upstream_finalize_request(r, u, NGX_ETIMEDOUT); 2021 ngx_http_upstream_finalize_request(r, u, NGX_HTTP_GATEWAY_TIME_OUT);
2022 return; 2022 return;
2023 } 2023 }
2024 2024
2025 b = &u->buffer; 2025 b = &u->buffer;
2026 2026
2512 return; 2512 return;
2513 } 2513 }
2514 2514
2515 if (upstream->read->timedout || upstream->write->timedout) { 2515 if (upstream->read->timedout || upstream->write->timedout) {
2516 ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out"); 2516 ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out");
2517 ngx_http_upstream_finalize_request(r, u, 0); 2517 ngx_http_upstream_finalize_request(r, u, NGX_HTTP_GATEWAY_TIME_OUT);
2518 return; 2518 return;
2519 } 2519 }
2520 2520
2521 if (from_upstream) { 2521 if (from_upstream) {
2522 src = upstream; 2522 src = upstream;
2699 2699
2700 c->log->action = "reading upstream"; 2700 c->log->action = "reading upstream";
2701 2701
2702 if (c->read->timedout) { 2702 if (c->read->timedout) {
2703 ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out"); 2703 ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out");
2704 ngx_http_upstream_finalize_request(r, u, 0); 2704 ngx_http_upstream_finalize_request(r, u, NGX_HTTP_GATEWAY_TIME_OUT);
2705 return; 2705 return;
2706 } 2706 }
2707 2707
2708 ngx_http_upstream_process_non_buffered_request(r, 0); 2708 ngx_http_upstream_process_non_buffered_request(r, 0);
2709 } 2709 }