diff src/event/ngx_event_openssl.c @ 2:cc9f381affaa NGINX_0_1_1

nginx 0.1.1 *) Feature: the gzip_types directive. *) Feature: the tcp_nodelay directive. *) Feature: the send_lowat directive is working not only on OSes that support kqueue NOTE_LOWAT, but also on OSes that support SO_SNDLOWAT. *) Feature: the setproctitle() emulation for Linux and Solaris. *) Bugfix: the "Location" header rewrite bug fixed while the proxying. *) Bugfix: the ngx_http_chunked_module module may get caught in an endless loop. *) Bugfix: the /dev/poll module bugs fixed. *) Bugfix: the responses were corrupted when the temporary files were used while the proxying. *) Bugfix: the unescaped requests were passed to the backend. *) Bugfix: while the build configuration on Linux 2.4 the --with-poll_module parameter was required.
author Igor Sysoev <http://sysoev.ru>
date Mon, 11 Oct 2004 00:00:00 +0400
parents f0b350454894
children 4b2dafa26fe2
line wrap: on
line diff
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -72,6 +72,13 @@ ngx_int_t ngx_ssl_recv(ngx_connection_t 
         return n;
     }
 
+    if (!SSL_is_init_finished(c->ssl->ssl)) {
+        handshake = "in SSL handshake";
+
+    } else {
+        handshake = "";
+    }
+
     sslerr = SSL_get_error(c->ssl->ssl, n);
 
     err = (sslerr == SSL_ERROR_SYSCALL) ? ngx_errno : 0;
@@ -91,13 +98,6 @@ ngx_int_t ngx_ssl_recv(ngx_connection_t 
 #endif
     }
 
-    if (!SSL_is_init_finished(c->ssl->ssl)) {
-        handshake = "in SSL handshake";
-
-    } else {
-        handshake = "";
-    }
-
     c->ssl->no_rcv_shut = 1;
 
     if (sslerr == SSL_ERROR_ZERO_RETURN || ERR_peek_error() == 0) {
@@ -240,8 +240,9 @@ ngx_chain_t *ngx_ssl_send_chain(ngx_conn
 
 static ngx_int_t ngx_ssl_write(ngx_connection_t *c, u_char *data, size_t size)
 {
-    int        n, sslerr;
-    ngx_err_t  err;
+    int         n, sslerr;
+    ngx_err_t   err;
+    char       *handshake;
 
     ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "SSL to write: %d", size);
 
@@ -265,13 +266,21 @@ static ngx_int_t ngx_ssl_write(ngx_conne
     }
 
     if (sslerr == SSL_ERROR_WANT_READ) {
+
+        if (!SSL_is_init_finished(c->ssl->ssl)) {
+            handshake = "in SSL handshake";
+
+        } else {
+            handshake = "";
+        }
+
         ngx_log_error(NGX_LOG_ALERT, c->log, err,
                       "SSL wants to read%s", handshake);
         return NGX_ERROR;
 #if 0
         return NGX_AGAIN;
+#endif
     }
-#endif
 
     c->ssl->no_rcv_shut = 1;