[nginx] svn commit: r4438 - in branches/stable-1.0: . src/http/modules

mdounin at mdounin.ru mdounin at mdounin.ru
Sun Feb 5 13:53:51 UTC 2012


Author: mdounin
Date: 2012-02-05 13:53:50 +0000 (Sun, 05 Feb 2012)
New Revision: 4438

Log:
Merge of r4372, r4373, r4374:

SCGI fixes:

*) 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.

*) Removed duplicate function declaration.

*) Removed error if there is no Status header.

   The SCGI specification doesn't specify format of the response, and
   assuming CGI specs should be used there is no reason to complain.
   RFC 3875 explicitly states that "A Status header field is optional,
   and status 200 'OK' is assumed if it is omitted".


Modified:
   branches/stable-1.0/
   branches/stable-1.0/src/http/modules/ngx_http_scgi_module.c


Property changes on: branches/stable-1.0
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4232,4235-4237,4265-4268,4270,4274-4276,4278-4280,4282-4284,4294-4295,4298,4300-4309,4313,4315,4320-4321,4326-4327,4335-4336,4338-4343,4377
   + /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4232,4235-4237,4265-4268,4270,4274-4276,4278-4280,4282-4284,4294-4295,4298,4300-4309,4313,4315,4320-4321,4326-4327,4335-4336,4338-4343,4372-4374,4377

Modified: branches/stable-1.0/src/http/modules/ngx_http_scgi_module.c
===================================================================
--- branches/stable-1.0/src/http/modules/ngx_http_scgi_module.c	2012-02-05 13:34:08 UTC (rev 4437)
+++ branches/stable-1.0/src/http/modules/ngx_http_scgi_module.c	2012-02-05 13:53:50 UTC (rev 4438)
@@ -36,7 +36,6 @@
 static ngx_int_t ngx_http_scgi_reinit_request(ngx_http_request_t *r);
 static ngx_int_t ngx_http_scgi_process_status_line(ngx_http_request_t *r);
 static ngx_int_t ngx_http_scgi_process_header(ngx_http_request_t *r);
-static ngx_int_t ngx_http_scgi_process_header(ngx_http_request_t *r);
 static void ngx_http_scgi_abort_request(ngx_http_request_t *r);
 static void ngx_http_scgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc);
 
@@ -824,11 +823,7 @@
     }
 
     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);
     }
 
@@ -928,12 +923,12 @@
             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;
 
@@ -945,20 +940,15 @@
                     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");
 
             } else {
-                ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
-                              "upstream sent neither valid HTTP/1.0 header "
-                              "nor \"Status\" header line");
                 u->headers_in.status_n = 200;
                 ngx_str_set(&u->headers_in.status_line, "200 OK");
             }



More information about the nginx-devel mailing list