Mercurial > hg > nginx
changeset 4663:b9ea486e543f stable-1.2
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.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 04 Jun 2012 11:00:34 +0000 |
parents | 979e0f5b196d |
children | 356c91151658 |
files | src/http/modules/ngx_http_fastcgi_module.c |
diffstat | 1 files changed, 23 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_fastcgi_module.c Mon Jun 04 10:54:48 2012 +0000 +++ b/src/http/modules/ngx_http_fastcgi_module.c Mon Jun 04 11:00:34 2012 +0000 @@ -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,7 +1693,12 @@ } 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;