Opened 7 years ago

Closed 7 years ago

#1272 closed defect (invalid)

nginx don't return response body when upstream server discard request body

Reported by: Tevic@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.11.x
Keywords: Cc:
uname -a: MSYS_NT-10.0 TWC-PC 2.7.0(0.306/5/3) 2017-02-14 08:57 x86_64 Msys
nginx -V: nginx version: nginx/1.11.13
built by cl 16.00.40219.01 for 80x86
built with OpenSSL 1.0.2k 26 Jan 2017
TLS SNI support enabled
configure arguments: --with-cc=cl --builddir=objs.msvc8 --with-debug --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --http-scgi-temp-path=temp/scgi_temp --http-uwsgi-temp-path=temp/uwsgi_temp --with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs.msvc8/lib/pcre-8.40 --with-zlib=objs.msvc8/lib/zlib-1.2.11 --with-select_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_slice_module --with-mail --with-stream --with-openssl=objs.msvc8/lib/openssl-1.0.2k --with-openssl-opt=no-asm --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module

Description

First, i write a http server without read request body and return code 400 and "Hello".
Then, set nginx upstream to the server,like

upstream up_nodes {
        server 127.0.0.1:8080 max_fails=0;
}

Make a POST request with request body not null, and nginx will return 502 within a huge probability. I expect it will return code 400 and "Hello".
The error.log shows as below.

2017/05/14 14:23:31 [error] 34164#6456: *19 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 127.0.0.1, server: ~.*, request: "POST / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "127.0.0.1"

If i make the same request to the upstream server directly, it will return as i expected.I grab the tcp packets and it shows the return body from upstream server is received by nginx but nginx don't return it to client.

Change History (1)

comment:1 by Maxim Dounin, 7 years ago

Resolution: invalid
Status: newclosed

This is a bug in the http server you wrote, see ticket #1037 for detailed explanation.

Note: See TracTickets for help on using tickets.