]> sjero.net Git - wget/commitdiff
gnutls: peek blocks until data is available.
authorGiuseppe Scrivano <gscrivano@gnu.org>
Sat, 23 Oct 2010 10:34:49 +0000 (12:34 +0200)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Sat, 23 Oct 2010 10:34:49 +0000 (12:34 +0200)
src/ChangeLog
src/gnutls.c

index 7b8c1772e152c9ad31375346b67a005446ecd280..2175acff90e0b262c527748af441b746ed692a40 100644 (file)
@@ -1,3 +1,7 @@
+2010-10-23  Giuseppe Scrivano  <gscrivano@gnu.org>
+
+       * gnutls.c (wgnutls_peek): Block until data is available.
+
 2010-10-21  Giuseppe Scrivano  <gscrivano@gnu.org>
 
        * retr.c (retrieve_url): Do not register HTML files twice.
index 17c7c9287662b10292cc5c7b22babd33b3ae750e..440b1aed2de7c429d6b0f36cda97804378d4efa3 100644 (file)
@@ -184,13 +184,14 @@ wgnutls_peek (int fd, char *buf, int bufsize, void *arg)
     {
       do
         {
-          if (gnutls_record_check_pending (ctx->session)
-              || select_fd (fd, 0, WAIT_FOR_READ))
-            ret = gnutls_record_recv (ctx->session, buf + offset,
-                                      bufsize - offset);
+          ret = gnutls_record_recv (ctx->session, buf + offset,
+                                    bufsize - offset);
         }
       while (ret == GNUTLS_E_INTERRUPTED);
 
+      if (ret < 0)
+        return ret;
+
       if (ret > 0)
         {
           memcpy (ctx->peekbuf + offset, buf + offset,