summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2013-07-25 15:00:29 +0400
committerMaxim Dounin <mdounin@mdounin.ru>2013-07-25 15:00:29 +0400
commit78aacc838bac5c92fe92f8533526515766cfce15 (patch)
tree5ca718343abda93a83dee975c142fd38fcfb3908
parent86277254dda48d76f3617ceb8ee934dfddeb332f (diff)
downloadnginx-78aacc838bac5c92fe92f8533526515766cfce15.tar.gz
nginx-78aacc838bac5c92fe92f8533526515766cfce15.tar.bz2
Upstream: request finalization rework.
No semantic changes expected, though some checks are done differently. In particular, the r->cached flag is no longer explicitly checked. Instead, we relay on u->header_sent not being set if a response is sent from a cache.
-rw-r--r--src/http/ngx_http_upstream.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 8590f4e2e..1f6000ea4 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -3403,27 +3403,30 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r,
#endif
- if (u->header_sent
- && rc != NGX_HTTP_REQUEST_TIME_OUT
- && rc != NGX_HTTP_CLIENT_CLOSED_REQUEST
- && (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE))
- {
- rc = 0;
- }
-
if (rc == NGX_DECLINED) {
return;
}
r->connection->log->action = "sending to client";
- if (rc == 0
- && !r->header_only
-#if (NGX_HTTP_CACHE)
- && !r->cached
-#endif
- )
+ if (!u->header_sent
+ || rc == NGX_HTTP_REQUEST_TIME_OUT
+ || rc == NGX_HTTP_CLIENT_CLOSED_REQUEST)
{
+ ngx_http_finalize_request(r, rc);
+ return;
+ }
+
+ if (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE) {
+ rc = 0;
+ }
+
+ if (r->header_only) {
+ ngx_http_finalize_request(r, rc);
+ return;
+ }
+
+ if (rc == 0) {
rc = ngx_http_send_special(r, NGX_HTTP_LAST);
}