summaryrefslogtreecommitdiff
path: root/src/HttpResponseCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-08-03 11:16:15 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-08-03 11:16:15 +0000
commite5730839cca71dc11e0e8a1f89b458af8edc729a (patch)
treeb007ab47df2772afb49a110edddbf58e0d5b5494 /src/HttpResponseCommand.cc
parent374083fb085fd48a969c92346ad95d931fd171ac (diff)
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
Diffstat (limited to 'src/HttpResponseCommand.cc')
-rw-r--r--src/HttpResponseCommand.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/HttpResponseCommand.cc b/src/HttpResponseCommand.cc
index ddf3acdb..929d7992 100644
--- a/src/HttpResponseCommand.cc
+++ b/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();