]> sjero.net Git - wget/commitdiff
openssl: make openssl_peek non-blocking.
authorGiuseppe Scrivano <gscrivano@gnu.org>
Wed, 13 Apr 2011 11:57:37 +0000 (13:57 +0200)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Wed, 13 Apr 2011 11:57:37 +0000 (13:57 +0200)
src/ChangeLog
src/openssl.c

index b1207895a569418e465606e9f4bdb5d46c0684c1..548de6294a0569bd3489b68404eee0d3dd9456d9 100644 (file)
@@ -1,3 +1,9 @@
+2011-04-13  Giuseppe Scrivano  <gscrivano@gnu.org>
+
+       * openssl.c (openssl_poll): Check if the specified timeout is zero after
+       SSL_pending.
+       (openssl_peek): Make the call non-blocking.
+
 2011-04-11  Cristian Rodríguez  <crrodriguez@opensuse.org> (tiny change)
 
        * openssl.c (ssl_init) [! OPENSSL_NO_SSL2]: Use SSLv2 only when
index 78fb5d85c6761ecc08b30195223421165050cf81..b42d6986cd7e26d76664aacd24f9109fe1fffc6c 100644 (file)
@@ -289,10 +289,10 @@ openssl_poll (int fd, double timeout, int wait_for, void *arg)
 {
   struct openssl_transport_context *ctx = arg;
   SSL *conn = ctx->conn;
-  if (timeout == 0)
-    return 1;
   if (SSL_pending (conn))
     return 1;
+  if (timeout == 0)
+    return 1;
   return select_fd (fd, timeout, wait_for);
 }
 
@@ -302,6 +302,8 @@ openssl_peek (int fd, char *buf, int bufsize, void *arg)
   int ret;
   struct openssl_transport_context *ctx = arg;
   SSL *conn = ctx->conn;
+  if (! openssl_poll (fd, 0.0, WAIT_FOR_READ, arg))
+    return 0;
   do
     ret = SSL_peek (conn, buf, bufsize);
   while (ret == -1