Welcome! Log In Create A New Profile

Advanced

[PATCH] Upstream: fix $upstream_status variable

Piotr Sikora
February 12, 2014 01:00AM
# HG changeset patch
# User Piotr Sikora <piotr@cloudflare.com>
# Date 1392184482 28800
# Tue Feb 11 21:54:42 2014 -0800
# Node ID 3f21f5b57864af853ad097a113e419086a603aae
# Parent cff36d2d7fe6db1baa9d44ed30ebd26b20c05d06
Upstream: fix $upstream_status variable.

Previously, upstream's status code was overwritten with
cached response's status code when STALE or REVALIDATED
response was sent to the client.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>

diff -r cff36d2d7fe6 -r 3f21f5b57864 src/http/modules/ngx_http_fastcgi_module.c
--- a/src/http/modules/ngx_http_fastcgi_module.c Tue Feb 11 20:54:16 2014 +0800
+++ b/src/http/modules/ngx_http_fastcgi_module.c Tue Feb 11 21:54:42 2014 -0800
@@ -1584,7 +1584,7 @@ ngx_http_fastcgi_process_header(ngx_http
ngx_str_set(&u->headers_in.status_line, "200 OK");
}

- if (u->state) {
+ if (u->state && u->state->status == 0) {
u->state->status = u->headers_in.status_n;
}

diff -r cff36d2d7fe6 -r 3f21f5b57864 src/http/modules/ngx_http_proxy_module.c
--- a/src/http/modules/ngx_http_proxy_module.c Tue Feb 11 20:54:16 2014 +0800
+++ b/src/http/modules/ngx_http_proxy_module.c Tue Feb 11 21:54:42 2014 -0800
@@ -1362,7 +1362,7 @@ ngx_http_proxy_process_status_line(ngx_h
return NGX_OK;
}

- if (u->state) {
+ if (u->state && u->state->status == 0) {
u->state->status = ctx->status.code;
}

diff -r cff36d2d7fe6 -r 3f21f5b57864 src/http/modules/ngx_http_scgi_module.c
--- a/src/http/modules/ngx_http_scgi_module.c Tue Feb 11 20:54:16 2014 +0800
+++ b/src/http/modules/ngx_http_scgi_module.c Tue Feb 11 21:54:42 2014 -0800
@@ -885,7 +885,7 @@ ngx_http_scgi_process_status_line(ngx_ht
return ngx_http_scgi_process_header(r);
}

- if (u->state) {
+ if (u->state && u->state->status == 0) {
u->state->status = status->code;
}

@@ -1013,7 +1013,7 @@ ngx_http_scgi_process_header(ngx_http_re
ngx_str_set(&u->headers_in.status_line, "200 OK");
}

- if (u->state) {
+ if (u->state && u->state->status == 0) {
u->state->status = u->headers_in.status_n;
}

diff -r cff36d2d7fe6 -r 3f21f5b57864 src/http/modules/ngx_http_uwsgi_module.c
--- a/src/http/modules/ngx_http_uwsgi_module.c Tue Feb 11 20:54:16 2014 +0800
+++ b/src/http/modules/ngx_http_uwsgi_module.c Tue Feb 11 21:54:42 2014 -0800
@@ -1017,7 +1017,7 @@ ngx_http_uwsgi_process_status_line(ngx_h
return ngx_http_uwsgi_process_header(r);
}

- if (u->state) {
+ if (u->state && u->state->status == 0) {
u->state->status = status->code;
}

@@ -1145,7 +1145,7 @@ ngx_http_uwsgi_process_header(ngx_http_r
ngx_str_set(&u->headers_in.status_line, "200 OK");
}

- if (u->state) {
+ if (u->state && u->state->status == 0) {
u->state->status = u->headers_in.status_n;
}


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

[PATCH] Upstream: fix $upstream_status variable

Piotr Sikora 811 February 12, 2014 01:00AM

Re: [PATCH] Upstream: fix $upstream_status variable

Ruslan Ermilov 337 February 12, 2014 03:20AM

Re: [PATCH] Upstream: fix $upstream_status variable

Maxim Dounin 385 February 12, 2014 09:10AM



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

Online Users

Guests: 290
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready