mirror of https://github.com/aria2/aria2
2007-12-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added --allow-piece-length-change option. * src/DefaultBtProgressInfoFile.cc * test/DefaultBtProgressInfoFileTest.cc * src/OptionHandlerFactory.cc * src/option_processing.cc * src/prefs.h * src/version_usage.cc * doc/aria2c.1.txt * doc/aria2c.1 Fixed: duplicated result entry appears when exception is thrown in RequestGroup::createInitiateConnectionCommand(). * src/RequestGroupMan.cc (fillRequestGroupFromReserver): Add RequestGroup to _requestGroup after RequetGroup:: createInitiateConnectionCommand() succeeds. Externalized message * src/XML2SAXMetalinkProcessor.cc * src/message.hpull/1/head
parent
ed3ebb7c22
commit
24bdbf9aa6
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
|||
2007-12-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Added --allow-piece-length-change option.
|
||||
* src/DefaultBtProgressInfoFile.cc
|
||||
* test/DefaultBtProgressInfoFileTest.cc
|
||||
* src/OptionHandlerFactory.cc
|
||||
* src/option_processing.cc
|
||||
* src/prefs.h
|
||||
* src/version_usage.cc
|
||||
* doc/aria2c.1.txt
|
||||
* doc/aria2c.1
|
||||
|
||||
Fixed: duplicated result entry appears when exception is thrown in
|
||||
RequestGroup::createInitiateConnectionCommand().
|
||||
* src/RequestGroupMan.cc (fillRequestGroupFromReserver):
|
||||
Add RequestGroup to _requestGroup after RequetGroup::
|
||||
createInitiateConnectionCommand() succeeds.
|
||||
|
||||
Externalized message
|
||||
* src/XML2SAXMetalinkProcessor.cc
|
||||
* src/message.h
|
||||
|
||||
2007-12-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Forced download abort when received negative response from http/ftp
|
||||
|
|
10
doc/aria2c.1
10
doc/aria2c.1
|
@ -1,11 +1,11 @@
|
|||
.\" Title: aria2c
|
||||
.\" Author:
|
||||
.\" Generator: DocBook XSL Stylesheets v1.73.1 <http://docbook.sf.net/>
|
||||
.\" Date: 11/29/2007
|
||||
.\" Date: 12/04/2007
|
||||
.\" Manual:
|
||||
.\" Source:
|
||||
.\"
|
||||
.TH "ARIA2C" "1" "11/29/2007" "" ""
|
||||
.TH "ARIA2C" "1" "12/04/2007" "" ""
|
||||
.\" disable hyphenation
|
||||
.nh
|
||||
.\" disable justification (adjust text to left margin only)
|
||||
|
@ -231,6 +231,12 @@ then, file name will be renamed\. See \-\-auto\-file\-renaming for details\. Def
|
|||
\fIfalse\fR
|
||||
.RE
|
||||
.PP
|
||||
\-\-allow\-piece\-length\-change=\fItrue\fR|\fIfalse\fR
|
||||
.RS 4
|
||||
If false is given, aria2 aborts download when a piece length is different from one in a control file\. If true is given, you can proceed but some download progress will be lost\. Default:
|
||||
\fIfalse\fR
|
||||
.RE
|
||||
.PP
|
||||
\-Z, \-\-force\-sequential[=\fItrue\fR|\fIfalse\fR]
|
||||
.RS 4
|
||||
Fetch URIs in the command\-line sequentially and download each URI in a separate session, like the usual command\-line download utilities\. Default:
|
||||
|
|
|
@ -147,6 +147,12 @@ OPTIONS
|
|||
file name will be renamed. See --auto-file-renaming for details.
|
||||
Default: 'false'
|
||||
|
||||
--allow-piece-length-change='true'|'false'::
|
||||
If false is given, aria2 aborts download when a piece length is different
|
||||
from one in a control file.
|
||||
If true is given, you can proceed but some download progress will be lost.
|
||||
Default: 'false'
|
||||
|
||||
-Z, --force-sequential[='true'|'false']::
|
||||
Fetch URIs in the command-line sequentially and download each URI in a
|
||||
separate session, like the usual command-line download utilities.
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "File.h"
|
||||
#include "Util.h"
|
||||
#include "a2io.h"
|
||||
#include "DownloadFailureException.h"
|
||||
#include <fstream>
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -256,8 +257,14 @@ void DefaultBtProgressInfoFile::load()
|
|||
}
|
||||
_pieceStorage->addInFlightPiece(inFlightPieces);
|
||||
} else {
|
||||
int32_t numInFlightPiece;
|
||||
in.read(reinterpret_cast<char*>(&numInFlightPiece), sizeof(numInFlightPiece));
|
||||
BitfieldMan src(pieceLength, totalLength);
|
||||
src.setBitfield(savedBitfield, bitfieldLength);
|
||||
if((src.getCompletedLength() || numInFlightPiece) &&
|
||||
!_option->getAsBool(PREF_ALLOW_PIECE_LENGTH_CHANGE)) {
|
||||
throw new DownloadFailureException("WARNING: Detected a change in piece length. You can proceed with --allow-piece-length-change=true, but you may lose some download progress.");
|
||||
}
|
||||
BitfieldMan dest(_dctx->getPieceLength(), totalLength);
|
||||
Util::convertBitfield(&dest, &src);
|
||||
_pieceStorage->setBitfield(dest.getBitfield(), dest.getBitfieldLength());
|
||||
|
|
|
@ -101,6 +101,7 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
|
|||
handlers.push_back(new BooleanOptionHandler(PREF_ENABLE_HTTP_PIPELINING));
|
||||
handlers.push_back(new UnitNumberOptionHandler(PREF_NO_FILE_ALLOCATION_LIMIT, 0));
|
||||
handlers.push_back(new BooleanOptionHandler(PREF_ENABLE_DIRECT_IO));
|
||||
handlers.push_back(new BooleanOptionHandler(PREF_ALLOW_PIECE_LENGTH_CHANGE));
|
||||
|
||||
return handlers;
|
||||
}
|
||||
|
|
|
@ -151,8 +151,8 @@ void RequestGroupMan::fillRequestGroupFromReserver(DownloadEngine* e)
|
|||
temp.push_front(groupToAdd);
|
||||
continue;
|
||||
}
|
||||
_requestGroups.push_back(groupToAdd);
|
||||
Commands commands = groupToAdd->createInitialCommand(e);
|
||||
_requestGroups.push_back(groupToAdd);
|
||||
++count;
|
||||
e->addCommand(commands);
|
||||
} catch(RecoverableException* ex) {
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "BinaryStream.h"
|
||||
#include "MetalinkParserStateMachine.h"
|
||||
#include "Util.h"
|
||||
#include "message.h"
|
||||
|
||||
class SessionData {
|
||||
public:
|
||||
|
@ -127,7 +128,7 @@ MetalinkerHandle XML2SAXMetalinkProcessor::parseFile(const string& filename)
|
|||
int32_t retval = xmlSAXUserParseFile(&mySAXHandler, sessionData.get(),
|
||||
filename.c_str());
|
||||
if(retval != 0) {
|
||||
throw new DlAbortEx("Cannot parse metalink XML file. XML may be malformed.");
|
||||
throw new DlAbortEx(MSG_CANNOT_PARSE_METALINK);
|
||||
}
|
||||
return _stm->getResult();
|
||||
}
|
||||
|
@ -153,7 +154,7 @@ MetalinkerHandle XML2SAXMetalinkProcessor::parseFromBinaryStream(const BinaryStr
|
|||
break;
|
||||
}
|
||||
if(xmlParseChunk(ctx, (const char*)buf, res, 0) != 0) {
|
||||
throw new DlAbortEx("Cannot parse metalink XML file. XML may be malformed.");
|
||||
throw new DlAbortEx(MSG_CANNOT_PARSE_METALINK);
|
||||
}
|
||||
readOffset += res;
|
||||
}
|
||||
|
@ -161,7 +162,7 @@ MetalinkerHandle XML2SAXMetalinkProcessor::parseFromBinaryStream(const BinaryStr
|
|||
xmlFreeParserCtxt(ctx);
|
||||
|
||||
if(!_stm->finished()) {
|
||||
throw new DlAbortEx("Cannot parse metalink XML file. XML may be malformed.");
|
||||
throw new DlAbortEx(MSG_CANNOT_PARSE_METALINK);
|
||||
}
|
||||
return _stm->getResult();
|
||||
}
|
||||
|
|
|
@ -130,6 +130,7 @@
|
|||
#define MSG_STRING_INTEGER_CONVERSION_FAILURE _("Failed to convert string into value: %s")
|
||||
#define MSG_RESOURCE_NOT_FOUND _("Resource not found")
|
||||
#define MSG_FILE_RENAMED _("File already exists. Renamed to %s.")
|
||||
#define MSG_CANNOT_PARSE_METALINK _("Cannot parse metalink XML file. XML may be malformed.")
|
||||
|
||||
#define EX_TIME_OUT _("Timeout.")
|
||||
#define EX_INVALID_CHUNK_SIZE _("Invalid chunk size.")
|
||||
|
|
|
@ -127,6 +127,7 @@ Option* option_processing(int argc, char* const argv[])
|
|||
op->put(PREF_MAX_HTTP_PIPELINING, "2");
|
||||
op->put(PREF_SEED_RATIO, "1.0");
|
||||
op->put(PREF_ENABLE_DIRECT_IO, V_FALSE);
|
||||
op->put(PREF_ALLOW_PIECE_LENGTH_CHANGE, V_FALSE);
|
||||
while(1) {
|
||||
int optIndex = 0;
|
||||
int lopt;
|
||||
|
@ -178,6 +179,7 @@ Option* option_processing(int argc, char* const argv[])
|
|||
#ifdef ENABLE_DIRECT_IO
|
||||
{ PREF_ENABLE_DIRECT_IO, optional_argument, &lopt, 210 },
|
||||
#endif // ENABLE_DIRECT_IO
|
||||
{ PREF_ALLOW_PIECE_LENGTH_CHANGE, required_argument, &lopt, 211 },
|
||||
#if defined ENABLE_BITTORRENT || ENABLE_METALINK
|
||||
{ "show-files", no_argument, NULL, 'S' },
|
||||
{ "select-file", required_argument, &lopt, 21 },
|
||||
|
@ -331,6 +333,9 @@ Option* option_processing(int argc, char* const argv[])
|
|||
case 210:
|
||||
cmdstream << PREF_ENABLE_DIRECT_IO << "=" << toBoolArg(optarg) << "\n";
|
||||
break;
|
||||
case 211:
|
||||
cmdstream << PREF_ALLOW_PIECE_LENGTH_CHANGE << "=" << optarg << "\n";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -117,6 +117,8 @@
|
|||
#define PREF_PARAMETERIZED_URI "parameterized-uri"
|
||||
// value: true | false
|
||||
#define PREF_ENABLE_DIRECT_IO "enable-direct-io"
|
||||
// value: true | false
|
||||
#define PREF_ALLOW_PIECE_LENGTH_CHANGE "allow-piece-length-change"
|
||||
|
||||
/**
|
||||
* FTP related preferences
|
||||
|
|
|
@ -171,9 +171,14 @@ void showUsage() {
|
|||
<< DEFAULT_MSG << "false" << "\n";
|
||||
#endif // ENABLE_DIRECT_IO
|
||||
cout << _(" --allow-overwrite=true|false If false, aria2 doesn't download a file which\n"
|
||||
" already exists but the corresponding .aria2 file\n"
|
||||
" doesn't exist.\n"
|
||||
" Default: false") << endl;
|
||||
" already exists but the corresponding .aria2 file\n"
|
||||
" doesn't exist.\n"
|
||||
" Default: false") << endl;
|
||||
cout << _(" --allow-piece-length-change=true|false If false is given, aria2 aborts download\n"
|
||||
" when a piece length is different from one in\n"
|
||||
" a control file. If true is given, you can proceed\n"
|
||||
" but some download progress will be lost.") << "\n"
|
||||
<< DEFAULT_MSG << "false" << "\n";
|
||||
cout << _(" -Z, --force-sequential[=true|false] Fetch URIs in the command-line sequentially\n"
|
||||
" and download each URI in a separate session, like\n"
|
||||
" the usual command-line download utilities.\n"
|
||||
|
|
|
@ -169,6 +169,7 @@ void DefaultBtProgressInfoFileTest::testLoad_nonBt()
|
|||
void DefaultBtProgressInfoFileTest::testLoad_nonBt_pieceLengthShorter()
|
||||
{
|
||||
initializeMembers(512, 81920);
|
||||
_option->put(PREF_ALLOW_PIECE_LENGTH_CHANGE, V_TRUE);
|
||||
|
||||
SingleFileDownloadContextHandle dctx =
|
||||
new SingleFileDownloadContext(512, 81920, "load-nonBt");
|
||||
|
|
Loading…
Reference in New Issue