浏览代码

2008-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Fixed the bug that causes segmentaion fault when resuming 
download
	using metalink without size tag. Reproducible only using HTTP 
URI.
	* src/HttpResponseCommand.cc
	* src/FtpNegotiationCommand.cc
Tatsuhiro Tsujikawa 17 年之前
父节点
当前提交
e5730839cc
共有 3 个文件被更改,包括 23 次插入2 次删除
  1. 7 0
      ChangeLog
  2. 5 1
      src/FtpNegotiationCommand.cc
  3. 11 1
      src/HttpResponseCommand.cc

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2008-08-03  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Fixed the bug that causes segmentaion fault when resuming download
+	using metalink without size tag. Reproducible only using HTTP URI.
+	* src/HttpResponseCommand.cc
+	* src/FtpNegotiationCommand.cc
+
 2008-08-01  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	* Release 0.15.1

+ 5 - 1
src/FtpNegotiationCommand.cc

@@ -88,7 +88,11 @@ bool FtpNegotiationCommand::executeInternal() {
     command->setStartupIdleTime(e->option->getAsInt(PREF_STARTUP_IDLE_TIME));
     command->setLowestDownloadSpeedLimit(e->option->getAsInt(PREF_LOWEST_SPEED_LIMIT));
     if(!_requestGroup->isSingleHostMultiConnectionEnabled()) {
-      _requestGroup->removeURIWhoseHostnameIs(_requestGroup->searchServerHost(cuid)->getHostname());
+      SharedHandle<ServerHost> sv =
+	_requestGroup->searchServerHost(req->getHost());
+      if(!sv.isNull()) {
+	_requestGroup->removeURIWhoseHostnameIs(sv->getHostname());
+      }
     }
     e->commands.push_back(command);
     return true;

+ 11 - 1
src/HttpResponseCommand.cc

@@ -95,7 +95,17 @@ bool HttpResponseCommand::executeInternal()
   }
 
   if(!_requestGroup->isSingleHostMultiConnectionEnabled()) {
-    _requestGroup->removeURIWhoseHostnameIs(_requestGroup->searchServerHost(cuid)->getHostname());
+    // Query by hostname. Searching by CUID may returns NULL.
+    // In case when resuming download, ServerHost is registered with CUID A.
+    // Then if requested range is not equal to saved one,
+    // StreamFileAllocationEntry is created with _nextCommand NULL and
+    // _currentRequest not NULL. This results creating new command CUID, say
+    // B and same URI. So searching ServerHost by CUID B fails.
+    SharedHandle<ServerHost> sv =
+      _requestGroup->searchServerHost(req->getHost());
+    if(!sv.isNull()) {
+      _requestGroup->removeURIWhoseHostnameIs(sv->getHostname());
+    }
   }
   if(_requestGroup->getPieceStorage().isNull()) {
     uint64_t totalLength = httpResponse->getEntityLength();