]> git.kaiwu.me - nginx.git/commitdiff
Merging r4010, r4065:
authorIgor Sysoev <igor@sysoev.ru>
Fri, 30 Sep 2011 13:42:59 +0000 (13:42 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 30 Sep 2011 13:42:59 +0000 (13:42 +0000)
SSL related fixes:

*) Fixing proxy_set_body and proxy_pass_request_body with SSL.

Flush flag wasn't set in constructed buffer and this prevented any data
from being actually sent to upstream due to SSL buffering.  Make sure
we always set flush in the last buffer we are going to sent.

See here for report:
http://nginx.org/pipermail/nginx-ru/2011-June/041552.html

*) Proper SSL shutdown handling.

If connection has unsent alerts, SSL_shutdown() tries to send them even
if SSL_set_shutdown(SSL_RECEIVED_SHUTDOWN|SSL_SENT_SHUTDOWN) was used.
This can be prevented by SSL_set_quiet_shutdown().  SSL_set_shutdown()
is required nevertheless to preserve session.

src/event/ngx_event_openssl.c
src/http/modules/ngx_http_proxy_module.c

index bb689488a86204a9164c047cf2e29e1037a9b298..259b1d8f269afac09f409188c61301a20d74afa7 100644 (file)
@@ -1205,6 +1205,7 @@ ngx_ssl_shutdown(ngx_connection_t *c)
 
     if (c->timedout) {
         mode = SSL_RECEIVED_SHUTDOWN|SSL_SENT_SHUTDOWN;
+        SSL_set_quiet_shutdown(c->ssl->connection, 1);
 
     } else {
         mode = SSL_get_shutdown(c->ssl->connection);
@@ -1216,6 +1217,10 @@ ngx_ssl_shutdown(ngx_connection_t *c)
         if (c->ssl->no_send_shutdown) {
             mode |= SSL_SENT_SHUTDOWN;
         }
+
+        if (c->ssl->no_wait_shutdown && c->ssl->no_send_shutdown) {
+            SSL_set_quiet_shutdown(c->ssl->connection, 1);
+        }
     }
 
     SSL_set_shutdown(c->ssl->connection, mode);
index 495b1743d8ba17085c6d208e4859737c6cb776d1..902cfb8f2916ac2171de41726bd3002dfb112711 100644 (file)
@@ -1132,12 +1132,11 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
             body = body->next;
         }
 
-        b->flush = 1;
-
     } else {
         u->request_bufs = cl;
     }
 
+    b->flush = 1;
     cl->next = NULL;
 
     return NGX_OK;