]> granicus.if.org Git - curl/commitdiff
No longer loop to read multiple times before returning back from the transfer
authorDaniel Stenberg <daniel@haxx.se>
Wed, 26 Feb 2003 12:42:25 +0000 (12:42 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 26 Feb 2003 12:42:25 +0000 (12:42 +0000)
function, as this could easily end up looping for a very long time (more or
less until the whole transfer was done) and no library-using app would want
that.

Found thanks to a report by Kyle Sallee.

lib/transfer.c

index 0d1d563bd053044d27c668cee0bc568df3f7a4e4..e863be4e17611f4adaf466e2064dd19176adeb29 100644 (file)
@@ -233,17 +233,16 @@ CURLcode Curl_readwrite(struct connectdata *conn,
     if((k->keepon & KEEP_READ) &&
        (FD_ISSET(conn->sockfd, readfdp))) {
 
-      bool readdone = FALSE;
+      bool readdone = TRUE;
 
       /* This is where we loop until we have read everything there is to
          read or we get a EWOULDBLOCK */
       do {
+        int buffersize = data->set.buffer_size?
+          data->set.buffer_size:BUFSIZE -1;
 
-        /* read! */
-        result = Curl_read(conn, conn->sockfd, k->buf,
-                           data->set.buffer_size?
-                           data->set.buffer_size:BUFSIZE -1,
-                           &nread);
+        /* receive data from the network! */
+        result = Curl_read(conn, conn->sockfd, k->buf, buffersize, &nread);
 
         if(0>result)
           break; /* get out of loop */