Opened 9 years ago

Closed 9 years ago

#839 closed defect (invalid)

nginx applies transfer-encoding chunked to scgi response already encoded

Reported by: nascheme@… Owned by:
Priority: minor Milestone:
Component: nginx-module Version: 1.6.x
Keywords: scgi chunked Cc:
uname -a: Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u6 (2015-11-09) x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.6.2
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt=-Wl,-z,relro --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/ --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --add-module=/tmp/buildd/nginx-1.6.2/debian/modules/nginx-auth-pam --add-module=/tmp/buildd/nginx-1.6.2/debian/modules/nginx-dav-ext-module --add-module=/tmp/buildd/nginx-1.6.2/debian/modules/nginx-echo --add-module=/tmp/buildd/nginx-1.6.2/debian/modules/nginx-upstream-fair --add-module=/tmp/buildd/nginx-1.6.2/debian/modules/ngx_http_substitutions_filter_module


I think this is a bug but I'm not sure. I notice that newer versions of Nginx will apply transfer-encoding: chunked to response bodies from an SCGI server. It will do so even if the response already has been transfer-encoded.

How difficult would it be to make Nginx not apply chunked transfer encoding if the SCGI response already has "Transfer-encoding: chunked" as a header? I think chunked encoding serves a useful purpose in the case where the app server is generating a large response body and doesn't know beforehand the length of it.

Change History (1)

comment:1 by Maxim Dounin, 9 years ago

Resolution: invalid
Status: newclosed

It's not a bug, at least not in nginx. Chunked encoding is a part of HTTP/1.1 and not something specified by SCGI. When returning a response an SCGI server is expected to terminate a response by closing the connection. When needed and possible (i.e., when HTTP/1.1 is used, and length of the response is not known) nginx will apply chunked encoding itself.

Note: See TracTickets for help on using tickets.