Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 5303:0fb714d80909
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 25 Jul 2013 15:00:29 +0400 |
parents | 292c92fb05d7 |
children | d3eab5e2df5f |
comparison
equal
deleted
inserted
replaced
5302:292c92fb05d7 | 5303:0fb714d80909 |
---|---|
3401 ngx_http_file_cache_free(r->cache, u->pipe->temp_file); | 3401 ngx_http_file_cache_free(r->cache, u->pipe->temp_file); |
3402 } | 3402 } |
3403 | 3403 |
3404 #endif | 3404 #endif |
3405 | 3405 |
3406 if (u->header_sent | 3406 if (rc == NGX_DECLINED) { |
3407 && rc != NGX_HTTP_REQUEST_TIME_OUT | 3407 return; |
3408 && rc != NGX_HTTP_CLIENT_CLOSED_REQUEST | 3408 } |
3409 && (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE)) | 3409 |
3410 r->connection->log->action = "sending to client"; | |
3411 | |
3412 if (!u->header_sent | |
3413 || rc == NGX_HTTP_REQUEST_TIME_OUT | |
3414 || rc == NGX_HTTP_CLIENT_CLOSED_REQUEST) | |
3410 { | 3415 { |
3416 ngx_http_finalize_request(r, rc); | |
3417 return; | |
3418 } | |
3419 | |
3420 if (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE) { | |
3411 rc = 0; | 3421 rc = 0; |
3412 } | 3422 } |
3413 | 3423 |
3414 if (rc == NGX_DECLINED) { | 3424 if (r->header_only) { |
3415 return; | 3425 ngx_http_finalize_request(r, rc); |
3416 } | 3426 return; |
3417 | 3427 } |
3418 r->connection->log->action = "sending to client"; | 3428 |
3419 | 3429 if (rc == 0) { |
3420 if (rc == 0 | |
3421 && !r->header_only | |
3422 #if (NGX_HTTP_CACHE) | |
3423 && !r->cached | |
3424 #endif | |
3425 ) | |
3426 { | |
3427 rc = ngx_http_send_special(r, NGX_HTTP_LAST); | 3430 rc = ngx_http_send_special(r, NGX_HTTP_LAST); |
3428 } | 3431 } |
3429 | 3432 |
3430 ngx_http_finalize_request(r, rc); | 3433 ngx_http_finalize_request(r, rc); |
3431 } | 3434 } |