[nginx] FastCGI: skip special bufs in buffered request body chain.

Valentin Bartenev vbart at nginx.com
Thu Apr 14 12:25:29 UTC 2016


details:   http://hg.nginx.org/nginx/rev/b5734248d5e7
branches:  
changeset: 6512:b5734248d5e7
user:      Valentin Bartenev <vbart at nginx.com>
date:      Mon Apr 11 18:42:34 2016 +0300
description:
FastCGI: skip special bufs in buffered request body chain.

This prevents forming empty records out of such buffers.  Particularly it fixes
double end-of-stream records with chunked transfer encoding, or when HTTP/2 is
used and the END_STREAM flag has been sent without data.  In both cases there
is an empty buffer at the end of the request body chain with the "last_buf"
flag set.

The canonical libfcgi, as well as php implementation, tolerates such records,
while the HHVM parser is more strict and drops the connection (ticket #950).

diffstat:

 src/http/modules/ngx_http_fastcgi_module.c |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff -r 640288d0e1bc -r b5734248d5e7 src/http/modules/ngx_http_fastcgi_module.c
--- a/src/http/modules/ngx_http_fastcgi_module.c	Tue Apr 12 19:01:56 2016 +0300
+++ b/src/http/modules/ngx_http_fastcgi_module.c	Mon Apr 11 18:42:34 2016 +0300
@@ -1177,6 +1177,11 @@ ngx_http_fastcgi_create_request(ngx_http
 
         while (body) {
 
+            if (ngx_buf_special(body->buf)) {
+                body = body->next;
+                continue;
+            }
+
             if (body->buf->in_file) {
                 file_pos = body->buf->file_pos;
 



More information about the nginx-devel mailing list