Welcome! Log In Create A New Profile

Advanced

[nginx] Upstream: request finalization rework.

Maxim Dounin
July 25, 2013 08:00AM
details: http://hg.nginx.org/nginx/rev/0fb714d80909
branches:
changeset: 5303:0fb714d80909
user: Maxim Dounin <mdounin@mdounin.ru>
date: Thu Jul 25 15:00:29 2013 +0400
description:
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.

diffstat:

src/http/ngx_http_upstream.c | 31 +++++++++++++++++--------------
1 files changed, 17 insertions(+), 14 deletions(-)

diffs (48 lines):

diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -3403,27 +3403,30 @@ ngx_http_upstream_finalize_request(ngx_h

#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);
}


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Upstream: request finalization rework.

Maxim Dounin 719 July 25, 2013 08:00AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 162
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready