aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_scgi_module.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2011-12-19 11:23:16 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2011-12-19 11:23:16 +0000
commit4d1e32d9d8216bb9eb29834bb5571bf246d89412 (patch)
tree1d91dde463eb0b52b247845fb4e4c658ae77dc4d /src/http/modules/ngx_http_scgi_module.c
parentafb7f22c037de7b7b6ff15a05cc60fe5c90254c2 (diff)
downloadnginx-4d1e32d9d8216bb9eb29834bb5571bf246d89412.tar.gz
nginx-4d1e32d9d8216bb9eb29834bb5571bf246d89412.zip
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.
Diffstat (limited to 'src/http/modules/ngx_http_scgi_module.c')
-rw-r--r--src/http/modules/ngx_http_scgi_module.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/http/modules/ngx_http_scgi_module.c b/src/http/modules/ngx_http_scgi_module.c
index 41cf23bc6..550697bba 100644
--- 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_http_request_t *r)
}
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_request_t *r)
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_request_t *r)
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");