]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
FTP will no longer send REST command if offset exceeds size.
authorwessels <>
Sat, 5 May 2007 06:14:17 +0000 (06:14 +0000)
committerwessels <>
Sat, 5 May 2007 06:14:17 +0000 (06:14 +0000)
Added a check to FtpState::restartable to detect when the desired
restart offset is greater than (or equal to) the size reported by
the server.  If the server didn't report a size, then we won't
send/set the restart offset either.

src/ftp.cc

index cce5f2088763f685e5d19e62a34fc7878cfed2ec..62600f92e87330e0a6d4797351eb8aa28925e1c4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.420 2007/05/04 23:46:42 wessels Exp $
+ * $Id: ftp.cc,v 1.421 2007/05/05 00:14:17 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -2684,11 +2684,15 @@ FtpStateData::restartable()
     if (size <= 0)
         return 0;
 
-    restart_offset = request->range->lowestOffset((size_t) size);
+    int desired_offset = request->range->lowestOffset((size_t) size);
 
-    if (restart_offset <= 0)
+    if (desired_offset <= 0)
         return 0;
 
+    if (desired_offset >= size)
+       return 0;
+
+    restart_offset = desired_offset;
     return 1;
 }
 
@@ -3169,7 +3173,10 @@ FtpStateData::appendSuccessHeader()
                           mime_type, size, mdtm, -2);
     } else if (size < restarted_offset) {
        /*
-        * offset should not be larger than size.
+        * DPW 2007-05-04
+        * offset should not be larger than size.  We should
+        * not be seeing this condition any more because we'll only
+        * send REST if we know the size and if it is less than size.
         */
        debugs(0,0,HERE << "Whoops! " <<
                " restarted_offset=" << restarted_offset <<