]> granicus.if.org Git - curl/commitdiff
Fixed some problems with SFTP range support to fix test cases 634 through 637.
authorDan Fandrich <dan@coneharvesters.com>
Tue, 21 Oct 2008 07:10:25 +0000 (07:10 +0000)
committerDan Fandrich <dan@coneharvesters.com>
Tue, 21 Oct 2008 07:10:25 +0000 (07:10 +0000)
CHANGES
TODO-RELEASE
lib/ssh.c
tests/data/DISABLED

diff --git a/CHANGES b/CHANGES
index af237e1b5a69b828b6499ffded6cb4f75a1ebb3b..9a42f0a267e3c388f45298d735e4ecda2b302610 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,10 @@
 
                                   Changelog
 
+Daniel Fandrich (21 Oct 2008)
+- Fixed some problems with SFTP range support to fix test cases 634 through
+  637.
+
 Daniel Fandrich (17 Oct 2008)
 - Fixed a compile error reported by Albert Chin on AIX and IRIX when using
   GTLS.
index 36a22ed2d3257a4374558d0ce6624cc46f5c1314..282fa99792dc1abd9bcf264152857e29206a8e40 100644 (file)
@@ -15,8 +15,6 @@ Awaiting feedback, updates or removal:
 
 182 -  Make CURLINFO_LASTSOCKET accessible during perform
 
-187 -  Failing SFTP range tests cases 634 through 637
-
 Patches pending commit:
 
 183 - "libcurl issue with IPv6 and c-ares"
index 005eb265fd34ad4b71dbfe1acc01459a2d8fd9ac..19b685f30436bbdf61bf4b179033133de9153dd7 100644 (file)
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -1644,11 +1644,21 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
         while(ptr && *ptr && (isspace((int)*ptr) || (*ptr=='-')))
           ptr++;
         to=curlx_strtoofft(ptr, &ptr2, 0);
-        if ((ptr == ptr2) /* no "to" value given */
-            || (to > size)) {
-          to = size;
+        if((ptr == ptr2) /* no "to" value given */
+            || (to >= size)) {
+          to = size - 1;
         }
-        if (from > to) {
+        if(from < 0) {
+          /* from is relative to end of file */
+          from += size;
+        }
+        if(from >= size) {
+          failf(data, "Offset (%"
+                FORMAT_OFF_T ") was beyond file size (%" FORMAT_OFF_T ")",
+                from, attrs.filesize);
+          return CURLE_BAD_DOWNLOAD_RESUME;
+        }
+        if(from > to) {
           from = to;
           size = 0;
         }
index 012450fb0e608244ed91b49db2e0df8d30eb785d..2055e9f1670f2b6663fddf8530ef06aed5cce807 100644 (file)
@@ -3,7 +3,3 @@
 # 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.
-634
-635
-636
-637