From: wessels <> Date: Sat, 5 May 2007 06:14:17 +0000 (+0000) Subject: FTP will no longer send REST command if offset exceeds size. X-Git-Tag: SQUID_3_0_PRE6~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b0e52cb92a79010f084a8487e0cbaf6b7a4bf4ca;p=thirdparty%2Fsquid.git FTP will no longer send REST command if offset exceeds size. 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. --- diff --git a/src/ftp.cc b/src/ftp.cc index cce5f20887..62600f92e8 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -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 <<