comparison src/http/ngx_http_request.c @ 5993:5b549cc7f698

SSL: reset ready flag if recv(MSG_PEEK) found no bytes in socket. Previously, connection hung after calling ngx_http_ssl_handshake() with rev->ready set and no bytes in socket to read. It's possible in at least the following cases: - when processing a connection with expired TCP_DEFER_ACCEPT on Linux - after parsing PROXY protocol header if it arrived in a separate TCP packet Thanks to James Hamlin.
author Roman Arutyunyan <arut@nginx.com>
date Mon, 02 Mar 2015 21:15:46 +0300
parents 8dfee01ff0bd
children a08fad30aeac
comparison
equal deleted inserted replaced
5992:174512857ccf 5993:5b549cc7f698
650 650
651 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0, "http recv(): %d", n); 651 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0, "http recv(): %d", n);
652 652
653 if (n == -1) { 653 if (n == -1) {
654 if (err == NGX_EAGAIN) { 654 if (err == NGX_EAGAIN) {
655 rev->ready = 0;
655 656
656 if (!rev->timer_set) { 657 if (!rev->timer_set) {
657 ngx_add_timer(rev, c->listening->post_accept_timeout); 658 ngx_add_timer(rev, c->listening->post_accept_timeout);
658 ngx_reusable_connection(c, 1); 659 ngx_reusable_connection(c, 1);
659 } 660 }