diff src/event/ngx_event_openssl.c @ 294:27d9d1f26b38 NGINX_0_5_17

nginx 0.5.17 *) Change: now nginx always returns the 405 status for the TRACE method. *) Feature: now nginx supports the "include" directive inside the "types" block. *) Bugfix: the $document_root variable usage in the "root" and "alias" directives is disabled: this caused recursive stack overflow. *) Bugfix: in the HTTPS protocol in the "proxy_pass" directive. *) Bugfix: in some cases non-cachable variables (such as $uri variable) returned old cached value.
author Igor Sysoev <http://sysoev.ru>
date Mon, 02 Apr 2007 00:00:00 +0400
parents c5c2b2883984
children 9b7db0df50f0
line wrap: on
line diff
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -547,22 +547,32 @@ ngx_ssl_handshake_handler(ngx_event_t *e
 ssize_t
 ngx_ssl_recv_chain(ngx_connection_t *c, ngx_chain_t *cl)
 {
+    u_char     *last;
     ssize_t     n, bytes;
     ngx_buf_t  *b;
 
     bytes = 0;
 
-    while (cl) {
-        b = cl->buf;
-
-        n = ngx_ssl_recv(c, b->last, b->end - b->last);
+    b = cl->buf;
+    last = b->last;
+
+    for ( ;; ) {
+
+        n = ngx_ssl_recv(c, last, b->end - last);
 
         if (n > 0) {
-            b->last += n;
+            last += n;
             bytes += n;
 
-            if (b->last == b->end) {
+            if (last == b->end) {
                 cl = cl->next;
+
+                if (cl == NULL) {
+                    return bytes;
+                }
+
+                b = cl->buf;
+                last = b->last;
             }
 
             continue;
@@ -574,8 +584,6 @@ ngx_ssl_recv_chain(ngx_connection_t *c, 
 
         return n;
     }
-
-    return bytes;
 }