changeset 5020:587dbe2edc5f

SSL: preservation of flush flag for buffered data. Previously, if SSL buffer was not sent we lost information that the data must be flushed.
author Valentin Bartenev <vbart@nginx.com>
date Mon, 28 Jan 2013 15:37:11 +0000
parents 69693a098655
children 674f8739e443
files src/event/ngx_event_openssl.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -1169,7 +1169,7 @@ ngx_ssl_send_chain(ngx_connection_t *c, 
     }
 
     send = 0;
-    flush = (in == NULL) ? 1 : 0;
+    flush = (in == NULL) ? 1 : buf->flush;
 
     for ( ;; ) {
 
@@ -1191,7 +1191,6 @@ ngx_ssl_send_chain(ngx_connection_t *c, 
 
             if (send + size > limit) {
                 size = (ssize_t) (limit - send);
-                flush = 1;
             }
 
             ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
@@ -1210,7 +1209,7 @@ ngx_ssl_send_chain(ngx_connection_t *c, 
 
         size = buf->last - buf->pos;
 
-        if (!flush && buf->last < buf->end) {
+        if (!flush && send < limit && buf->last < buf->end) {
             break;
         }
 
@@ -1221,8 +1220,7 @@ ngx_ssl_send_chain(ngx_connection_t *c, 
         }
 
         if (n == NGX_AGAIN) {
-            c->buffered |= NGX_SSL_BUFFERED;
-            return in;
+            break;
         }
 
         buf->pos += n;
@@ -1242,6 +1240,8 @@ ngx_ssl_send_chain(ngx_connection_t *c, 
         }
     }
 
+    buf->flush = flush;
+
     if (buf->pos < buf->last) {
         c->buffered |= NGX_SSL_BUFFERED;