Welcome! Log In Create A New Profile

Advanced

[PATCH 1 of 3] Fixed incorrect use of r->http_version in scgi module

Maxim Dounin
December 12, 2011 01:38PM
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1323713242 -10800
# Node ID 8539c06e005df149af9aeafbf5eedfb565796ecf
# Parent 189afff6503fdb14e2ba72336a68d6673637f7d7
Fixed incorrect use of r->http_version in scgi module.

The r->http_version is a version of client's request, and modules must
not set it unless they are really willing to downgrade protocol version
used for a response (i.e. to HTTP/0.9 if no response headers are available).
In neither case r->http_version may be upgraded.

The former code downgraded response from HTTP/1.1 to HTTP/1.0 for no reason,
causing various problems (see ticket #66). It was also possible that
HTTP/0.9 requests were upgraded to HTTP/1.0.

diff --git a/src/http/modules/ngx_http_scgi_module.c b/src/http/modules/ngx_http_scgi_module.c
--- a/src/http/modules/ngx_http_scgi_module.c
+++ b/src/http/modules/ngx_http_scgi_module.c
@@ -857,11 +857,7 @@ ngx_http_scgi_process_status_line(ngx_ht
}

if (rc == NGX_ERROR) {
-
- r->http_version = NGX_HTTP_VERSION_9;
-
u->process_header = ngx_http_scgi_process_header;
-
return ngx_http_scgi_process_header(r);
}

@@ -961,12 +957,12 @@ ngx_http_scgi_process_header(ngx_http_re
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http scgi header done");

- if (r->http_version > NGX_HTTP_VERSION_9) {
+ u = r->upstream;
+
+ if (u->headers_in.status_n) {
return NGX_OK;
}

- u = r->upstream;
-
if (u->headers_in.status) {
status_line = &u->headers_in.status->value;

@@ -978,12 +974,10 @@ ngx_http_scgi_process_header(ngx_http_re
return NGX_HTTP_UPSTREAM_INVALID_HEADER;
}

- r->http_version = NGX_HTTP_VERSION_10;
u->headers_in.status_n = status;
u->headers_in.status_line = *status_line;

} else if (u->headers_in.location) {
- r->http_version = NGX_HTTP_VERSION_10;
u->headers_in.status_n = 302;
ngx_str_set(&u->headers_in.status_line,
"302 Moved Temporarily");

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

[PATCH 0 of 3] scgi patches

Maxim Dounin 1549 December 12, 2011 01:38PM

[PATCH 1 of 3] Fixed incorrect use of r->http_version in scgi module

Maxim Dounin 498 December 12, 2011 01:38PM

[PATCH 2 of 3] Scgi: removed duplicate function declaration

Maxim Dounin 417 December 12, 2011 01:38PM

[PATCH 3 of 3] Scgi: removed error if there is no Status header

Maxim Dounin 492 December 12, 2011 01:38PM



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

Online Users

Guests: 237
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