diff --git a/ChangeLog b/ChangeLog index dd9b2803..793c3148 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2007-12-01 Tatsuhiro Tsujikawa + + Fixed the bug#1841757: aria2 will connect to server to only get + file size. + * src/StreamFileAllocationEntry.cc + * src/option_processing.cc + * src/HttpResponseCommand.cc: Now reuse connection in segmented + downloads. + * src/FtpNegotiationCommand.cc + + Suppressed wrong message when finding PreDownloadHandler + * src/RequestGroup.cc + 2007-11-29 Tatsuhiro Tsujikawa Updated usage @@ -20,7 +33,7 @@ * test/MetaFileUtilTest.cc * test/PStringBuildVisitorTest.cc - Fixed bug: --check-integrity dones't work for multi file torrent. + Fixed bug: --check-integrity doesn't work for multi file torrent. * src/RequestGroup.cc * src/BtCheckIntegrityEntry.cc diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc index b1808534..28011751 100644 --- a/src/FtpNegotiationCommand.cc +++ b/src/FtpNegotiationCommand.cc @@ -76,8 +76,15 @@ bool FtpNegotiationCommand::executeInternal() { command->setLowestDownloadSpeedLimit(e->option->getAsInt(PREF_LOWEST_SPEED_LIMIT)); e->commands.push_back(command); return true; - } else if(sequence == SEQ_HEAD_OK || sequence == SEQ_DOWNLOAD_ALREADY_COMPLETED || sequence == SEQ_FILE_PREPARATION) { + } else if(sequence == SEQ_HEAD_OK || sequence == SEQ_DOWNLOAD_ALREADY_COMPLETED) { return true; + } else if(sequence == SEQ_FILE_PREPARATION) { + if(e->option->get(PREF_FTP_PASV) == V_TRUE) { + sequence = SEQ_SEND_PASV; + } else { + sequence = SEQ_SEND_PORT; + } + return false; } else { e->commands.push_back(this); return false; @@ -228,10 +235,14 @@ bool FtpNegotiationCommand::recvSize() { return false; } _requestGroup->loadAndOpenFile(infoFile); - prepareForNextAction(); + + prepareForNextAction(this); sequence = SEQ_FILE_PREPARATION; - e->noWait = true; + disableReadCheckSocket(); + setWriteCheckSocket(dataSocket); + + //e->noWait = true; return false; } else { _requestGroup->validateTotalLength(size); diff --git a/src/HttpResponseCommand.cc b/src/HttpResponseCommand.cc index c60f3999..70b011aa 100644 --- a/src/HttpResponseCommand.cc +++ b/src/HttpResponseCommand.cc @@ -132,7 +132,9 @@ bool HttpResponseCommand::handleDefaultEncoding(const HttpResponseHandle& httpRe try { _requestGroup->loadAndOpenFile(infoFile); File file(_requestGroup->getFilePath()); - if(_requestGroup->getRemainingUris().empty() && !file.exists()) { + + SegmentHandle segment = _requestGroup->getSegmentMan()->getSegment(cuid, 0); + if(!segment.isNull() && segment->getPositionToWrite() == 0) { command = createHttpDownloadCommand(httpResponse); } prepareForNextAction(command); diff --git a/src/RequestGroup.cc b/src/RequestGroup.cc index c989b5c9..3912cca8 100644 --- a/src/RequestGroup.cc +++ b/src/RequestGroup.cc @@ -566,7 +566,7 @@ void RequestGroup::preDownloadProcessing() itr != _preDownloadHandlers.end(); ++itr) { if((*itr)->canHandle(this)) { (*itr)->execute(this); - break; + return; } } } catch(RecoverableException* ex) { diff --git a/src/StreamFileAllocationEntry.cc b/src/StreamFileAllocationEntry.cc index cfa34a83..1bd9d92f 100644 --- a/src/StreamFileAllocationEntry.cc +++ b/src/StreamFileAllocationEntry.cc @@ -57,6 +57,9 @@ Commands StreamFileAllocationEntry::prepareForNextAction(DownloadEngine* e) if(_timer.difference() <= e->option->getAsInt(PREF_DIRECT_DOWNLOAD_TIMEOUT) && _nextCommand) { commands.push_back(popNextCommand()); + // try remaining uris + Commands streamCommands = _requestGroup->createNextCommandWithAdj(e, -1); + copy(streamCommands.begin(), streamCommands.end(), back_inserter(commands)); } else { if(_currentRequest.isNull()) { commands = _requestGroup->createNextCommandWithAdj(e, 0); diff --git a/src/option_processing.cc b/src/option_processing.cc index eae3e0aa..0b2917e7 100644 --- a/src/option_processing.cc +++ b/src/option_processing.cc @@ -118,7 +118,7 @@ Option* option_processing(int argc, char* const argv[]) op->put(PREF_USER_AGENT, "aria2"); op->put(PREF_NO_NETRC, V_FALSE); op->put(PREF_MAX_CONCURRENT_DOWNLOADS, "5"); - op->put(PREF_DIRECT_DOWNLOAD_TIMEOUT, "15"); + op->put(PREF_DIRECT_DOWNLOAD_TIMEOUT, "300"); op->put(PREF_FORCE_SEQUENTIAL, V_FALSE); op->put(PREF_AUTO_FILE_RENAMING, V_TRUE); op->put(PREF_PARAMETERIZED_URI, V_FALSE);