mirror of
https://github.com/nginx/nginx.git
synced 2025-08-06 06:46:16 +08:00
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.
This commit is contained in:
parent
86277254dd
commit
78aacc838b
@ -3403,27 +3403,30 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r,
|
|||||||
|
|
||||||
#endif
|
#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) {
|
if (rc == NGX_DECLINED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
r->connection->log->action = "sending to client";
|
r->connection->log->action = "sending to client";
|
||||||
|
|
||||||
if (rc == 0
|
if (!u->header_sent
|
||||||
&& !r->header_only
|
|| rc == NGX_HTTP_REQUEST_TIME_OUT
|
||||||
#if (NGX_HTTP_CACHE)
|
|| rc == NGX_HTTP_CLIENT_CLOSED_REQUEST)
|
||||||
&& !r->cached
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
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);
|
rc = ngx_http_send_special(r, NGX_HTTP_LAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user