]> git.kaiwu.me - nginx.git/commitdiff
SSL: reset ready flag if recv(MSG_PEEK) found no bytes in socket.
authorRoman Arutyunyan <arut@nginx.com>
Mon, 2 Mar 2015 18:15:46 +0000 (21:15 +0300)
committerRoman Arutyunyan <arut@nginx.com>
Mon, 2 Mar 2015 18:15:46 +0000 (21:15 +0300)
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.

src/http/ngx_http_request.c

index a07d5e47fb8c6a09ce935dc8fb57b149a67ac603..0ee145dd69f2826c4701f9f1c4fd7fbaf7fd31c2 100644 (file)
@@ -652,6 +652,7 @@ ngx_http_ssl_handshake(ngx_event_t *rev)
 
     if (n == -1) {
         if (err == NGX_EAGAIN) {
+            rev->ready = 0;
 
             if (!rev->timer_set) {
                 ngx_add_timer(rev, c->listening->post_accept_timeout);