Procházet zdrojové kódy

2010-09-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

	Updated doc
	* src/FtpNegotiationCommand.cc
	* src/HttpResponseCommand.cc
	* src/RequestGroup.cc
Tatsuhiro Tsujikawa před 15 roky
rodič
revize
7f9e70e5c8
4 změnil soubory, kde provedl 19 přidání a 3 odebrání
  1. 7 0
      ChangeLog
  2. 5 2
      src/FtpNegotiationCommand.cc
  3. 5 1
      src/HttpResponseCommand.cc
  4. 2 0
      src/RequestGroup.cc

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2010-09-13  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
+
+	Updated doc
+	* src/FtpNegotiationCommand.cc
+	* src/HttpResponseCommand.cc
+	* src/RequestGroup.cc
+
 2010-09-13  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
 
 	Fixed the bug that error occurs when downloading zero-length file.

+ 5 - 2
src/FtpNegotiationCommand.cc

@@ -405,10 +405,13 @@ bool FtpNegotiationCommand::onFileSizeDetermined(uint64_t totalLength)
 
     if(getDownloadContext()->knowsTotalLength() &&
        getRequestGroup()->downloadFinishedByFileLength()) {
+      // TODO If metalink file does not contain size and it contains
+      // hash and file is not zero length, but remote server says the
+      // file size is 0, no hash check is performed in the current
+      // implementation. See also
+      // HttpResponseCommand::handleOtherEncoding()
       getRequestGroup()->initPieceStorage();
       getPieceStorage()->markAllPiecesDone();
-      // TODO It would be good to issue ChecksumCheckIntegrity here
-      // instead of just pretending checksum verification is done.
       getDownloadContext()->setChecksumVerified(true);
       sequence_ = SEQ_DOWNLOAD_ALREADY_COMPLETED;
       getLogger()->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,

+ 5 - 1
src/HttpResponseCommand.cc

@@ -390,9 +390,13 @@ bool HttpResponseCommand::handleOtherEncoding
   // For zero-length file, check existing file comparing its size
   if(!chunkedUsed && getDownloadContext()->knowsTotalLength() &&
      getRequestGroup()->downloadFinishedByFileLength()) {
+    // TODO If metalink file does not contain size and it contains
+    // hash and file is not zero length, but remote server says the
+    // file size is 0, no hash check is performed in the current
+    // implementation. See also
+    // FtpNegotiationCommand::onFileSizeDetermined()
     getRequestGroup()->initPieceStorage();
     getPieceStorage()->markAllPiecesDone();
-    // This is zero-size file, so hash check is no use.
     getDownloadContext()->setChecksumVerified(true);
     getLogger()->notice(MSG_DOWNLOAD_ALREADY_COMPLETED,
                         util::itos(getRequestGroup()->getGID()).c_str(),

+ 2 - 0
src/RequestGroup.cc

@@ -542,6 +542,8 @@ void RequestGroup::initPieceStorage()
 {
   SharedHandle<PieceStorage> tempPieceStorage;
   if(downloadContext_->knowsTotalLength() &&
+     // Following conditions are needed for chunked encoding with
+     // content-length = 0. Google's dl server used this before.
      (downloadContext_->getTotalLength() > 0
 #ifdef ENABLE_BITTORRENT
       || downloadContext_->hasAttribute(bittorrent::BITTORRENT)