internal location keepalive_requests issue

crasyangel nginx-forum at forum.nginx.org
Sat Aug 27 03:15:38 UTC 2016


if (r->keepalive) {
        if (clcf->keepalive_timeout == 0) {
            r->keepalive = 0;

        } else if (r->connection->requests >= clcf->keepalive_requests) {
            r->keepalive = 0;

        } else if (r->headers_in.msie6
                   && r->method == NGX_HTTP_POST
                   && (clcf->keepalive_disable
                       & NGX_HTTP_KEEPALIVE_DISABLE_MSIE6))
        {
            /*
             * MSIE may wait for some time if an response for
             * a POST request was sent over a keepalive connection
             */
            r->keepalive = 0;

        } else if (r->headers_in.safari
                   && (clcf->keepalive_disable
                       & NGX_HTTP_KEEPALIVE_DISABLE_SAFARI))
        {
            /*
             * Safari may send a POST request to a closed keepalive
             * connection and may stall for some time, see
             *     https://bugs.webkit.org/show_bug.cgi?id=5760
             */
            r->keepalive = 0;
        }
    }

Note r->keepalive only effect that Connection filed in response header and
set keepalive timer when finalize request
Why place this code block in ngx_http_update_location_config? Would be
better place it when set keepalive timer?
And maybe ngx send "Connection: keep-alive", but close connection in present
1.10.1, and this would be nothing seriously
So why is it the expected behaviour?

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,269220,269224#msg-269224



More information about the nginx mailing list