Nginx may recieve data from Upstream Server even a request has not sent

Hi,

I am using Nginx as reverse Proxy, during testing I have noticed
a situation Nginx receives response from upstream server even no request
has been sent yet from Nginx side.

The scenario is that the “Upstream Server” started to transfer data just
after
the connection has established without waiting to request from Nginx,
Nginx
receives all the response
and does not send the Proxied request.

I have looked in the code and realized Nginx allows to receive response
even without request
or maybe the AND should be OR (* (!u->request_sent ||
ngx_http_upstream_test_connect© != NGX_OK))*

static void
ngx_http_upstream_process_header(ngx_http_request_t *r,
ngx_http_upstream_t
*u)
{
ssize_t n;
ngx_int_t rc;
ngx_connection_t *c;

  • if (!u->request_sent && ngx_http_upstream_test_connect© != NGX_OK)
    { ngx_http_upstream_next(r, u,
    NGX_HTTP_UPSTREAM_FT_ERROR); return; }*

Please Advise
Thanks
Hagai A.