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>
|
2007-12-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
Forced download abort when received negative response from http/ftp
|
Forced download abort when received negative response from http/ftp
|
||||||
|
|
10
doc/aria2c.1
10
doc/aria2c.1
|
@ -1,11 +1,11 @@
|
||||||
.\" Title: aria2c
|
.\" Title: aria2c
|
||||||
.\" Author:
|
.\" Author:
|
||||||
.\" Generator: DocBook XSL Stylesheets v1.73.1 <http://docbook.sf.net/>
|
.\" Generator: DocBook XSL Stylesheets v1.73.1 <http://docbook.sf.net/>
|
||||||
.\" Date: 11/29/2007
|
.\" Date: 12/04/2007
|
||||||
.\" Manual:
|
.\" Manual:
|
||||||
.\" Source:
|
.\" Source:
|
||||||
.\"
|
.\"
|
||||||
.TH "ARIA2C" "1" "11/29/2007" "" ""
|
.TH "ARIA2C" "1" "12/04/2007" "" ""
|
||||||
.\" disable hyphenation
|
.\" disable hyphenation
|
||||||
.nh
|
.nh
|
||||||
.\" disable justification (adjust text to left margin only)
|
.\" 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
|
\fIfalse\fR
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.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]
|
\-Z, \-\-force\-sequential[=\fItrue\fR|\fIfalse\fR]
|
||||||
.RS 4
|
.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:
|
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.
|
file name will be renamed. See --auto-file-renaming for details.
|
||||||
Default: 'false'
|
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']::
|
-Z, --force-sequential[='true'|'false']::
|
||||||
Fetch URIs in the command-line sequentially and download each URI in a
|
Fetch URIs in the command-line sequentially and download each URI in a
|
||||||
separate session, like the usual command-line download utilities.
|
separate session, like the usual command-line download utilities.
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "a2io.h"
|
#include "a2io.h"
|
||||||
|
#include "DownloadFailureException.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
@ -256,8 +257,14 @@ void DefaultBtProgressInfoFile::load()
|
||||||
}
|
}
|
||||||
_pieceStorage->addInFlightPiece(inFlightPieces);
|
_pieceStorage->addInFlightPiece(inFlightPieces);
|
||||||
} else {
|
} else {
|
||||||
|
int32_t numInFlightPiece;
|
||||||
|
in.read(reinterpret_cast<char*>(&numInFlightPiece), sizeof(numInFlightPiece));
|
||||||
BitfieldMan src(pieceLength, totalLength);
|
BitfieldMan src(pieceLength, totalLength);
|
||||||
src.setBitfield(savedBitfield, bitfieldLength);
|
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);
|
BitfieldMan dest(_dctx->getPieceLength(), totalLength);
|
||||||
Util::convertBitfield(&dest, &src);
|
Util::convertBitfield(&dest, &src);
|
||||||
_pieceStorage->setBitfield(dest.getBitfield(), dest.getBitfieldLength());
|
_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 BooleanOptionHandler(PREF_ENABLE_HTTP_PIPELINING));
|
||||||
handlers.push_back(new UnitNumberOptionHandler(PREF_NO_FILE_ALLOCATION_LIMIT, 0));
|
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_ENABLE_DIRECT_IO));
|
||||||
|
handlers.push_back(new BooleanOptionHandler(PREF_ALLOW_PIECE_LENGTH_CHANGE));
|
||||||
|
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,8 +151,8 @@ void RequestGroupMan::fillRequestGroupFromReserver(DownloadEngine* e)
|
||||||
temp.push_front(groupToAdd);
|
temp.push_front(groupToAdd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_requestGroups.push_back(groupToAdd);
|
|
||||||
Commands commands = groupToAdd->createInitialCommand(e);
|
Commands commands = groupToAdd->createInitialCommand(e);
|
||||||
|
_requestGroups.push_back(groupToAdd);
|
||||||
++count;
|
++count;
|
||||||
e->addCommand(commands);
|
e->addCommand(commands);
|
||||||
} catch(RecoverableException* ex) {
|
} catch(RecoverableException* ex) {
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "BinaryStream.h"
|
#include "BinaryStream.h"
|
||||||
#include "MetalinkParserStateMachine.h"
|
#include "MetalinkParserStateMachine.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
#include "message.h"
|
||||||
|
|
||||||
class SessionData {
|
class SessionData {
|
||||||
public:
|
public:
|
||||||
|
@ -127,7 +128,7 @@ MetalinkerHandle XML2SAXMetalinkProcessor::parseFile(const string& filename)
|
||||||
int32_t retval = xmlSAXUserParseFile(&mySAXHandler, sessionData.get(),
|
int32_t retval = xmlSAXUserParseFile(&mySAXHandler, sessionData.get(),
|
||||||
filename.c_str());
|
filename.c_str());
|
||||||
if(retval != 0) {
|
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();
|
return _stm->getResult();
|
||||||
}
|
}
|
||||||
|
@ -153,7 +154,7 @@ MetalinkerHandle XML2SAXMetalinkProcessor::parseFromBinaryStream(const BinaryStr
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(xmlParseChunk(ctx, (const char*)buf, res, 0) != 0) {
|
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;
|
readOffset += res;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +162,7 @@ MetalinkerHandle XML2SAXMetalinkProcessor::parseFromBinaryStream(const BinaryStr
|
||||||
xmlFreeParserCtxt(ctx);
|
xmlFreeParserCtxt(ctx);
|
||||||
|
|
||||||
if(!_stm->finished()) {
|
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();
|
return _stm->getResult();
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,6 +130,7 @@
|
||||||
#define MSG_STRING_INTEGER_CONVERSION_FAILURE _("Failed to convert string into value: %s")
|
#define MSG_STRING_INTEGER_CONVERSION_FAILURE _("Failed to convert string into value: %s")
|
||||||
#define MSG_RESOURCE_NOT_FOUND _("Resource not found")
|
#define MSG_RESOURCE_NOT_FOUND _("Resource not found")
|
||||||
#define MSG_FILE_RENAMED _("File already exists. Renamed to %s.")
|
#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_TIME_OUT _("Timeout.")
|
||||||
#define EX_INVALID_CHUNK_SIZE _("Invalid chunk size.")
|
#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_MAX_HTTP_PIPELINING, "2");
|
||||||
op->put(PREF_SEED_RATIO, "1.0");
|
op->put(PREF_SEED_RATIO, "1.0");
|
||||||
op->put(PREF_ENABLE_DIRECT_IO, V_FALSE);
|
op->put(PREF_ENABLE_DIRECT_IO, V_FALSE);
|
||||||
|
op->put(PREF_ALLOW_PIECE_LENGTH_CHANGE, V_FALSE);
|
||||||
while(1) {
|
while(1) {
|
||||||
int optIndex = 0;
|
int optIndex = 0;
|
||||||
int lopt;
|
int lopt;
|
||||||
|
@ -178,6 +179,7 @@ Option* option_processing(int argc, char* const argv[])
|
||||||
#ifdef ENABLE_DIRECT_IO
|
#ifdef ENABLE_DIRECT_IO
|
||||||
{ PREF_ENABLE_DIRECT_IO, optional_argument, &lopt, 210 },
|
{ PREF_ENABLE_DIRECT_IO, optional_argument, &lopt, 210 },
|
||||||
#endif // ENABLE_DIRECT_IO
|
#endif // ENABLE_DIRECT_IO
|
||||||
|
{ PREF_ALLOW_PIECE_LENGTH_CHANGE, required_argument, &lopt, 211 },
|
||||||
#if defined ENABLE_BITTORRENT || ENABLE_METALINK
|
#if defined ENABLE_BITTORRENT || ENABLE_METALINK
|
||||||
{ "show-files", no_argument, NULL, 'S' },
|
{ "show-files", no_argument, NULL, 'S' },
|
||||||
{ "select-file", required_argument, &lopt, 21 },
|
{ "select-file", required_argument, &lopt, 21 },
|
||||||
|
@ -331,6 +333,9 @@ Option* option_processing(int argc, char* const argv[])
|
||||||
case 210:
|
case 210:
|
||||||
cmdstream << PREF_ENABLE_DIRECT_IO << "=" << toBoolArg(optarg) << "\n";
|
cmdstream << PREF_ENABLE_DIRECT_IO << "=" << toBoolArg(optarg) << "\n";
|
||||||
break;
|
break;
|
||||||
|
case 211:
|
||||||
|
cmdstream << PREF_ALLOW_PIECE_LENGTH_CHANGE << "=" << optarg << "\n";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,8 @@
|
||||||
#define PREF_PARAMETERIZED_URI "parameterized-uri"
|
#define PREF_PARAMETERIZED_URI "parameterized-uri"
|
||||||
// value: true | false
|
// value: true | false
|
||||||
#define PREF_ENABLE_DIRECT_IO "enable-direct-io"
|
#define PREF_ENABLE_DIRECT_IO "enable-direct-io"
|
||||||
|
// value: true | false
|
||||||
|
#define PREF_ALLOW_PIECE_LENGTH_CHANGE "allow-piece-length-change"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FTP related preferences
|
* FTP related preferences
|
||||||
|
|
|
@ -174,6 +174,11 @@ void showUsage() {
|
||||||
" already exists but the corresponding .aria2 file\n"
|
" already exists but the corresponding .aria2 file\n"
|
||||||
" doesn't exist.\n"
|
" doesn't exist.\n"
|
||||||
" Default: false") << endl;
|
" 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"
|
cout << _(" -Z, --force-sequential[=true|false] Fetch URIs in the command-line sequentially\n"
|
||||||
" and download each URI in a separate session, like\n"
|
" and download each URI in a separate session, like\n"
|
||||||
" the usual command-line download utilities.\n"
|
" the usual command-line download utilities.\n"
|
||||||
|
|
|
@ -169,6 +169,7 @@ void DefaultBtProgressInfoFileTest::testLoad_nonBt()
|
||||||
void DefaultBtProgressInfoFileTest::testLoad_nonBt_pieceLengthShorter()
|
void DefaultBtProgressInfoFileTest::testLoad_nonBt_pieceLengthShorter()
|
||||||
{
|
{
|
||||||
initializeMembers(512, 81920);
|
initializeMembers(512, 81920);
|
||||||
|
_option->put(PREF_ALLOW_PIECE_LENGTH_CHANGE, V_TRUE);
|
||||||
|
|
||||||
SingleFileDownloadContextHandle dctx =
|
SingleFileDownloadContextHandle dctx =
|
||||||
new SingleFileDownloadContext(512, 81920, "load-nonBt");
|
new SingleFileDownloadContext(512, 81920, "load-nonBt");
|
||||||
|
|
Loading…
Reference in New Issue