Sfoglia il codice sorgente

It is indeed possible for SSL_write to fail with SSL_ERROR_WANT_READ.

See http://openssl.6102.n7.nabble.com/SSL-write-fails-td17473.html
bel 9 anni fa
parent
commit
a0a5cbce8a
1 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  1. 4 2
      src/civetweb.c

+ 4 - 2
src/civetweb.c

@@ -3916,7 +3916,8 @@ push(struct mg_context *ctx,
 				err = SSL_get_error(ssl, n);
 				if ((err == SSL_ERROR_SYSCALL) && (n == -1)) {
 					err = ERRNO;
-				} else if (err == SSL_ERROR_WANT_WRITE) {
+				} else if ((err == SSL_ERROR_WANT_READ)
+				           || (err == SSL_ERROR_WANT_WRITE)) {
 					n = 0;
 				} else {
 					DEBUG_TRACE("SSL_write() failed, error %d", err);
@@ -4057,7 +4058,8 @@ pull(FILE *fp, struct mg_connection *conn, char *buf, int len, double timeout)
 				err = SSL_get_error(conn->ssl, nread);
 				if ((err == SSL_ERROR_SYSCALL) && (nread == -1)) {
 					err = ERRNO;
-				} else if (err == SSL_ERROR_WANT_READ) {
+				} else if ((err == SSL_ERROR_WANT_READ)
+				           || (err == SSL_ERROR_WANT_WRITE)) {
 					nread = 0;
 				} else {
 					DEBUG_TRACE("SSL_read() failed, error %d", err);