]> granicus.if.org Git - curl/commitdiff
- Fixed the problem with doing a zero byte SCP transfer, verified with test
authorDaniel Stenberg <daniel@haxx.se>
Sat, 22 Mar 2008 22:00:21 +0000 (22:00 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 22 Mar 2008 22:00:21 +0000 (22:00 +0000)
  case 617 (which was added by Daniel Fandrich 5 Mar 2008).

CHANGES
RELEASE-NOTES
TODO-RELEASE
lib/transfer.c
tests/data/DISABLED

diff --git a/CHANGES b/CHANGES
index 896077a51f63e74091f6454b96a009a6b5315dd0..7191f2ce39e92415bf39a68eda2db43004911a70 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,10 @@
 
                                   Changelog
 
+Daniel Stenberg (22 Mar 2008)
+- Fixed the problem with doing a zero byte SCP transfer, verified with test
+  case 617 (which was added by Daniel Fandrich 5 Mar 2008).
+
 Daniel Fandrich (20 Mar 2008)
 - Fixed a problem where curl-config --protocols could erroneously show LDAPS
   support when curl didn't even have regular LDAP support.  It looks like
index 41c1c95e62163962efeae59a3324869734835afe..c34d38896d4cfe7fe349ff42cb03b70ac89ce7a5 100644 (file)
@@ -50,6 +50,7 @@ This release includes the following bugfixes:
  o SFTP upload with CURLOPT_FTP_CREATE_MISSING_DIRS on re-used connection
  o SFTP infinite loop when given an invalid quote command
  o curl-config erroneously reported LDAPS support with missing LDAP libraries
+ o SCP infinite loop when downloading a zero byte file
 
 This release includes the following known bugs:
 
index bd877aaa1c44cd892cf7dfffe13595180b53fe67..75b7402e8c2a392d9e368e24e5fc5d3f4f057b69 100644 (file)
@@ -3,8 +3,6 @@ To be addressed before 7.18.1 (planned release: April 2008)
 
 [feature freeze entered, no new features!]
 
-126 - scp download 0 bytes, test case 617
-
 127 - Dan Petitt's Progress During Large Posts problem
 
 128 - Phil Blundell's ares and ipv6 fix
index 9918a015d47ed8e2ef56f0c87bf30e62eaa10ac0..0856d2a551b6b70a052befedc6576b495c7a4051 100644 (file)
@@ -397,18 +397,26 @@ CURLcode Curl_readwrite(struct connectdata *conn,
             bytestoread = (size_t)totalleft;
         }
 
-        /* receive data from the network! */
-        readrc = Curl_read(conn, conn->sockfd, k->buf, bytestoread, &nread);
+        if(bytestoread) {
+          /* receive data from the network! */
+          readrc = Curl_read(conn, conn->sockfd, k->buf, bytestoread, &nread);
 
-        /* subzero, this would've blocked */
-        if(0 > readrc)
-          break; /* get out of loop */
+          /* subzero, this would've blocked */
+          if(0 > readrc)
+            break; /* get out of loop */
 
-        /* get the CURLcode from the int */
-        result = (CURLcode)readrc;
+          /* get the CURLcode from the int */
+          result = (CURLcode)readrc;
 
-        if(result>0)
-          return result;
+          if(result>0)
+            return result;
+        }
+        else {
+          /* read nothing but since we wanted nothing we consider this an OK
+             situation to proceed from */
+          nread = 0;
+          result = CURLE_OK;
+        }
 
         if((k->bytecount == 0) && (k->writebytecount == 0)) {
           Curl_pgrsTime(data, TIMER_STARTTRANSFER);
index eb8bc31901e2881ac201774a921b4f3c7bd242c7..fb3ae0ec927f147df75ce201deea81825a1fde3b 100644 (file)
@@ -3,4 +3,4 @@
 # test cases are run by runtests.pl. Just add the plain test case numbers, one
 # per line.
 # Lines starting with '#' letters are treated as comments.
-617
+