[nginx] svn commit: r4664 - in branches/stable-1.2: . src/http/modules

mdounin at mdounin.ru mdounin at mdounin.ru
Mon Jun 4 11:00:34 UTC 2012


Author: mdounin
Date: 2012-06-04 11:00:34 +0000 (Mon, 04 Jun 2012)
New Revision: 4664
URL: http://trac.nginx.org/nginx/changeset/4664/nginx

Log:
Merge of r4617: fastcgi padding fix.

Fastcgi: fixed padding handling on fixed-size records.

Padding was incorrectly ignored on end request, empty stdout and stderr
fastcgi records.  This resulted in protocol desynchronization if fastcgi
application used these records with padding for some reason.

Reported by Ilia Vinokurov.


Modified:
   branches/stable-1.2/
   branches/stable-1.2/src/http/modules/ngx_http_fastcgi_module.c

Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2	2012-06-04 10:54:48 UTC (rev 4663)
+++ branches/stable-1.2	2012-06-04 11:00:34 UTC (rev 4664)

Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4613,4615-4616,4620
+/trunk:4611-4613,4615-4617,4620
\ No newline at end of property
Modified: branches/stable-1.2/src/http/modules/ngx_http_fastcgi_module.c
===================================================================
--- branches/stable-1.2/src/http/modules/ngx_http_fastcgi_module.c	2012-06-04 10:54:48 UTC (rev 4663)
+++ branches/stable-1.2/src/http/modules/ngx_http_fastcgi_module.c	2012-06-04 11:00:34 UTC (rev 4664)
@@ -1356,7 +1356,11 @@
                 }
 
             } else {
-                f->state = ngx_http_fastcgi_st_version;
+                if (f->padding) {
+                    f->state = ngx_http_fastcgi_st_padding;
+                } else {
+                    f->state = ngx_http_fastcgi_st_version;
+                }
             }
 
             continue;
@@ -1689,8 +1693,13 @@
             }
 
             if (f->type == NGX_HTTP_FASTCGI_STDOUT && f->length == 0) {
-                f->state = ngx_http_fastcgi_st_version;
 
+                if (f->padding) {
+                    f->state = ngx_http_fastcgi_st_padding;
+                } else {
+                    f->state = ngx_http_fastcgi_st_version;
+                }
+
                 if (!flcf->keep_conn) {
                     p->upstream_done = 1;
                 }
@@ -1702,7 +1711,13 @@
             }
 
             if (f->type == NGX_HTTP_FASTCGI_END_REQUEST) {
-                f->state = ngx_http_fastcgi_st_version;
+
+                if (f->padding) {
+                    f->state = ngx_http_fastcgi_st_padding;
+                } else {
+                    f->state = ngx_http_fastcgi_st_version;
+                }
+
                 p->upstream_done = 1;
 
                 if (flcf->keep_conn) {
@@ -1775,7 +1790,11 @@
                 }
 
             } else {
-                f->state = ngx_http_fastcgi_st_version;
+                if (f->padding) {
+                    f->state = ngx_http_fastcgi_st_padding;
+                } else {
+                    f->state = ngx_http_fastcgi_st_version;
+                }
             }
 
             continue;



More information about the nginx-devel mailing list