2006-02-17 13:35:04 +00:00
|
|
|
/* <!-- copyright */
|
|
|
|
/*
|
2006-09-21 15:31:24 +00:00
|
|
|
* aria2 - The high speed download utility
|
2006-02-17 13:35:04 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Tatsuhiro Tsujikawa
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2006-09-21 15:31:24 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
* In addition, as a special exception, the copyright holders give
|
|
|
|
* permission to link the code of portions of this program with the
|
|
|
|
* OpenSSL library under certain conditions as described in each
|
|
|
|
* individual source file, and distribute linked combinations
|
|
|
|
* including the two.
|
|
|
|
* You must obey the GNU General Public License in all respects
|
|
|
|
* for all of the code used other than OpenSSL. If you modify
|
|
|
|
* file(s) with this exception, you may extend this exception to your
|
|
|
|
* version of the file(s), but you are not obligated to do so. If you
|
|
|
|
* do not wish to do so, delete this exception statement from your
|
|
|
|
* version. If you delete this exception statement from all source
|
|
|
|
* files in the program, then also delete it here.
|
2006-02-17 13:35:04 +00:00
|
|
|
*/
|
|
|
|
/* copyright --> */
|
|
|
|
#include "common.h"
|
2007-03-21 10:19:23 +00:00
|
|
|
#include "LogFactory.h"
|
2006-02-17 13:35:04 +00:00
|
|
|
#include "Util.h"
|
2006-02-21 14:00:58 +00:00
|
|
|
#include "prefs.h"
|
2006-07-30 12:58:27 +00:00
|
|
|
#include "FeatureConfig.h"
|
2007-05-20 13:51:52 +00:00
|
|
|
#include "MultiUrlRequestInfo.h"
|
2006-08-07 16:05:00 +00:00
|
|
|
#include "TorrentRequestInfo.h"
|
2006-12-24 06:25:21 +00:00
|
|
|
#include "BitfieldManFactory.h"
|
|
|
|
#include "SimpleRandomizer.h"
|
2007-01-08 00:13:25 +00:00
|
|
|
#include "ConsoleFileAllocationMonitor.h"
|
2007-03-18 15:42:34 +00:00
|
|
|
#include "Netrc.h"
|
2007-03-21 10:19:23 +00:00
|
|
|
#include "RequestFactory.h"
|
2007-03-26 12:16:57 +00:00
|
|
|
#include "OptionParser.h"
|
|
|
|
#include "OptionHandlerFactory.h"
|
|
|
|
#include "FatalException.h"
|
|
|
|
#include "File.h"
|
2007-05-20 13:51:52 +00:00
|
|
|
#include "CUIDCounter.h"
|
2007-07-05 15:45:03 +00:00
|
|
|
#include "FileUriListParser.h"
|
|
|
|
#include "StreamUriListParser.h"
|
2007-06-10 07:55:43 +00:00
|
|
|
#include "CookieBoxFactory.h"
|
2007-07-02 12:40:40 +00:00
|
|
|
#include "a2algo.h"
|
2007-07-05 15:14:00 +00:00
|
|
|
#include "message.h"
|
2006-03-22 16:21:11 +00:00
|
|
|
#include <deque>
|
2006-02-17 13:35:04 +00:00
|
|
|
#include <algorithm>
|
2006-03-21 14:12:51 +00:00
|
|
|
#include <time.h>
|
2006-02-17 13:35:04 +00:00
|
|
|
#include <signal.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <libgen.h>
|
|
|
|
#include <utility>
|
2007-03-26 12:16:57 +00:00
|
|
|
#include <fstream>
|
|
|
|
#include <sstream>
|
2006-02-17 13:35:04 +00:00
|
|
|
extern char* optarg;
|
|
|
|
extern int optind, opterr, optopt;
|
|
|
|
#include <getopt.h>
|
|
|
|
|
2006-08-21 13:31:49 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
|
|
|
#include "MetalinkRequestInfo.h"
|
|
|
|
#include "Xml2MetalinkProcessor.h"
|
|
|
|
#endif
|
|
|
|
|
2006-02-17 18:51:12 +00:00
|
|
|
#ifdef HAVE_LIBSSL
|
|
|
|
// for SSL
|
|
|
|
# include <openssl/err.h>
|
|
|
|
# include <openssl/ssl.h>
|
|
|
|
#endif // HAVE_LIBSSL
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* configure.in: Added gnutls support. Added several CPP macros.
* m4/openssl.m4: Added.
* src/SocketCore.{h,cc}: Drop const quarifier from writeData(),
readData(), peekData(). Added gnutls support.
* src/HttpDownloadCommand.cc: Removed SleepCommand.h
* src/TrackerWatcherCommand.{h,cc}: Added. This command creates
TrackerInitCommand periodicaly(TorrentMan::minInterval).
* src/TorrentMan.cc: Remove downloadedSize == 0 check from
save().
Instead, added a check for whether setup method has executed
successfully.
* src/TorrentMan.h: Added member vaiable setupComplete. Updated
DEFAULT_ANNOUNCE_INTERVAL and DEFAULT_ANNOUNCE_MIN_INTERVAL to
300.
* src/Makefile.am: Updated.
* src/messageDigest.h: Added. This is a macro calculating SHA1
digest
using whether OpenSSL or gcrypt, depending on the result of
configure
script.
* src/ShaVisitor.{h,cc}: Removed direct dependency on OpenSSL by
using
messageDigest.h.
* src/TorrentAutoSaveCommand.h: Removed unused variable cuid.
* src/PeerListenCommand.cc: Added log about port binded
successfully.
Fixed memory leak.
* src/main.cc: Added gnutls support. Replaced LIB_SSL with
ENABLE_BITTORRENT where they are not related to OpenSSL but
BitTorrent.
Removed instantiation of TrackerInitCommand. Instead,
TrackerWatcherCommand is instantiated and pushed to the command
queue.
* src/InitiateConnectionCommandFactory.cc: Replaced HAVE_LIBSSL
with
ENABLE_SSL.
* src/Request.cc: Replaced HAVE_LIBSSL with ENABLE_SSL.
* src/RequestSlotMan.cc:
(deleteCompletedRequestSlot)
If a piece is already acquired by another command, delete the
request
slots for the piece.
* src/TrackerUpdateCommand.cc:
(execute)
Changed log level of MSG_TRACKER_WARNING_MESSAGE from info to
warn.
Added a check whether peer list is null.
Fixed the bug that causes sending completed event to the tracker
several times.
* src/TrackerInitCommand.cc:
(execute)
Fixed the bug that causes sending completed event to the tracker
several times.
* src/AbstractDiskWriter.{h,cc}: Removed direct dependency on
OpenSSL
by using messageDigest.h.
2006-03-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* PeerConnection.cc: Replaced log message "keep-alive" with
"keep alive".
* PeerInteractionCommand.{h,cc}: Close connection if peer is
choking
localhost long time.
* TorrentMan.cc: When adding new peer with duplicate = true, if
the
number of peer list is equal to or grater than MAX_PEER_LIST,
delete
at most 100 failure entry from the list. If with duplicate =
false,
MAX_PEER_LIST is not checked.
* PeerListenCommand.cc: Fixed the argument order of log message.
2006-03-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* Logger.h: Moved enum LEVEL from SimpleLogger.h to here.
Added warn().
* SimpleLogger.h: Moved enum LEVEL to Logger.h.
Implemented warn().
Defined 2 macros(WRITE_LOG, WRITE_LOG_EX) to avoid duplicated
code.
2006-03-27 14:47:26 +00:00
|
|
|
#ifdef HAVE_LIBGNUTLS
|
|
|
|
# include <gnutls/gnutls.h>
|
|
|
|
#endif // HAVE_LIBGNUTLS
|
2006-02-17 18:51:12 +00:00
|
|
|
|
2006-02-17 13:35:04 +00:00
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
void showVersion() {
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << PACKAGE << _(" version ") << PACKAGE_VERSION << endl;
|
2006-07-30 12:58:27 +00:00
|
|
|
cout << "**Configuration**" << endl;
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Option.h
(getAsBool): New function.
* src/Option.cc
(prefs.h): Included.
(defined): 0-length value is now recognized as undefined.
(getAsInt): Rewritten.
(getAsLLInt): Rewritten.
(getAsBool): New function.
* src/FeatureConfig.h: Rewritten.
* src/FeatureConfig.cc: Rewritten.
* src/prefs.h
(PREF_STDOUT_LOG): New definition.
(PREF_LOG): New definition.
(PREF_DIR): New definition.
(PREF_OUT): New definition.
(PREF_SPLIT): New definition.
(PREF_DAEMON): New definition.
(PREF_REFERER): New definition.
(PREF_TORRENT_FILE): New definition.
(PREF_LISTEN_PORT): New definition.
(PREF_METALINK_FILE): New definition.
(PREF_METALINK_VERSION): New definition.
(PREF_METALINK_LANGUAGE): New definition.
(PREF_METALINK_OS): New definition.
(PREF_METALINK_SERVERS): New definition.
* src/main.cc
(main): Following command-line parameters are now put into
Option
class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
metalinkLanguage, metalinkOs, metalinkServers
To fix the bug that aria2 can not handle http response header
properly.
* src/HttpHeader.cc
(put): Made name lowercased.
(defined): Made name lowercased.
(getFirst): Made name lowercased.
(get): Made name lowercased.
(getFirstAsInt): Rewritten.
(getFirstAsLLInt): Rewritten.
2006-08-03 12:36:02 +00:00
|
|
|
cout << FeatureConfig::getInstance()->getConfigurationSummary();
|
2006-07-30 12:58:27 +00:00
|
|
|
cout << endl;
|
2007-01-28 14:44:16 +00:00
|
|
|
cout << "Copyright (C) 2006, 2007 Tatsuhiro Tsujikawa" << endl;
|
2006-10-01 11:29:14 +00:00
|
|
|
cout << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout <<
|
|
|
|
_("This program is free software; you can redistribute it and/or modify\n"
|
|
|
|
"it under the terms of the GNU General Public License as published by\n"
|
|
|
|
"the Free Software Foundation; either version 2 of the License, or\n"
|
|
|
|
"(at your option) any later version.\n"
|
|
|
|
"\n"
|
|
|
|
"This program is distributed in the hope that it will be useful,\n"
|
|
|
|
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
|
|
|
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
|
|
|
"GNU General Public License for more details.\n"
|
|
|
|
"\n"
|
|
|
|
"You should have received a copy of the GNU General Public License\n"
|
|
|
|
"along with this program; if not, write to the Free Software\n"
|
2006-10-01 14:11:29 +00:00
|
|
|
"Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n");
|
2006-02-17 13:35:04 +00:00
|
|
|
cout << endl;
|
2006-11-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To divide TorrentMan into 6 classes: BtContext, BtRuntime,
PeerStorage, PieceStorage, BtAnnounce and BtProgressInfoFile
* src/TrackerWatcherComand.h: Made subclass of
BtContextAwareCommand.
* src/SeedCheckCommand.cc: Use pieceStorage, btRuntime
* src/PeerAbstractCommand.h: Made subclass of
BtContextAwareCommand.
* src/PeerAbstractCommand.cc: Use btRuntime.
* src/BtContextAwareCommand.h: New class.
* src/FileEntry.h: Added accessor methods for following
variables.
(path): Made private.
(length): Made private.
(offset): Made private.
(extracted): Made private.
(requested): Made private.
(FileEntries): New definition.
(FileEntryHandle): New definition.
* src/FileEntry.cc: New file.
* src/HaveEraseCommand.h: Made subclass of
BtContextAwareCommand.
* src/HaveEraseCommand.cc: Use btRuntime, pieceStorage.
* src/PeerChokeCommand.h: Made subclass of
BtContextAwareCommand.
* src/PeerChokeCommand.cc: Use btRuntime, peerStorage,
pieceStorage.
* src/PieceStorage.h: New file.
* src/PeerInteractionCommand.h: Use btContext.
* src/PeerInteractionCommand.cc: Use pieceStorage, peerStorage,
btRuntime.
* src/DefaultBtProgressInfoFile.h: New file.
* src/DefaultBtProgressInfoFile.cc: New file.
* src/File.cc
(Util.h): New include.
(mkdirs): New function.
* src/MultiDiskAdaptor.h
(mkdir): New function.
* src/PeerListProcessor.h
(Peers): Removed.
* src/PeerInteraction.h
(torrentMan): Removed.
(btContext): New variable.
(peerStorage): New variable.
(pieceStorage): New variable.
(btAnnounce): New variable.
(getTorrentMan): Removed.
(getBtContext): New function.
* src/PeerInteraction.cc: Use btContext, peerStorage,
pieceStorage,
btAnnounce.
* src/HandshakeMessage.h
(TorrentMan.h): Removed.
* src/HandshakeMessage.cc: Use btContext.
* src/DefaultBtAnnounce.cc: New file.
* src/MultiDiskWriter.cc: Use the accessor methods of FileEntry.
* src/DefaultPieceStorage.cc: New file.
* src/DefaultBtContext.h: New file.
* src/TorrentRequestInfo.cc: Use btContext, pieceStorage.
Use the accessor methods of FileEntry.
* src/CookieBox.cc: Updated to use Util::slice().
* src/PieceMessage.cc: Use btContext, pieceStorage.
* src/common.h (SharedHandle.h): New include.
* src/PeerMessage.cc (PeerMessage): Added btContext,
peerStorage,
pieceStorage.
* src/TorrentAutoSaveCommand.h: Made subclass of
BtContextAwareCommand.
* src/DiskAdaptor.h
(topDir): Removed.
(getFileEntryFromPath): Changed the return type to
FileEntryHandle.
(setTopDir): Removed.
(getTopDir): Removed.
* src/BtContext.h: New file.
* src/DefaultPeerStorage.h: New file.
* src/PieceMessage.h (TorrentMan.h): Removed.
* src/RequestMessage.h (TorrentMan.h): Removed.
* src/TorrentDownloadEngine.h
(uploadLength): New variable.
(btContext): New variable.
(btRuntime): New variable.
(pieceStorage): New variable.
(peerStorage): New variable.
(btAnnounce): New variable.
(btProgressInfoFile): New variable.
(torrentMan): Removed.
(setBtContext): New function.
* src/TorrentDownloadEngine.cc: Use BtContext, BtRuntime,
pieceStorage,
peerStorage, btAnnounce, btProgressInfoFile.
* src/Piece.h
(toString): New function.
(Pieces): New type definition.
* src/Peer.h
(active): New variable.
(Peer): Added active.
(activate): Set active to true.
(deactivate): Set active to false.
(isActive): New function.
(Peers): New type definition.
* src/DirectDiskAdaptor.cc
(getFilePath): Use the accessor methods of FileEntry.
* src/TorrentConsoleDownloadEngine.h
(afterEachIteration): New function.
* src/TorrentConsoleDownloadEngine.cc
(haltRequested): New variable.
(sendStatistics): Use pieceStorage, btRuntime.
(afterEachIteration): New function.
* src/AnnounceList: AnnounceTier->AnnounceTierHandle.
* src/Directry.h
(Directory): New function.
(DirectoryHandle): New type definition.
* src/BtProgressInfoFile.h: New file.
* src/RequestMessage.cc: Use pieceStorage.
* src/BtRuntime.h: New file.
* src/DefaultBtContext.cc: New file.
* src/BitfieldMan.h
(getCompletedLength): New function(private).
(getCompletedLength): New function.
(getFilteredCompletedLength): New function.
* src/BitfieldMan.h
(getCompletedLength): New function(private).
(getCompletedLength): New function.
(getFilteredCompletedLength): New function.
* src/MultiDiskAdaptor.cc
(mkdir): New function.
(openFile): Call mkdir().
(initAndOpenFile): Call mkdir().
* src/CancelMessage.h
(TorrentMan.h): Removed.
* src/RejectMessage.h
(TorrentMan.h): Removed.
* src/DownloadEngineFactory.cc
(DefaultPieceStorage.h): New include.
(DefaultPeerStorage.h): New include.
(DefaultBtAnnounce.h): New include.
(DefaultBtProgressInfoFile.h): New include.
(newTorrentConsoleEngine): Rewritten.
* src/ShareRatioSeedCriteria.h
(torrentMan): Removed.
(btContext): New variable.
(peerStorage): New variable.
(btRuntime): New variable.
(evaluate): Use btContext, btRuntime, peerStorage.
* src/AnnounceTier.h: New file.
* src/BtAnnounce.h: New file.
* src/BtRegistry.h: New file.
* src/PeerInitiateConnectionCommand.h: Added btContext.
* src/PeerConnection.h (TorrentMan.h): Removed.
* src/PeerMessageFactory.cc: Use btContext, pieceStorage.
* src/Util.h
(slice): Added an argument.
* src/Util.cc
(slice): Added an argument to control whether trim is made or
not.
* src/PeerStorage.h: New file.
* src/BtRegistry.cc: New file.
* src/TrackerUpdateCommand.h: Made subclass of
BtContextAwareCommand.
* src/CopyDiskAdaptor.cc: Use the accessor methods of FileEntry.
* src/MultiDiskWriter.h: FileEntry -> FileEntryHandle
* src/PeerListenCommand.cc: Use btRuntime, peerStorage,
btContext.
* src/TorrentRequestInfo.h
(e): Removed.
(showFileEntry): Added an argument.
(getDownloadEngine): Return 0.
* src/DefaultBtAnnounce.h: New file.
* src/TorrentAutoSaveCommand.cc: Use btRuntime,
btProgressInfoFile.
* src/TrackerWatcherComand.cc: Use btRuntime, btAnnounce,
* src/PeerMessageFactory.h
(btContext): New variable.
(pieceStorage): New variable.
* src/TrackerUpdateCommand.cc: Use btRuntime, peerStorage,
btContext,
btAnnounce.
* src/DiskAdaptor.cc
(DiskAdaptor): Removed topDir.
(~DiskAdaptor): Removed topDir.
* src/PeerListenCommand.h: Made subclass of
BtContextAwareCommand.
* src/SeedCheckCommand.h: Made subclass of
BtContextAwareCommand.
* src/File.h (mkdirs): New function.
* src/DefaultPeerStorage): New file.
* src/DownloadEngineFactory.h
(newTorrentConsoleEngine): Use btContext.
* src/BtContextAwareCommand.cc: New file.
* src/PeerInitiateConnectionCommand.cc: Use btRuntime,
peerStorage.
* src/PeerMessage.h
(btContext): New variable.
(peerStorage): New variable.
(pieceStorage): New variable.
(setBtContext): New function.
* src/Directry.cc
(Directory): New function.
(createDir): Do nothing if name.size() == 0.
* src/AnnounceList.h
(AnnounceTier): Removed.
(AnnounceTiers): Removed.
* src/DefaultPieceStorage.h: New file.
* src/Piece.cc (toString): New function.
To fix typo:
* src/main.cc (showVersion): Fixed typo.
To fix compile warning:
* src/DelegatingPeerListProcessor.cc
(canHandle): Added "return false".
2006-11-05 15:04:17 +00:00
|
|
|
printf(_("Contact Info: %s\n"), "Tatsuhiro Tsujikawa <tujikawa at users dot sourceforge dot net>");
|
2006-02-17 13:35:04 +00:00
|
|
|
cout << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void showUsage() {
|
2006-03-05 06:32:01 +00:00
|
|
|
printf(_("Usage: %s [options] URL ...\n"), PACKAGE_NAME);
|
2006-04-21 13:04:02 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
2006-04-18 17:06:17 +00:00
|
|
|
printf(_(" %s [options] -T TORRENT_FILE FILE ...\n"), PACKAGE_NAME);
|
2006-04-21 13:04:02 +00:00
|
|
|
#endif // ENABLE_BITTORRENT
|
2006-07-04 10:57:56 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
|
|
|
printf(_(" %s [options] -M METALINK_FILE\n"), PACKAGE_NAME);
|
|
|
|
#endif // ENABLE_METALINK
|
2006-02-21 14:00:58 +00:00
|
|
|
cout << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _("Options:") << endl;
|
|
|
|
cout << _(" -d, --dir=DIR The directory to store downloaded file.") << endl;
|
|
|
|
cout << _(" -o, --out=FILE The file name for downloaded file.") << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" -l, --log=LOG The file path to store log. If '-' is specified,\n"
|
|
|
|
" log is written to stdout.") << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" -D, --daemon Run as daemon.") << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" -s, --split=N Download a file using N connections. N must be\n"
|
|
|
|
" between 1 and 5. This option affects all URLs.\n"
|
|
|
|
" Thus, aria2 connects to each URL with\n"
|
2007-01-08 00:13:25 +00:00
|
|
|
" N connections.\n"
|
|
|
|
" Default: 1") << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" --retry-wait=SEC Set amount of time in second between requests\n"
|
|
|
|
" for errors. Specify a value between 0 and 60.\n"
|
|
|
|
" Default: 5") << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" -t, --timeout=SEC Set timeout in second. Default: 60") << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" -m, --max-tries=N Set number of tries. 0 means unlimited.\n"
|
|
|
|
" Default: 5") << endl;
|
2006-09-23 12:27:16 +00:00
|
|
|
/*
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n"
|
|
|
|
" K or M(1K = 1024, 1M = 1024K). This\n"
|
|
|
|
" value must be greater than or equal to\n"
|
2006-08-07 16:05:00 +00:00
|
|
|
" 1024. Default: 1M") << endl;
|
2006-09-23 12:27:16 +00:00
|
|
|
*/
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" --http-proxy=HOST:PORT Use HTTP proxy server. This affects to all\n"
|
|
|
|
" URLs.") << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" --http-user=USER Set HTTP user. This affects to all URLs.") << endl;
|
|
|
|
cout << _(" --http-passwd=PASSWD Set HTTP password. This affects to all URLs.") << endl;
|
|
|
|
cout << _(" --http-proxy-user=USER Set HTTP proxy user. This affects to all URLs") << endl;
|
|
|
|
cout << _(" --http-proxy-passwd=PASSWD Set HTTP proxy password. This affects to all URLs.") << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" --http-proxy-method=METHOD Set the method to use in proxy request.\n"
|
|
|
|
" METHOD is either 'get' or 'tunnel'.\n"
|
|
|
|
" Default: tunnel") << endl;
|
|
|
|
cout << _(" --http-auth-scheme=SCHEME Set HTTP authentication scheme. Currently, basic\n"
|
2006-04-20 15:58:05 +00:00
|
|
|
" is the only supported scheme.\n"
|
|
|
|
" Default: basic") << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" --referer=REFERER Set Referer. This affects to all URLs.") << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" --ftp-user=USER Set FTP user. This affects to all URLs.\n"
|
|
|
|
" Default: anonymous") << endl;
|
|
|
|
cout << _(" --ftp-passwd=PASSWD Set FTP password. This affects to all URLs.\n"
|
|
|
|
" Default: ARIA2USER@") << endl;
|
|
|
|
cout << _(" --ftp-type=TYPE Set FTP transfer type. TYPE is either 'binary'\n"
|
|
|
|
" or 'ascii'.\n"
|
|
|
|
" Default: binary") << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" -p, --ftp-pasv Use passive mode in FTP.") << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << _(" --ftp-via-http-proxy=METHOD Use HTTP proxy in FTP. METHOD is either 'get' or\n"
|
|
|
|
" 'tunnel'.\n"
|
|
|
|
" Default: tunnel") << endl;
|
2006-10-01 14:11:29 +00:00
|
|
|
cout << _(" --lowest-speed-limit=SPEED Close connection if download speed is lower than\n"
|
2006-09-23 12:27:16 +00:00
|
|
|
" or equal to this value(bytes per sec).\n"
|
|
|
|
" 0 means aria2 does not care lowest speed limit.\n"
|
2006-09-21 14:37:15 +00:00
|
|
|
" You can append K or M(1K = 1024, 1M = 1024K).\n"
|
|
|
|
|
2006-08-07 16:05:00 +00:00
|
|
|
" This option does not affect BitTorrent download.\n"
|
|
|
|
" Default: 0") << endl;
|
2006-10-01 14:11:29 +00:00
|
|
|
cout << _(" --max-download-limit=SPEED Set max download speed in bytes per sec.\n"
|
2006-09-23 12:27:16 +00:00
|
|
|
" 0 means unrestricted.\n"
|
2006-09-21 14:37:15 +00:00
|
|
|
" You can append K or M(1K = 1024, 1M = 1024K).\n"
|
|
|
|
" Default: 0") << endl;
|
2007-01-08 00:13:25 +00:00
|
|
|
cout << _(" --file-allocation=METHOD Specify file allocation method. METHOD is either\n"
|
|
|
|
" 'none' or 'prealloc'.\n"
|
|
|
|
" 'none' doesn't pre-allocate file space. 'prealloc'\n"
|
|
|
|
" pre-allocates file space before download begins.\n"
|
|
|
|
" This may take some time depending on the size of\n"
|
|
|
|
" file.\n"
|
2007-01-28 14:18:35 +00:00
|
|
|
" Default: none") << endl;
|
|
|
|
cout << _(" --allow-overwrite=true|false If this option set to false, aria2 doesn't\n"
|
|
|
|
" download a file which already exists in the file\n"
|
|
|
|
" system but its corresponding .aria2 file doesn't\n"
|
|
|
|
" exist.\n"
|
2007-01-11 16:32:31 +00:00
|
|
|
" Default: false") << endl;
|
2007-07-04 16:04:57 +00:00
|
|
|
#ifdef ENABLE_MESSAGE_DIGEST
|
2007-03-27 16:47:41 +00:00
|
|
|
cout << _(" --check-integrity=true|false Check file integrity by validating piece hash.\n"
|
2007-01-28 14:18:35 +00:00
|
|
|
" This option makes effect in BitTorrent download\n"
|
|
|
|
" and Metalink with chunk checksums.\n"
|
|
|
|
" Use this option to redownload a damaged portion of\n"
|
|
|
|
" file.\n"
|
|
|
|
" You may need to specify --allow-overwrite=true\n"
|
|
|
|
" option if .aria2 file doesn't exist.\n"
|
|
|
|
" Default: false") << endl;
|
|
|
|
cout << _(" --realtime-chunk-checksum=true|false Validate chunk checksum while downloading\n"
|
|
|
|
" a file in Metalink mode. This option makes effect\n"
|
|
|
|
" in Metalink with chunk checksums.\n"
|
|
|
|
" Default: true") << endl;
|
2007-07-04 16:04:57 +00:00
|
|
|
#endif // ENABLE_MESSAGE_DIGEST
|
2007-03-24 15:46:41 +00:00
|
|
|
cout << _(" -c, --continue Continue downloading a partially downloaded\n"
|
|
|
|
" file. Use this option to resume a download started\n"
|
|
|
|
" by web browsers or another programs\n"
|
2007-03-28 15:08:22 +00:00
|
|
|
" which download files sequentially from the\n"
|
|
|
|
" beginning. Currently this option is applicable to\n"
|
|
|
|
" http(s)/ftp downloads.") << endl;
|
2007-03-26 12:16:57 +00:00
|
|
|
cout << _(" -U, --user-agent=USER_AGENT Set user agent for http(s) downloads.") << endl;
|
2007-03-27 16:16:44 +00:00
|
|
|
cout << _(" -n, --no-netrc Disables netrc support.") << endl;
|
2007-06-03 14:24:37 +00:00
|
|
|
cout << _(" -i, --input-file=FILE Downloads URIs found in FILE. You can specify\n"
|
|
|
|
" multiple URIs for a single entity: deliminate\n"
|
2007-07-05 15:14:00 +00:00
|
|
|
" URIs by Tab in a single line.\n"
|
|
|
|
" Reads input from stdin when '-' is specified.") << endl;
|
2007-06-09 10:06:53 +00:00
|
|
|
cout << _(" -j, --max-concurrent-downloads=N Set maximum number of concurrent downloads.\n"
|
2007-06-30 09:52:39 +00:00
|
|
|
" It should be used with -i option.\n"
|
2007-06-09 10:06:53 +00:00
|
|
|
" Default: 5") << endl;
|
2007-06-10 07:55:43 +00:00
|
|
|
cout << _(" --load-cookies=FILE Load cookies from FILE. The format of FILE is\n"
|
|
|
|
" one used by Netscape and Mozilla.") << endl;
|
2007-06-30 09:52:39 +00:00
|
|
|
#if defined ENABLE_BITTORRENT || ENABLE_METALINK
|
|
|
|
cout << _(" -S, --show-files Print file listing of .torrent or .metalink file\n"
|
|
|
|
" and exit.") << endl;
|
|
|
|
cout << _(" --select-file=INDEX... Set file to download by specifing its index.\n"
|
|
|
|
" You can know file index through --show-files\n"
|
|
|
|
" option. Multiple indexes can be specified by using\n"
|
|
|
|
" ',' like \"3,6\".\n"
|
|
|
|
" You can also use '-' to specify rangelike \"1-5\".\n"
|
|
|
|
" ',' and '-' can be used together.\n"
|
|
|
|
" When used with -M option, index may vary depending\n"
|
|
|
|
" on the query(see --metalink-* options).") << endl;
|
|
|
|
#endif // ENABLE_BITTORRENT || ENABLE_METALINK
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* configure.in: Added gnutls support. Added several CPP macros.
* m4/openssl.m4: Added.
* src/SocketCore.{h,cc}: Drop const quarifier from writeData(),
readData(), peekData(). Added gnutls support.
* src/HttpDownloadCommand.cc: Removed SleepCommand.h
* src/TrackerWatcherCommand.{h,cc}: Added. This command creates
TrackerInitCommand periodicaly(TorrentMan::minInterval).
* src/TorrentMan.cc: Remove downloadedSize == 0 check from
save().
Instead, added a check for whether setup method has executed
successfully.
* src/TorrentMan.h: Added member vaiable setupComplete. Updated
DEFAULT_ANNOUNCE_INTERVAL and DEFAULT_ANNOUNCE_MIN_INTERVAL to
300.
* src/Makefile.am: Updated.
* src/messageDigest.h: Added. This is a macro calculating SHA1
digest
using whether OpenSSL or gcrypt, depending on the result of
configure
script.
* src/ShaVisitor.{h,cc}: Removed direct dependency on OpenSSL by
using
messageDigest.h.
* src/TorrentAutoSaveCommand.h: Removed unused variable cuid.
* src/PeerListenCommand.cc: Added log about port binded
successfully.
Fixed memory leak.
* src/main.cc: Added gnutls support. Replaced LIB_SSL with
ENABLE_BITTORRENT where they are not related to OpenSSL but
BitTorrent.
Removed instantiation of TrackerInitCommand. Instead,
TrackerWatcherCommand is instantiated and pushed to the command
queue.
* src/InitiateConnectionCommandFactory.cc: Replaced HAVE_LIBSSL
with
ENABLE_SSL.
* src/Request.cc: Replaced HAVE_LIBSSL with ENABLE_SSL.
* src/RequestSlotMan.cc:
(deleteCompletedRequestSlot)
If a piece is already acquired by another command, delete the
request
slots for the piece.
* src/TrackerUpdateCommand.cc:
(execute)
Changed log level of MSG_TRACKER_WARNING_MESSAGE from info to
warn.
Added a check whether peer list is null.
Fixed the bug that causes sending completed event to the tracker
several times.
* src/TrackerInitCommand.cc:
(execute)
Fixed the bug that causes sending completed event to the tracker
several times.
* src/AbstractDiskWriter.{h,cc}: Removed direct dependency on
OpenSSL
by using messageDigest.h.
2006-03-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* PeerConnection.cc: Replaced log message "keep-alive" with
"keep alive".
* PeerInteractionCommand.{h,cc}: Close connection if peer is
choking
localhost long time.
* TorrentMan.cc: When adding new peer with duplicate = true, if
the
number of peer list is equal to or grater than MAX_PEER_LIST,
delete
at most 100 failure entry from the list. If with duplicate =
false,
MAX_PEER_LIST is not checked.
* PeerListenCommand.cc: Fixed the argument order of log message.
2006-03-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* Logger.h: Moved enum LEVEL from SimpleLogger.h to here.
Added warn().
* SimpleLogger.h: Moved enum LEVEL to Logger.h.
Implemented warn().
Defined 2 macros(WRITE_LOG, WRITE_LOG_EX) to avoid duplicated
code.
2006-03-27 14:47:26 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
2006-04-18 17:06:17 +00:00
|
|
|
cout << _(" -T, --torrent-file=TORRENT_FILE The file path to .torrent file.") << endl;
|
2006-03-21 14:12:51 +00:00
|
|
|
cout << _(" --follow-torrent=true|false Setting this option to false prevents aria2 to\n"
|
|
|
|
" enter BitTorrent mode even if the filename of\n"
|
|
|
|
" downloaded file ends with .torrent.\n"
|
|
|
|
" Default: true") << endl;
|
2006-04-18 17:06:17 +00:00
|
|
|
cout << _(" --direct-file-mapping=true|false Directly read from and write to each file\n"
|
|
|
|
" mentioned in .torrent file.\n"
|
|
|
|
" Default: true") << endl;
|
2007-06-23 06:25:12 +00:00
|
|
|
cout << _(" --listen-port=PORT Set port number to listen to for peer connection.\n"
|
|
|
|
" Default: 6881-6999") << endl;
|
2006-10-01 14:11:29 +00:00
|
|
|
cout << _(" --max-upload-limit=SPEED Set max upload speed in bytes per sec.\n"
|
2006-09-23 12:27:16 +00:00
|
|
|
" 0 means unrestricted.\n"
|
2006-09-21 14:37:15 +00:00
|
|
|
" You can append K or M(1K = 1024, 1M = 1024K).\n"
|
|
|
|
" Default: 0") << endl;
|
2006-08-27 12:49:17 +00:00
|
|
|
cout << _(" --seed-time=MINUTES Specify seeding time in minutes. See also\n"
|
|
|
|
" --seed-ratio option.") << endl;
|
2006-08-28 15:40:50 +00:00
|
|
|
cout << _(" --seed-ratio=RATIO Specify share ratio. Seed completed torrents until\n"
|
|
|
|
" share ratio reaches RATIO. 1.0 is encouraged.\n"
|
2006-08-27 12:49:17 +00:00
|
|
|
" If --seed-time option is specified along with\n"
|
|
|
|
" this option, seeding ends when at least one of\n"
|
2006-08-28 15:40:50 +00:00
|
|
|
" the conditions is satisfied.") << endl;
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* configure.in: Added gnutls support. Added several CPP macros.
* m4/openssl.m4: Added.
* src/SocketCore.{h,cc}: Drop const quarifier from writeData(),
readData(), peekData(). Added gnutls support.
* src/HttpDownloadCommand.cc: Removed SleepCommand.h
* src/TrackerWatcherCommand.{h,cc}: Added. This command creates
TrackerInitCommand periodicaly(TorrentMan::minInterval).
* src/TorrentMan.cc: Remove downloadedSize == 0 check from
save().
Instead, added a check for whether setup method has executed
successfully.
* src/TorrentMan.h: Added member vaiable setupComplete. Updated
DEFAULT_ANNOUNCE_INTERVAL and DEFAULT_ANNOUNCE_MIN_INTERVAL to
300.
* src/Makefile.am: Updated.
* src/messageDigest.h: Added. This is a macro calculating SHA1
digest
using whether OpenSSL or gcrypt, depending on the result of
configure
script.
* src/ShaVisitor.{h,cc}: Removed direct dependency on OpenSSL by
using
messageDigest.h.
* src/TorrentAutoSaveCommand.h: Removed unused variable cuid.
* src/PeerListenCommand.cc: Added log about port binded
successfully.
Fixed memory leak.
* src/main.cc: Added gnutls support. Replaced LIB_SSL with
ENABLE_BITTORRENT where they are not related to OpenSSL but
BitTorrent.
Removed instantiation of TrackerInitCommand. Instead,
TrackerWatcherCommand is instantiated and pushed to the command
queue.
* src/InitiateConnectionCommandFactory.cc: Replaced HAVE_LIBSSL
with
ENABLE_SSL.
* src/Request.cc: Replaced HAVE_LIBSSL with ENABLE_SSL.
* src/RequestSlotMan.cc:
(deleteCompletedRequestSlot)
If a piece is already acquired by another command, delete the
request
slots for the piece.
* src/TrackerUpdateCommand.cc:
(execute)
Changed log level of MSG_TRACKER_WARNING_MESSAGE from info to
warn.
Added a check whether peer list is null.
Fixed the bug that causes sending completed event to the tracker
several times.
* src/TrackerInitCommand.cc:
(execute)
Fixed the bug that causes sending completed event to the tracker
several times.
* src/AbstractDiskWriter.{h,cc}: Removed direct dependency on
OpenSSL
by using messageDigest.h.
2006-03-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* PeerConnection.cc: Replaced log message "keep-alive" with
"keep alive".
* PeerInteractionCommand.{h,cc}: Close connection if peer is
choking
localhost long time.
* TorrentMan.cc: When adding new peer with duplicate = true, if
the
number of peer list is equal to or grater than MAX_PEER_LIST,
delete
at most 100 failure entry from the list. If with duplicate =
false,
MAX_PEER_LIST is not checked.
* PeerListenCommand.cc: Fixed the argument order of log message.
2006-03-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* Logger.h: Moved enum LEVEL from SimpleLogger.h to here.
Added warn().
* SimpleLogger.h: Moved enum LEVEL to Logger.h.
Implemented warn().
Defined 2 macros(WRITE_LOG, WRITE_LOG_EX) to avoid duplicated
code.
2006-03-27 14:47:26 +00:00
|
|
|
#endif // ENABLE_BITTORRENT
|
2006-07-04 10:57:56 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
|
|
|
cout << _(" -M, --metalink-file=METALINK_FILE The file path to .metalink file.") << endl;
|
|
|
|
cout << _(" -C, --metalink-servers=NUM_SERVERS The number of servers to connect to\n"
|
2007-06-10 07:55:43 +00:00
|
|
|
" simultaneously.\n"
|
|
|
|
" Default: 5") << endl;
|
2006-07-04 10:57:56 +00:00
|
|
|
cout << _(" --metalink-version=VERSION The version of file to download.") << endl;
|
|
|
|
cout << _(" --metalink-language=LANGUAGE The language of file to download.") << endl;
|
|
|
|
cout << _(" --metalink-os=OS The operating system the file is targeted.") << endl;
|
2006-11-08 16:25:38 +00:00
|
|
|
cout << _(" --metalink-location=LOCATION The location of the prefered server.") << endl;
|
2006-07-04 10:57:56 +00:00
|
|
|
cout << _(" --follow-metalink=true|false Setting this option to false prevents aria2 to\n"
|
|
|
|
" enter Metalink mode even if the filename of\n"
|
|
|
|
" downloaded file ends with .metalink.\n"
|
|
|
|
" Default: true") << endl;
|
|
|
|
#endif // ENABLE_METALINK
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" -v, --version Print the version number and exit.") << endl;
|
|
|
|
cout << _(" -h, --help Print this message and exit.") << endl;
|
2006-02-21 14:00:58 +00:00
|
|
|
cout << endl;
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << "URL:" << endl;
|
|
|
|
cout << _(" You can specify multiple URLs. All URLs must point to the same file\n"
|
|
|
|
" or downloading fails.") << endl;
|
2006-02-21 14:00:58 +00:00
|
|
|
cout << endl;
|
2006-04-21 13:04:02 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
2006-04-18 17:06:17 +00:00
|
|
|
cout << "FILE:" << endl;
|
|
|
|
cout << _(" Specify files in multi-file torrent to download. Use conjunction with\n"
|
2006-04-28 15:55:11 +00:00
|
|
|
" -T option. This arguments are ignored if you specify --select-file option.") << endl;
|
2006-04-18 17:06:17 +00:00
|
|
|
cout << endl;
|
2006-04-21 13:04:02 +00:00
|
|
|
#endif // ENABLE_BITTORRENT
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _("Examples:") << endl;
|
|
|
|
cout << _(" Download a file by 1 connection:") << endl;
|
2006-02-17 13:35:04 +00:00
|
|
|
cout << " aria2c http://AAA.BBB.CCC/file.zip" << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" Download a file by 2 connections:") << endl;
|
2006-02-17 13:35:04 +00:00
|
|
|
cout << " aria2c -s 2 http://AAA.BBB.CCC/file.zip" << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" Download a file by 2 connections, each connects to a different server:") << endl;
|
2006-02-17 13:35:04 +00:00
|
|
|
cout << " aria2c http://AAA.BBB.CCC/file.zip http://DDD.EEE.FFF/GGG/file.zip" << endl;
|
2006-03-02 10:43:00 +00:00
|
|
|
cout << _(" You can mix up different protocols:") << endl;
|
2006-02-21 14:00:58 +00:00
|
|
|
cout << " aria2c http://AAA.BBB.CCC/file.zip ftp://DDD.EEE.FFF/GGG/file.zip" << endl;
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* configure.in: Added gnutls support. Added several CPP macros.
* m4/openssl.m4: Added.
* src/SocketCore.{h,cc}: Drop const quarifier from writeData(),
readData(), peekData(). Added gnutls support.
* src/HttpDownloadCommand.cc: Removed SleepCommand.h
* src/TrackerWatcherCommand.{h,cc}: Added. This command creates
TrackerInitCommand periodicaly(TorrentMan::minInterval).
* src/TorrentMan.cc: Remove downloadedSize == 0 check from
save().
Instead, added a check for whether setup method has executed
successfully.
* src/TorrentMan.h: Added member vaiable setupComplete. Updated
DEFAULT_ANNOUNCE_INTERVAL and DEFAULT_ANNOUNCE_MIN_INTERVAL to
300.
* src/Makefile.am: Updated.
* src/messageDigest.h: Added. This is a macro calculating SHA1
digest
using whether OpenSSL or gcrypt, depending on the result of
configure
script.
* src/ShaVisitor.{h,cc}: Removed direct dependency on OpenSSL by
using
messageDigest.h.
* src/TorrentAutoSaveCommand.h: Removed unused variable cuid.
* src/PeerListenCommand.cc: Added log about port binded
successfully.
Fixed memory leak.
* src/main.cc: Added gnutls support. Replaced LIB_SSL with
ENABLE_BITTORRENT where they are not related to OpenSSL but
BitTorrent.
Removed instantiation of TrackerInitCommand. Instead,
TrackerWatcherCommand is instantiated and pushed to the command
queue.
* src/InitiateConnectionCommandFactory.cc: Replaced HAVE_LIBSSL
with
ENABLE_SSL.
* src/Request.cc: Replaced HAVE_LIBSSL with ENABLE_SSL.
* src/RequestSlotMan.cc:
(deleteCompletedRequestSlot)
If a piece is already acquired by another command, delete the
request
slots for the piece.
* src/TrackerUpdateCommand.cc:
(execute)
Changed log level of MSG_TRACKER_WARNING_MESSAGE from info to
warn.
Added a check whether peer list is null.
Fixed the bug that causes sending completed event to the tracker
several times.
* src/TrackerInitCommand.cc:
(execute)
Fixed the bug that causes sending completed event to the tracker
several times.
* src/AbstractDiskWriter.{h,cc}: Removed direct dependency on
OpenSSL
by using messageDigest.h.
2006-03-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* PeerConnection.cc: Replaced log message "keep-alive" with
"keep alive".
* PeerInteractionCommand.{h,cc}: Close connection if peer is
choking
localhost long time.
* TorrentMan.cc: When adding new peer with duplicate = true, if
the
number of peer list is equal to or grater than MAX_PEER_LIST,
delete
at most 100 failure entry from the list. If with duplicate =
false,
MAX_PEER_LIST is not checked.
* PeerListenCommand.cc: Fixed the argument order of log message.
2006-03-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* Logger.h: Moved enum LEVEL from SimpleLogger.h to here.
Added warn().
* SimpleLogger.h: Moved enum LEVEL to Logger.h.
Implemented warn().
Defined 2 macros(WRITE_LOG, WRITE_LOG_EX) to avoid duplicated
code.
2006-03-27 14:47:26 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
2006-07-04 10:57:56 +00:00
|
|
|
cout << endl;
|
2006-03-21 16:07:22 +00:00
|
|
|
cout << _(" Download a torrent:") << endl;
|
2006-09-23 12:27:16 +00:00
|
|
|
cout << " aria2c -o test.torrent http://AAA.BBB.CCC/file.torrent" << endl;
|
2006-03-21 16:07:22 +00:00
|
|
|
cout << _(" Download a torrent using local .torrent file:") << endl;
|
2006-09-23 12:27:16 +00:00
|
|
|
cout << " aria2c -T test.torrent" << endl;
|
2006-04-18 17:06:17 +00:00
|
|
|
cout << _(" Download only selected files:") << endl;
|
2006-09-23 12:27:16 +00:00
|
|
|
cout << " aria2c -T test.torrent dir/file1.zip dir/file2.zip" << endl;
|
2006-04-20 16:09:15 +00:00
|
|
|
cout << _(" Print file listing of .torrent file:") << endl;
|
2006-09-23 12:27:16 +00:00
|
|
|
cout << " aria2c -T test.torrent -S" << endl;
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* configure.in: Added gnutls support. Added several CPP macros.
* m4/openssl.m4: Added.
* src/SocketCore.{h,cc}: Drop const quarifier from writeData(),
readData(), peekData(). Added gnutls support.
* src/HttpDownloadCommand.cc: Removed SleepCommand.h
* src/TrackerWatcherCommand.{h,cc}: Added. This command creates
TrackerInitCommand periodicaly(TorrentMan::minInterval).
* src/TorrentMan.cc: Remove downloadedSize == 0 check from
save().
Instead, added a check for whether setup method has executed
successfully.
* src/TorrentMan.h: Added member vaiable setupComplete. Updated
DEFAULT_ANNOUNCE_INTERVAL and DEFAULT_ANNOUNCE_MIN_INTERVAL to
300.
* src/Makefile.am: Updated.
* src/messageDigest.h: Added. This is a macro calculating SHA1
digest
using whether OpenSSL or gcrypt, depending on the result of
configure
script.
* src/ShaVisitor.{h,cc}: Removed direct dependency on OpenSSL by
using
messageDigest.h.
* src/TorrentAutoSaveCommand.h: Removed unused variable cuid.
* src/PeerListenCommand.cc: Added log about port binded
successfully.
Fixed memory leak.
* src/main.cc: Added gnutls support. Replaced LIB_SSL with
ENABLE_BITTORRENT where they are not related to OpenSSL but
BitTorrent.
Removed instantiation of TrackerInitCommand. Instead,
TrackerWatcherCommand is instantiated and pushed to the command
queue.
* src/InitiateConnectionCommandFactory.cc: Replaced HAVE_LIBSSL
with
ENABLE_SSL.
* src/Request.cc: Replaced HAVE_LIBSSL with ENABLE_SSL.
* src/RequestSlotMan.cc:
(deleteCompletedRequestSlot)
If a piece is already acquired by another command, delete the
request
slots for the piece.
* src/TrackerUpdateCommand.cc:
(execute)
Changed log level of MSG_TRACKER_WARNING_MESSAGE from info to
warn.
Added a check whether peer list is null.
Fixed the bug that causes sending completed event to the tracker
several times.
* src/TrackerInitCommand.cc:
(execute)
Fixed the bug that causes sending completed event to the tracker
several times.
* src/AbstractDiskWriter.{h,cc}: Removed direct dependency on
OpenSSL
by using messageDigest.h.
2006-03-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* PeerConnection.cc: Replaced log message "keep-alive" with
"keep alive".
* PeerInteractionCommand.{h,cc}: Close connection if peer is
choking
localhost long time.
* TorrentMan.cc: When adding new peer with duplicate = true, if
the
number of peer list is equal to or grater than MAX_PEER_LIST,
delete
at most 100 failure entry from the list. If with duplicate =
false,
MAX_PEER_LIST is not checked.
* PeerListenCommand.cc: Fixed the argument order of log message.
2006-03-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* Logger.h: Moved enum LEVEL from SimpleLogger.h to here.
Added warn().
* SimpleLogger.h: Moved enum LEVEL to Logger.h.
Implemented warn().
Defined 2 macros(WRITE_LOG, WRITE_LOG_EX) to avoid duplicated
code.
2006-03-27 14:47:26 +00:00
|
|
|
#endif // ENABLE_BITTORRENT
|
2006-07-04 10:57:56 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
|
|
|
cout << endl;
|
|
|
|
cout << _(" Metalink downloading:") << endl;
|
|
|
|
cout << " aria2c http://AAA.BBB.CCC/file.metalink" << endl;
|
|
|
|
cout << _(" Download a file using local .metalink file:") << endl;
|
|
|
|
cout << " aria2c -M test.metalink" << endl;
|
|
|
|
cout << _(" Metalink downloading with preferences:") << endl;
|
|
|
|
cout << " aria2c -M test.metalink --metalink-version=1.1.1 --metalink-language=en-US" << endl;
|
2007-07-08 02:33:46 +00:00
|
|
|
cout << _(" Download only selected files:") << endl;
|
2007-07-09 13:30:45 +00:00
|
|
|
cout << " aria2c -M test.metalink --metalink-language=en-US dir/file1.zip dir/file2.zip" << endl;
|
2007-07-08 02:33:46 +00:00
|
|
|
cout << _(" Download only selected files using index:") << endl;
|
2007-07-09 13:30:45 +00:00
|
|
|
cout << " aria2c -M test.metalink --metalink-language=en-US --select-file 1,3-5" << endl;
|
2007-07-08 02:33:46 +00:00
|
|
|
cout << _(" Print file listing of .metalink file:") << endl;
|
2007-07-09 13:30:45 +00:00
|
|
|
cout << " aria2c -M test.metalink -S --metalink-language=en-US" << endl;
|
2006-07-04 10:57:56 +00:00
|
|
|
#endif // ENABLE_METALINK
|
|
|
|
cout << endl;
|
2006-04-18 17:06:17 +00:00
|
|
|
printf(_("Report bugs to %s"), "<tujikawa at users dot sourceforge dot net>");
|
2006-03-05 06:32:01 +00:00
|
|
|
cout << endl;
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char* argv[]) {
|
2006-03-05 06:32:01 +00:00
|
|
|
#ifdef ENABLE_NLS
|
|
|
|
setlocale (LC_CTYPE, "");
|
|
|
|
setlocale (LC_MESSAGES, "");
|
|
|
|
bindtextdomain (PACKAGE, LOCALEDIR);
|
|
|
|
textdomain (PACKAGE);
|
|
|
|
#endif // ENABLE_NLS
|
2007-03-26 12:16:57 +00:00
|
|
|
stringstream cmdstream;
|
2006-02-17 13:35:04 +00:00
|
|
|
int c;
|
|
|
|
Option* op = new Option();
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Option.h
(getAsBool): New function.
* src/Option.cc
(prefs.h): Included.
(defined): 0-length value is now recognized as undefined.
(getAsInt): Rewritten.
(getAsLLInt): Rewritten.
(getAsBool): New function.
* src/FeatureConfig.h: Rewritten.
* src/FeatureConfig.cc: Rewritten.
* src/prefs.h
(PREF_STDOUT_LOG): New definition.
(PREF_LOG): New definition.
(PREF_DIR): New definition.
(PREF_OUT): New definition.
(PREF_SPLIT): New definition.
(PREF_DAEMON): New definition.
(PREF_REFERER): New definition.
(PREF_TORRENT_FILE): New definition.
(PREF_LISTEN_PORT): New definition.
(PREF_METALINK_FILE): New definition.
(PREF_METALINK_VERSION): New definition.
(PREF_METALINK_LANGUAGE): New definition.
(PREF_METALINK_OS): New definition.
(PREF_METALINK_SERVERS): New definition.
* src/main.cc
(main): Following command-line parameters are now put into
Option
class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
metalinkLanguage, metalinkOs, metalinkServers
To fix the bug that aria2 can not handle http response header
properly.
* src/HttpHeader.cc
(put): Made name lowercased.
(defined): Made name lowercased.
(getFirst): Made name lowercased.
(get): Made name lowercased.
(getFirstAsInt): Rewritten.
(getFirstAsLLInt): Rewritten.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_STDOUT_LOG, V_FALSE);
|
|
|
|
op->put(PREF_DIR, ".");
|
|
|
|
op->put(PREF_SPLIT, "1");
|
|
|
|
op->put(PREF_DAEMON, V_FALSE);
|
2006-09-19 14:52:59 +00:00
|
|
|
op->put(PREF_SEGMENT_SIZE, Util::itos(1024*1024));
|
|
|
|
op->put(PREF_HTTP_KEEP_ALIVE, V_FALSE);
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Option.h
(getAsBool): New function.
* src/Option.cc
(prefs.h): Included.
(defined): 0-length value is now recognized as undefined.
(getAsInt): Rewritten.
(getAsLLInt): Rewritten.
(getAsBool): New function.
* src/FeatureConfig.h: Rewritten.
* src/FeatureConfig.cc: Rewritten.
* src/prefs.h
(PREF_STDOUT_LOG): New definition.
(PREF_LOG): New definition.
(PREF_DIR): New definition.
(PREF_OUT): New definition.
(PREF_SPLIT): New definition.
(PREF_DAEMON): New definition.
(PREF_REFERER): New definition.
(PREF_TORRENT_FILE): New definition.
(PREF_LISTEN_PORT): New definition.
(PREF_METALINK_FILE): New definition.
(PREF_METALINK_VERSION): New definition.
(PREF_METALINK_LANGUAGE): New definition.
(PREF_METALINK_OS): New definition.
(PREF_METALINK_SERVERS): New definition.
* src/main.cc
(main): Following command-line parameters are now put into
Option
class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
metalinkLanguage, metalinkOs, metalinkServers
To fix the bug that aria2 can not handle http response header
properly.
* src/HttpHeader.cc
(put): Made name lowercased.
(defined): Made name lowercased.
(getFirst): Made name lowercased.
(get): Made name lowercased.
(getFirstAsInt): Rewritten.
(getFirstAsLLInt): Rewritten.
2006-08-03 12:36:02 +00:00
|
|
|
op->put(PREF_LISTEN_PORT, "-1");
|
2007-06-10 07:55:43 +00:00
|
|
|
op->put(PREF_METALINK_SERVERS, "5");
|
2006-08-07 16:05:00 +00:00
|
|
|
op->put(PREF_FOLLOW_TORRENT,
|
|
|
|
#ifdef ENABLE_BITTORRENT
|
|
|
|
V_TRUE
|
|
|
|
#else
|
|
|
|
V_FALSE
|
|
|
|
#endif // ENABLE_BITTORRENT
|
|
|
|
);
|
|
|
|
op->put(PREF_FOLLOW_METALINK,
|
|
|
|
#ifdef ENABLE_METALINK
|
|
|
|
V_TRUE
|
|
|
|
#else
|
|
|
|
V_FALSE
|
|
|
|
#endif // ENABLE_METALINK
|
|
|
|
);
|
2006-02-21 14:00:58 +00:00
|
|
|
op->put(PREF_RETRY_WAIT, "5");
|
|
|
|
op->put(PREF_TIMEOUT, "60");
|
2006-10-01 14:11:29 +00:00
|
|
|
op->put(PREF_DNS_TIMEOUT, "10");
|
2006-03-31 13:58:22 +00:00
|
|
|
op->put(PREF_PEER_CONNECTION_TIMEOUT, "60");
|
2006-11-09 13:51:36 +00:00
|
|
|
op->put(PREF_BT_TIMEOUT, "180");
|
2006-12-24 06:25:21 +00:00
|
|
|
op->put(PREF_BT_REQUEST_TIMEOUT, "60");
|
|
|
|
op->put(PREF_BT_KEEP_ALIVE_INTERVAL, "120");
|
2006-02-22 11:18:47 +00:00
|
|
|
op->put(PREF_MIN_SEGMENT_SIZE, "1048576");// 1M
|
|
|
|
op->put(PREF_MAX_TRIES, "5");
|
2006-04-19 17:23:58 +00:00
|
|
|
op->put(PREF_HTTP_AUTH_SCHEME, V_BASIC);
|
2006-02-22 15:40:04 +00:00
|
|
|
op->put(PREF_HTTP_PROXY_METHOD, V_TUNNEL);
|
2006-02-21 14:00:58 +00:00
|
|
|
op->put(PREF_FTP_TYPE, V_BINARY);
|
|
|
|
op->put(PREF_FTP_VIA_HTTP_PROXY, V_TUNNEL);
|
2006-03-21 14:12:51 +00:00
|
|
|
op->put(PREF_AUTO_SAVE_INTERVAL, "60");
|
2006-04-12 13:55:43 +00:00
|
|
|
op->put(PREF_DIRECT_FILE_MAPPING, V_TRUE);
|
2006-08-11 12:29:55 +00:00
|
|
|
op->put(PREF_LOWEST_SPEED_LIMIT, "0");
|
2006-09-21 14:37:15 +00:00
|
|
|
op->put(PREF_MAX_DOWNLOAD_LIMIT, "0");
|
|
|
|
op->put(PREF_MAX_UPLOAD_LIMIT, "0");
|
2006-09-21 06:56:54 +00:00
|
|
|
op->put(PREF_STARTUP_IDLE_TIME, "10");
|
2006-10-18 14:57:00 +00:00
|
|
|
op->put(PREF_TRACKER_MAX_TRIES, "10");
|
2007-01-08 00:13:25 +00:00
|
|
|
op->put(PREF_FILE_ALLOCATION, V_NONE);
|
2007-01-28 14:18:35 +00:00
|
|
|
op->put(PREF_ALLOW_OVERWRITE, V_FALSE);
|
2007-01-23 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To add chunk checksum validation:
* src/MetalinkEntry.h
(MetalinkChunkChecksum.h): New include.
(chunkChecksum): New variable.
* src/Request.h
(method): New variable.
(setMethod): New function.
(getMethod): New function.
(METHOD_GET): New static constant.
(METHOD_HEAD): New static constant.
* src/Xml2MetalinkProcessor.h
(getPieceHash): New function.
* src/PieceStorage.h
(markAllPiecesDone): New function.
(checkIntegrity): New function.
* src/FileAllocator.h
(NullFileAllocationMonitor.h): New include.
(FileAllocator): Initialize fileAllocationMonitor with new
NullFileAllocationMonitor().
* src/MultiDiskAdaptor.h
(messageDigest.h): Remove include.
(ctx): Removed.
(hashUpdate): Added ctx.
(MultiDiskAdaptor): Removed ctx.
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/UrlRequestInfo.h
(HeadResult): New class.
(digestAlgo): New variable.
(chunkChecksumLength): New variable.
(chunkChecksums): New variable.
(getHeadResult): New function.
(UrlRequestInfo): Added digestAlgo, chunkChecksumLength.
(setDigestAlgo): New function.
(setChunkChecksumLength): New function.
(setChunkChecksums): New function.
* src/DefaultPieceStorage.cc
(DiskAdaptorWriter.h): New include.
(ChunkChecksumValidator.h): New include.
(markAllPiecesDone): New function.
(checkIntegrity): New function.
* src/DefaultBtContext.h
(getPieceHashes): New function.
* src/TorrentRequestInfo.cc
(execute): Try to validate chunk checksum if file already exists
and
.aria2 file doesn't there and user allows aria2 to overwrite it.
* src/messageDigest.h
(~MessageDigestContext): Added digestFree().
* src/MetalinkRequestInfo.cc
(execute): Set digestAlgo, chunkChecksum, chunkChecksums to
reqInfo.
* src/DiskAdaptor.h
(messageDigest.h): New include.
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/DownloadCommand.h
(PeerStat.h): New include.
(maxDownloadSpeedLimit): New variable.
(startupIdleTime): New variable.
(lowestDownloadSpeedLimit): New variable.
(peerStat): New variable.
(setMaxDownloadSpeedLimit): New function.
(setStartupIdleTime): New function.
(setLowestDownloadSPeedLimit): New function.
* src/BtContext.h
(getPieceHashes): New function.
* src/main.cc
(main): Set PREF_REALTIME_CHUNK_CHECKSUM and
PREF_CHECK_INTEGRITY
option to true for testing purpose.
* src/BtPieceMessage.cc
(checkPieceHash): Use messageDigest
* src/DownloadEngine.cc
(SetDescriptor): Removed.
(AccumulateActiveCommand): Removed.
(waitData): Rewritten.
(updateFdSet): Rewritten.
* src/MultiDiskAdaptor.cc
(hashUpdate): Added ctx.
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/BitfieldMan.h
(isBitRangeSet): New function.
(unsetBitRange): New function.
* src/ByteArrayDiskWriter.h
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/ConsoleDownloadEngine.cc
(calculateStatistics): If nspeed < 0 then set nspeed to 0.
* src/DiskWriter.h
(messageDigest.h): New include.
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/ChunkChecksumValidator.h: New class.
* src/DiskAdaptorWriter.h: New class.
* src/prefs.h
(PREF_REALTIME_CHUNK_CHECKSUM): New definition.
(PREF_CHECK_INTEGRITY): New definition.
* src/HttpResponseCommand.cc
(handleDefaultEncoding): Added method "HEAD" handling.
Removed the call to
e->segmentMan->shouldCancelDownloadForSafety().
(handleOtherEncoding):
Added the call to
e->segmentMan->shouldCancelDownloadForSafety().
(createHttpDownloadCommand): Set maxDownloadSpeedLimit,
startupIdleTime, lowestDownloadSpeedLimit to command.
* src/SegmentMan.h
(getSegmentEntryByIndex): New function.
(getSegmentEntryByCuid): New function.
(getSegmentEntryIteratorByCuid): New function.
(diskWriter): DiskWriter -> DiskWriterHandle
(pieceHashes): New variable.
(chunkHashLength): New variable.
(digestAlgo): New variable.
(FindPeerStat): Removed.
(getPeerStat): Rewritten.
(markAllPiecesDone): New function.
(checkIntegrity): New function.
(tryChunkChecksumValidation): New function.
(isChunkChecksumValidationReady): New function.
* src/BitfieldMan.cc
(BitfieldMan): Initialized bitfieldLength, blocks to 0.
(BitfieldMan): Initialized blockLength, totalLength,
bitfieldLength,
blocks to 0.
(isBitRangeSet): New function.
(unsetBitRange): New function.
* src/FtpNegotiateCommand.cc
(executeInternal): Set maxDownloadSpeedLimit,
startupIdleTime, lowestDownloadSpeedLimit to command.
(recvSize): Added method "HEAD" handling.
Removed the call to
e->segmentMan->shouldCancelDownloadForSafety().
* src/AbstractSingleDiskAdaptor.cc
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/AbstractSingleDiskAdaptor.h
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/Util.h
(indexRange): New function.
* src/MetalinkEntry.cc
(MetalinkEntry): Initialized chunkChecksum to 0.
* src/ShaVisitor.cc
(~ShaVisitor): Removed the call to ctx.digestFree().
* src/SegmentMan.cc
(ChunkChecksumValidator.h): New include.
(SegmentMan): Initialized chunkHashLength to 0. Initialized
digestAlgo
to DIGEST_ALGO_SHA1.
(~SegmentMan): Removed diskWriter.
(FindSegmentEntryByIndex): Removed.
(FindSegmentEntryByCuid): Removed.
(checkoutSegment): Rewritten.
(findSlowerSegmentEntry): Rewritten.
(getSegment): Rewritten.
(updateSegment): Rewritten.
(completeSegment): Rewritten.
(markAllPiecesDone): New function.
(checkIntegrity): New function.
(isChunkChecksumValidationReady): New function.
(tryChunkChecksumValidation): New function.
* src/Xml2MetalinkProcessor.cc
(getEntry): Get size and set it to entry.
Get chunk checksum and set it to entry.
(getPieceHash): New function.
* src/Util.cc
(sha1Sum): Removed ctx.digestFree()
(fileChecksum): Removed ctx.digestFree()
(indexRange): New function.
* src/Request.cc
(METHOD_GET): New variable.
(METHOD_HEAD): New variable.
(Request): Added method.
* src/UrlRequestInfo.cc
(FatalException.h): New include.
(message.h): New include.
(operator<<): Added operator<< for class HeadResult.
(getHeadResult): New function.
(execute): Get filename and size in separate download engine.
* src/ChunkChecksumValidator.cc: New class.
* src/DownloadCommand.cc:
(DownloadCommand): Added peerStat.
(executeInternal): Use maxDownloadSpeedLimit member instead of
getting
the value from Option.
The buffer size is now 16KB.
Use peerStat member instead of getting it from SegmentMan.
Use startupIdleTime member instead of gettingit from Option.
Added chunk checksum validation.
* src/AbstractDiskWriter.cc
(AbstractDiskWriter): Removed ctx.
(~AbstractDiskWriter): Removed ctx.digestFree()
(writeDataInternal): Returns the return value of write.
(readDataInternal): Returns the return value of read.
(sha1Sum): Renamed as messageDigest
(messageDigest): New function.
* src/AbstractDiwkWriter.h
(messageDigest.h): Removed include.
(ctx): Removed.
(sha1Sum): Renamed as messageDigest
(messageDigest): New function.
* src/DefaultPieceStorage.h
(markAllPiecesDone): New function.
(checkIntegrity): New function.
* src/NullFileAllocationMonitor.h: New class.
2007-01-24 15:55:34 +00:00
|
|
|
op->put(PREF_REALTIME_CHUNK_CHECKSUM, V_TRUE);
|
2007-01-28 14:18:35 +00:00
|
|
|
op->put(PREF_CHECK_INTEGRITY, V_FALSE);
|
2007-03-18 15:42:34 +00:00
|
|
|
op->put(PREF_NETRC_PATH, Util::getHomeDir()+"/.netrc");
|
2007-03-24 14:32:49 +00:00
|
|
|
op->put(PREF_CONTINUE, V_FALSE);
|
2007-03-26 12:16:57 +00:00
|
|
|
op->put(PREF_USER_AGENT, "aria2");
|
2007-03-27 16:16:44 +00:00
|
|
|
op->put(PREF_NO_NETRC, V_FALSE);
|
2007-06-09 10:06:53 +00:00
|
|
|
op->put(PREF_MAX_CONCURRENT_DOWNLOADS, "5");
|
2007-06-05 11:37:25 +00:00
|
|
|
op->put(PREF_DIRECT_DOWNLOAD_TIMEOUT, "15");
|
2006-02-17 13:35:04 +00:00
|
|
|
while(1) {
|
|
|
|
int optIndex = 0;
|
|
|
|
int lopt;
|
|
|
|
static struct option longOpts[] = {
|
|
|
|
{ "daemon", no_argument, NULL, 'D' },
|
|
|
|
{ "dir", required_argument, NULL, 'd' },
|
|
|
|
{ "out", required_argument, NULL, 'o' },
|
|
|
|
{ "log", required_argument, NULL, 'l' },
|
|
|
|
{ "split", required_argument, NULL, 's' },
|
2006-02-21 14:00:58 +00:00
|
|
|
{ "timeout", required_argument, NULL, 't' },
|
2006-03-05 06:32:01 +00:00
|
|
|
{ "max-tries", required_argument, NULL, 'm' },
|
2006-02-17 13:35:04 +00:00
|
|
|
{ "http-proxy", required_argument, &lopt, 1 },
|
|
|
|
{ "http-user", required_argument, &lopt, 2 },
|
|
|
|
{ "http-passwd", required_argument, &lopt, 3 },
|
|
|
|
{ "http-proxy-user", required_argument, &lopt, 4 },
|
|
|
|
{ "http-proxy-passwd", required_argument, &lopt, 5 },
|
|
|
|
{ "http-auth-scheme", required_argument, &lopt, 6 },
|
2006-02-18 03:59:26 +00:00
|
|
|
{ "referer", required_argument, &lopt, 7 },
|
2006-02-18 05:13:21 +00:00
|
|
|
{ "retry-wait", required_argument, &lopt, 8 },
|
2006-02-21 14:00:58 +00:00
|
|
|
{ "ftp-user", required_argument, &lopt, 9 },
|
|
|
|
{ "ftp-passwd", required_argument, &lopt, 10 },
|
|
|
|
{ "ftp-type", required_argument, &lopt, 11 },
|
|
|
|
{ "ftp-pasv", no_argument, NULL, 'p' },
|
|
|
|
{ "ftp-via-http-proxy", required_argument, &lopt, 12 },
|
2006-09-23 12:27:16 +00:00
|
|
|
//{ "min-segment-size", required_argument, &lopt, 13 },
|
2006-02-22 15:40:04 +00:00
|
|
|
{ "http-proxy-method", required_argument, &lopt, 14 },
|
2006-08-07 16:05:00 +00:00
|
|
|
{ "lowest-speed-limit", required_argument, &lopt, 200 },
|
2006-09-21 14:37:15 +00:00
|
|
|
{ "max-download-limit", required_argument, &lopt, 201 },
|
2007-01-08 00:13:25 +00:00
|
|
|
{ "file-allocation", required_argument, 0, 'a' },
|
2007-01-28 14:18:35 +00:00
|
|
|
{ "allow-overwrite", required_argument, &lopt, 202 },
|
2007-07-04 16:04:57 +00:00
|
|
|
#ifdef ENABLE_MESSAGE_DIGEST
|
2007-01-28 14:18:35 +00:00
|
|
|
{ "check-integrity", required_argument, &lopt, 203 },
|
2007-03-24 14:32:49 +00:00
|
|
|
{ "realtime-chunk-checksum", required_argument, &lopt, 204 },
|
2007-07-04 16:04:57 +00:00
|
|
|
#endif // ENABLE_MESSAGE_DIGEST
|
2007-03-26 12:16:57 +00:00
|
|
|
{ "continue", no_argument, 0, 'c' },
|
|
|
|
{ "user-agent", required_argument, 0, 'U' },
|
2007-03-27 16:16:44 +00:00
|
|
|
{ "no-netrc", no_argument, 0, 'n' },
|
2007-05-20 13:51:52 +00:00
|
|
|
{ "input-file", required_argument, 0, 'i' },
|
2007-06-09 10:06:53 +00:00
|
|
|
{ "max-concurrent-downloads", required_argument, 0, 'j' },
|
2007-06-10 07:55:43 +00:00
|
|
|
{ "load-cookies", required_argument, &lopt, 205 },
|
2007-06-30 09:52:39 +00:00
|
|
|
#if defined ENABLE_BITTORRENT || ENABLE_METALINK
|
|
|
|
{ "show-files", no_argument, NULL, 'S' },
|
|
|
|
{ "select-file", required_argument, &lopt, 21 },
|
|
|
|
#endif // ENABLE_BITTORRENT || ENABLE_METALINK
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* configure.in: Added gnutls support. Added several CPP macros.
* m4/openssl.m4: Added.
* src/SocketCore.{h,cc}: Drop const quarifier from writeData(),
readData(), peekData(). Added gnutls support.
* src/HttpDownloadCommand.cc: Removed SleepCommand.h
* src/TrackerWatcherCommand.{h,cc}: Added. This command creates
TrackerInitCommand periodicaly(TorrentMan::minInterval).
* src/TorrentMan.cc: Remove downloadedSize == 0 check from
save().
Instead, added a check for whether setup method has executed
successfully.
* src/TorrentMan.h: Added member vaiable setupComplete. Updated
DEFAULT_ANNOUNCE_INTERVAL and DEFAULT_ANNOUNCE_MIN_INTERVAL to
300.
* src/Makefile.am: Updated.
* src/messageDigest.h: Added. This is a macro calculating SHA1
digest
using whether OpenSSL or gcrypt, depending on the result of
configure
script.
* src/ShaVisitor.{h,cc}: Removed direct dependency on OpenSSL by
using
messageDigest.h.
* src/TorrentAutoSaveCommand.h: Removed unused variable cuid.
* src/PeerListenCommand.cc: Added log about port binded
successfully.
Fixed memory leak.
* src/main.cc: Added gnutls support. Replaced LIB_SSL with
ENABLE_BITTORRENT where they are not related to OpenSSL but
BitTorrent.
Removed instantiation of TrackerInitCommand. Instead,
TrackerWatcherCommand is instantiated and pushed to the command
queue.
* src/InitiateConnectionCommandFactory.cc: Replaced HAVE_LIBSSL
with
ENABLE_SSL.
* src/Request.cc: Replaced HAVE_LIBSSL with ENABLE_SSL.
* src/RequestSlotMan.cc:
(deleteCompletedRequestSlot)
If a piece is already acquired by another command, delete the
request
slots for the piece.
* src/TrackerUpdateCommand.cc:
(execute)
Changed log level of MSG_TRACKER_WARNING_MESSAGE from info to
warn.
Added a check whether peer list is null.
Fixed the bug that causes sending completed event to the tracker
several times.
* src/TrackerInitCommand.cc:
(execute)
Fixed the bug that causes sending completed event to the tracker
several times.
* src/AbstractDiskWriter.{h,cc}: Removed direct dependency on
OpenSSL
by using messageDigest.h.
2006-03-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* PeerConnection.cc: Replaced log message "keep-alive" with
"keep alive".
* PeerInteractionCommand.{h,cc}: Close connection if peer is
choking
localhost long time.
* TorrentMan.cc: When adding new peer with duplicate = true, if
the
number of peer list is equal to or grater than MAX_PEER_LIST,
delete
at most 100 failure entry from the list. If with duplicate =
false,
MAX_PEER_LIST is not checked.
* PeerListenCommand.cc: Fixed the argument order of log message.
2006-03-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* Logger.h: Moved enum LEVEL from SimpleLogger.h to here.
Added warn().
* SimpleLogger.h: Moved enum LEVEL to Logger.h.
Implemented warn().
Defined 2 macros(WRITE_LOG, WRITE_LOG_EX) to avoid duplicated
code.
2006-03-27 14:47:26 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
2006-04-18 17:06:17 +00:00
|
|
|
{ "torrent-file", required_argument, NULL, 'T' },
|
|
|
|
{ "listen-port", required_argument, &lopt, 15 },
|
2006-03-21 14:12:51 +00:00
|
|
|
{ "follow-torrent", required_argument, &lopt, 16 },
|
2006-04-06 12:52:16 +00:00
|
|
|
{ "no-preallocation", no_argument, &lopt, 18 },
|
2006-04-12 13:55:43 +00:00
|
|
|
{ "direct-file-mapping", required_argument, &lopt, 19 },
|
2006-09-21 14:37:15 +00:00
|
|
|
// TODO remove upload-limit.
|
2007-01-28 14:18:35 +00:00
|
|
|
//{ "upload-limit", required_argument, &lopt, 20 },
|
2006-08-27 12:49:17 +00:00
|
|
|
{ "seed-time", required_argument, &lopt, 22 },
|
|
|
|
{ "seed-ratio", required_argument, &lopt, 23 },
|
2006-09-21 14:37:15 +00:00
|
|
|
{ "max-upload-limit", required_argument, &lopt, 24 },
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* configure.in: Added gnutls support. Added several CPP macros.
* m4/openssl.m4: Added.
* src/SocketCore.{h,cc}: Drop const quarifier from writeData(),
readData(), peekData(). Added gnutls support.
* src/HttpDownloadCommand.cc: Removed SleepCommand.h
* src/TrackerWatcherCommand.{h,cc}: Added. This command creates
TrackerInitCommand periodicaly(TorrentMan::minInterval).
* src/TorrentMan.cc: Remove downloadedSize == 0 check from
save().
Instead, added a check for whether setup method has executed
successfully.
* src/TorrentMan.h: Added member vaiable setupComplete. Updated
DEFAULT_ANNOUNCE_INTERVAL and DEFAULT_ANNOUNCE_MIN_INTERVAL to
300.
* src/Makefile.am: Updated.
* src/messageDigest.h: Added. This is a macro calculating SHA1
digest
using whether OpenSSL or gcrypt, depending on the result of
configure
script.
* src/ShaVisitor.{h,cc}: Removed direct dependency on OpenSSL by
using
messageDigest.h.
* src/TorrentAutoSaveCommand.h: Removed unused variable cuid.
* src/PeerListenCommand.cc: Added log about port binded
successfully.
Fixed memory leak.
* src/main.cc: Added gnutls support. Replaced LIB_SSL with
ENABLE_BITTORRENT where they are not related to OpenSSL but
BitTorrent.
Removed instantiation of TrackerInitCommand. Instead,
TrackerWatcherCommand is instantiated and pushed to the command
queue.
* src/InitiateConnectionCommandFactory.cc: Replaced HAVE_LIBSSL
with
ENABLE_SSL.
* src/Request.cc: Replaced HAVE_LIBSSL with ENABLE_SSL.
* src/RequestSlotMan.cc:
(deleteCompletedRequestSlot)
If a piece is already acquired by another command, delete the
request
slots for the piece.
* src/TrackerUpdateCommand.cc:
(execute)
Changed log level of MSG_TRACKER_WARNING_MESSAGE from info to
warn.
Added a check whether peer list is null.
Fixed the bug that causes sending completed event to the tracker
several times.
* src/TrackerInitCommand.cc:
(execute)
Fixed the bug that causes sending completed event to the tracker
several times.
* src/AbstractDiskWriter.{h,cc}: Removed direct dependency on
OpenSSL
by using messageDigest.h.
2006-03-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* PeerConnection.cc: Replaced log message "keep-alive" with
"keep alive".
* PeerInteractionCommand.{h,cc}: Close connection if peer is
choking
localhost long time.
* TorrentMan.cc: When adding new peer with duplicate = true, if
the
number of peer list is equal to or grater than MAX_PEER_LIST,
delete
at most 100 failure entry from the list. If with duplicate =
false,
MAX_PEER_LIST is not checked.
* PeerListenCommand.cc: Fixed the argument order of log message.
2006-03-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* Logger.h: Moved enum LEVEL from SimpleLogger.h to here.
Added warn().
* SimpleLogger.h: Moved enum LEVEL to Logger.h.
Implemented warn().
Defined 2 macros(WRITE_LOG, WRITE_LOG_EX) to avoid duplicated
code.
2006-03-27 14:47:26 +00:00
|
|
|
#endif // ENABLE_BITTORRENT
|
2006-07-03 14:19:23 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
|
|
|
{ "metalink-file", required_argument, NULL, 'M' },
|
2006-07-04 10:57:56 +00:00
|
|
|
{ "metalink-servers", required_argument, NULL, 'C' },
|
|
|
|
{ "metalink-version", required_argument, &lopt, 100 },
|
|
|
|
{ "metalink-language", required_argument, &lopt, 101 },
|
|
|
|
{ "metalink-os", required_argument, &lopt, 102 },
|
|
|
|
{ "follow-metalink", required_argument, &lopt, 103 },
|
2006-11-08 16:25:38 +00:00
|
|
|
{ "metalink-location", required_argument, &lopt, 104 },
|
2006-07-03 14:19:23 +00:00
|
|
|
#endif // ENABLE_METALINK
|
2006-02-17 13:35:04 +00:00
|
|
|
{ "version", no_argument, NULL, 'v' },
|
|
|
|
{ "help", no_argument, NULL, 'h' },
|
|
|
|
{ 0, 0, 0, 0 }
|
|
|
|
};
|
2007-06-09 10:06:53 +00:00
|
|
|
c = getopt_long(argc, argv, "Dd:o:l:s:pt:m:vhST:M:C:a:cU:ni:j:", longOpts, &optIndex);
|
2006-02-17 13:35:04 +00:00
|
|
|
if(c == -1) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
switch(c) {
|
|
|
|
case 0:{
|
|
|
|
switch(lopt) {
|
2007-03-26 12:16:57 +00:00
|
|
|
case 1:
|
|
|
|
cmdstream << PREF_HTTP_PROXY << "=" << optarg << "\n";
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_HTTP_USER << "=" << optarg << "\n";
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_HTTP_PASSWD << "=" << optarg << "\n";
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_HTTP_PROXY_USER << "=" << optarg << "\n";
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_HTTP_PROXY_PASSWD << "=" << optarg << "\n";
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_HTTP_AUTH_SCHEME << "=" << optarg << "\n";
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
2006-02-18 03:59:26 +00:00
|
|
|
case 7:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_REFERER << "=" << optarg << "\n";
|
2006-02-18 03:59:26 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 8:
|
|
|
|
cmdstream << PREF_RETRY_WAIT << "=" << optarg << "\n";
|
2006-02-18 05:13:21 +00:00
|
|
|
break;
|
2006-02-21 14:00:58 +00:00
|
|
|
case 9:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_FTP_USER << "=" << optarg << "\n";
|
2006-02-21 14:00:58 +00:00
|
|
|
break;
|
|
|
|
case 10:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_FTP_PASSWD << "=" << optarg << "\n";
|
2006-02-21 14:00:58 +00:00
|
|
|
break;
|
|
|
|
case 11:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_FTP_TYPE << "=" << optarg << "\n";
|
2006-02-21 14:00:58 +00:00
|
|
|
break;
|
|
|
|
case 12:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_FTP_VIA_HTTP_PROXY << "=" << optarg << "\n";
|
2006-02-21 14:00:58 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 13:
|
|
|
|
cmdstream << PREF_MIN_SEGMENT_SIZE << "=" << optarg << "\n";
|
2006-02-22 11:18:47 +00:00
|
|
|
break;
|
2006-02-22 15:40:04 +00:00
|
|
|
case 14:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_HTTP_PROXY_METHOD << "=" << optarg << "\n";
|
2006-02-22 15:40:04 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 15:
|
|
|
|
cmdstream << PREF_LISTEN_PORT << "=" << optarg << "\n";
|
2006-03-21 14:12:51 +00:00
|
|
|
break;
|
|
|
|
case 16:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_FOLLOW_TORRENT << "=" << optarg << "\n";
|
2006-04-06 12:52:16 +00:00
|
|
|
break;
|
|
|
|
case 18:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_NO_PREALLOCATION << "=" << V_TRUE << "\n";
|
2006-04-06 12:52:16 +00:00
|
|
|
break;
|
2006-04-12 13:55:43 +00:00
|
|
|
case 19:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_DIRECT_FILE_MAPPING << "=" << optarg << "\n";
|
2006-04-28 15:55:11 +00:00
|
|
|
break;
|
|
|
|
case 21:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_SELECT_FILE << "=" << optarg << "\n";
|
2006-04-28 15:55:11 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 22:
|
|
|
|
cmdstream << PREF_SEED_TIME << "=" << optarg << "\n";
|
2006-08-27 12:49:17 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 23:
|
|
|
|
cmdstream << PREF_SEED_RATIO << "=" << optarg << "\n";
|
2006-08-27 12:49:17 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 24:
|
|
|
|
cmdstream << PREF_MAX_UPLOAD_LIMIT << "=" << optarg << "\n";
|
2006-09-21 14:37:15 +00:00
|
|
|
break;
|
2006-07-04 10:57:56 +00:00
|
|
|
case 100:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_METALINK_VERSION << "=" << optarg << "\n";
|
2006-07-04 10:57:56 +00:00
|
|
|
break;
|
|
|
|
case 101:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_METALINK_LANGUAGE << "=" << optarg << "\n";
|
2006-07-04 10:57:56 +00:00
|
|
|
break;
|
|
|
|
case 102:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_METALINK_OS << "=" << optarg << "\n";
|
2006-07-04 10:57:56 +00:00
|
|
|
break;
|
|
|
|
case 103:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_FOLLOW_METALINK << "=" << optarg << "\n";
|
2006-07-04 10:57:56 +00:00
|
|
|
break;
|
2006-11-08 16:25:38 +00:00
|
|
|
case 104:
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_METALINK_LOCATION << "=" << optarg << "\n";
|
2006-11-08 16:25:38 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 200:
|
|
|
|
cmdstream << PREF_LOWEST_SPEED_LIMIT << "=" << optarg << "\n";
|
2006-08-07 16:05:00 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 201:
|
|
|
|
cmdstream << PREF_MAX_DOWNLOAD_LIMIT << "=" << optarg << "\n";
|
2006-09-21 14:37:15 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 202:
|
|
|
|
cmdstream << PREF_ALLOW_OVERWRITE << "=" << optarg << "\n";
|
2007-01-28 14:18:35 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 203:
|
|
|
|
cmdstream << PREF_CHECK_INTEGRITY << "=" << optarg << "\n";
|
2007-01-28 14:18:35 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 204:
|
|
|
|
cmdstream << PREF_REALTIME_CHUNK_CHECKSUM << "=" << optarg << "\n";
|
2007-01-28 14:18:35 +00:00
|
|
|
break;
|
2007-06-10 07:55:43 +00:00
|
|
|
case 205:
|
|
|
|
cmdstream << PREF_LOAD_COOKIES << "=" << optarg << "\n";
|
|
|
|
break;
|
2007-01-11 16:32:31 +00:00
|
|
|
}
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'D':
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_DAEMON << "=" << V_TRUE << "\n";
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 'd':
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_DIR << "=" << optarg << "\n";
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 'o':
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_OUT << "=" << optarg << "\n";
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
|
|
|
case 'l':
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_LOG << "=" << optarg << "\n";
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 's':
|
|
|
|
cmdstream << PREF_SPLIT << "=" << optarg << "\n";
|
2006-02-17 13:35:04 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 't':
|
|
|
|
cmdstream << PREF_TIMEOUT << "=" << optarg << "\n";
|
2006-02-21 14:00:58 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 'm':
|
|
|
|
cmdstream << PREF_MAX_TRIES << "=" << optarg << "\n";
|
2006-02-22 11:18:47 +00:00
|
|
|
break;
|
2006-02-21 14:00:58 +00:00
|
|
|
case 'p':
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_FTP_PASV << "=" << V_TRUE << "\n";
|
2006-02-21 14:00:58 +00:00
|
|
|
break;
|
2006-04-18 17:06:17 +00:00
|
|
|
case 'S':
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_SHOW_FILES << "=" << V_TRUE << "\n";
|
2006-04-18 17:06:17 +00:00
|
|
|
break;
|
|
|
|
case 'T':
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_TORRENT_FILE << "=" << optarg << "\n";
|
2006-04-18 17:06:17 +00:00
|
|
|
break;
|
2006-07-03 14:19:23 +00:00
|
|
|
case 'M':
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_METALINK_FILE << "=" << optarg << "\n";
|
2006-07-03 14:19:23 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 'C':
|
|
|
|
cmdstream << PREF_METALINK_SERVERS << "=" << optarg << "\n";
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Option.h
(getAsBool): New function.
* src/Option.cc
(prefs.h): Included.
(defined): 0-length value is now recognized as undefined.
(getAsInt): Rewritten.
(getAsLLInt): Rewritten.
(getAsBool): New function.
* src/FeatureConfig.h: Rewritten.
* src/FeatureConfig.cc: Rewritten.
* src/prefs.h
(PREF_STDOUT_LOG): New definition.
(PREF_LOG): New definition.
(PREF_DIR): New definition.
(PREF_OUT): New definition.
(PREF_SPLIT): New definition.
(PREF_DAEMON): New definition.
(PREF_REFERER): New definition.
(PREF_TORRENT_FILE): New definition.
(PREF_LISTEN_PORT): New definition.
(PREF_METALINK_FILE): New definition.
(PREF_METALINK_VERSION): New definition.
(PREF_METALINK_LANGUAGE): New definition.
(PREF_METALINK_OS): New definition.
(PREF_METALINK_SERVERS): New definition.
* src/main.cc
(main): Following command-line parameters are now put into
Option
class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
metalinkLanguage, metalinkOs, metalinkServers
To fix the bug that aria2 can not handle http response header
properly.
* src/HttpHeader.cc
(put): Made name lowercased.
(defined): Made name lowercased.
(getFirst): Made name lowercased.
(get): Made name lowercased.
(getFirstAsInt): Rewritten.
(getFirstAsLLInt): Rewritten.
2006-08-03 12:36:02 +00:00
|
|
|
break;
|
2007-03-26 12:16:57 +00:00
|
|
|
case 'a':
|
|
|
|
cmdstream << PREF_FILE_ALLOCATION << "=" << optarg << "\n";
|
2007-01-08 00:13:25 +00:00
|
|
|
break;
|
2007-03-24 14:32:49 +00:00
|
|
|
case 'c':
|
2007-03-26 12:16:57 +00:00
|
|
|
cmdstream << PREF_CONTINUE << "=" << V_TRUE << "\n";
|
|
|
|
break;
|
|
|
|
case 'U':
|
|
|
|
cmdstream << PREF_USER_AGENT << "=" << optarg << "\n";
|
2007-03-24 14:32:49 +00:00
|
|
|
break;
|
2007-03-27 16:16:44 +00:00
|
|
|
case 'n':
|
|
|
|
cmdstream << PREF_NO_NETRC << "=" << V_TRUE << "\n";
|
|
|
|
break;
|
2007-05-20 13:51:52 +00:00
|
|
|
case 'i':
|
|
|
|
cmdstream << PREF_INPUT_FILE << "=" << optarg << "\n";
|
|
|
|
break;
|
2007-06-09 10:06:53 +00:00
|
|
|
case 'j':
|
|
|
|
cmdstream << PREF_MAX_CONCURRENT_DOWNLOADS << "=" << optarg << "\n";
|
|
|
|
break;
|
2006-02-17 13:35:04 +00:00
|
|
|
case 'v':
|
|
|
|
showVersion();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_SUCCESS);
|
2006-02-17 13:35:04 +00:00
|
|
|
case 'h':
|
|
|
|
showUsage();
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_SUCCESS);
|
2006-02-17 13:35:04 +00:00
|
|
|
default:
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
|
|
|
}
|
2007-03-26 12:16:57 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
OptionParser oparser;
|
|
|
|
oparser.setOptionHandlers(OptionHandlerFactory::createOptionHandlers());
|
|
|
|
string cfname = Util::getHomeDir()+"/.aria2/aria2.conf";
|
|
|
|
ifstream cfstream(cfname.c_str());
|
|
|
|
try {
|
|
|
|
oparser.parse(op, cfstream);
|
|
|
|
} catch(Exception* e) {
|
|
|
|
cerr << "Parse error in " << cfname << endl;
|
|
|
|
cerr << e->getMsg() << endl;
|
|
|
|
delete e;
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
oparser.parse(op, cmdstream);
|
|
|
|
} catch(Exception* e) {
|
|
|
|
cerr << e->getMsg() << endl;
|
|
|
|
delete e;
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(op->defined(PREF_HTTP_USER)) {
|
|
|
|
op->put(PREF_HTTP_AUTH_ENABLED, V_TRUE);
|
|
|
|
}
|
|
|
|
if(op->defined(PREF_HTTP_PROXY_USER)) {
|
|
|
|
op->put(PREF_HTTP_PROXY_AUTH_ENABLED, V_TRUE);
|
|
|
|
}
|
2007-07-04 16:04:57 +00:00
|
|
|
if(
|
|
|
|
#ifdef ENABLE_BITTORRENT
|
|
|
|
!op->defined(PREF_TORRENT_FILE) &&
|
|
|
|
#endif // ENABLE_BITTORRENT
|
|
|
|
#ifdef ENABLE_METALINK
|
|
|
|
!op->defined(PREF_METALINK_FILE) &&
|
|
|
|
#endif // ENABLE_METALINK
|
2007-06-03 14:24:37 +00:00
|
|
|
!op->defined(PREF_INPUT_FILE)) {
|
2006-03-21 14:12:51 +00:00
|
|
|
if(optind == argc) {
|
|
|
|
cerr << _("specify at least one URL") << endl;
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-03-21 14:12:51 +00:00
|
|
|
}
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Option.h
(getAsBool): New function.
* src/Option.cc
(prefs.h): Included.
(defined): 0-length value is now recognized as undefined.
(getAsInt): Rewritten.
(getAsLLInt): Rewritten.
(getAsBool): New function.
* src/FeatureConfig.h: Rewritten.
* src/FeatureConfig.cc: Rewritten.
* src/prefs.h
(PREF_STDOUT_LOG): New definition.
(PREF_LOG): New definition.
(PREF_DIR): New definition.
(PREF_OUT): New definition.
(PREF_SPLIT): New definition.
(PREF_DAEMON): New definition.
(PREF_REFERER): New definition.
(PREF_TORRENT_FILE): New definition.
(PREF_LISTEN_PORT): New definition.
(PREF_METALINK_FILE): New definition.
(PREF_METALINK_VERSION): New definition.
(PREF_METALINK_LANGUAGE): New definition.
(PREF_METALINK_OS): New definition.
(PREF_METALINK_SERVERS): New definition.
* src/main.cc
(main): Following command-line parameters are now put into
Option
class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
metalinkLanguage, metalinkOs, metalinkServers
To fix the bug that aria2 can not handle http response header
properly.
* src/HttpHeader.cc
(put): Made name lowercased.
(defined): Made name lowercased.
(getFirst): Made name lowercased.
(get): Made name lowercased.
(getFirstAsInt): Rewritten.
(getFirstAsLLInt): Rewritten.
2006-08-03 12:36:02 +00:00
|
|
|
if(op->getAsBool(PREF_DAEMON)) {
|
2006-02-17 13:35:04 +00:00
|
|
|
if(daemon(1, 1) < 0) {
|
2006-04-18 17:06:17 +00:00
|
|
|
perror(_("daemon failed"));
|
2006-07-04 10:57:56 +00:00
|
|
|
exit(EXIT_FAILURE);
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-28 15:55:11 +00:00
|
|
|
Strings args(argv+optind, argv+argc);
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Option.h
(getAsBool): New function.
* src/Option.cc
(prefs.h): Included.
(defined): 0-length value is now recognized as undefined.
(getAsInt): Rewritten.
(getAsLLInt): Rewritten.
(getAsBool): New function.
* src/FeatureConfig.h: Rewritten.
* src/FeatureConfig.cc: Rewritten.
* src/prefs.h
(PREF_STDOUT_LOG): New definition.
(PREF_LOG): New definition.
(PREF_DIR): New definition.
(PREF_OUT): New definition.
(PREF_SPLIT): New definition.
(PREF_DAEMON): New definition.
(PREF_REFERER): New definition.
(PREF_TORRENT_FILE): New definition.
(PREF_LISTEN_PORT): New definition.
(PREF_METALINK_FILE): New definition.
(PREF_METALINK_VERSION): New definition.
(PREF_METALINK_LANGUAGE): New definition.
(PREF_METALINK_OS): New definition.
(PREF_METALINK_SERVERS): New definition.
* src/main.cc
(main): Following command-line parameters are now put into
Option
class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
metalinkLanguage, metalinkOs, metalinkServers
To fix the bug that aria2 can not handle http response header
properly.
* src/HttpHeader.cc
(put): Made name lowercased.
(defined): Made name lowercased.
(getFirst): Made name lowercased.
(get): Made name lowercased.
(getFirstAsInt): Rewritten.
(getFirstAsLLInt): Rewritten.
2006-08-03 12:36:02 +00:00
|
|
|
|
2006-02-17 18:51:12 +00:00
|
|
|
#ifdef HAVE_LIBSSL
|
|
|
|
// for SSL initialization
|
|
|
|
SSL_load_error_strings();
|
|
|
|
SSL_library_init();
|
|
|
|
#endif // HAVE_LIBSSL
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* configure.in: Added gnutls support. Added several CPP macros.
* m4/openssl.m4: Added.
* src/SocketCore.{h,cc}: Drop const quarifier from writeData(),
readData(), peekData(). Added gnutls support.
* src/HttpDownloadCommand.cc: Removed SleepCommand.h
* src/TrackerWatcherCommand.{h,cc}: Added. This command creates
TrackerInitCommand periodicaly(TorrentMan::minInterval).
* src/TorrentMan.cc: Remove downloadedSize == 0 check from
save().
Instead, added a check for whether setup method has executed
successfully.
* src/TorrentMan.h: Added member vaiable setupComplete. Updated
DEFAULT_ANNOUNCE_INTERVAL and DEFAULT_ANNOUNCE_MIN_INTERVAL to
300.
* src/Makefile.am: Updated.
* src/messageDigest.h: Added. This is a macro calculating SHA1
digest
using whether OpenSSL or gcrypt, depending on the result of
configure
script.
* src/ShaVisitor.{h,cc}: Removed direct dependency on OpenSSL by
using
messageDigest.h.
* src/TorrentAutoSaveCommand.h: Removed unused variable cuid.
* src/PeerListenCommand.cc: Added log about port binded
successfully.
Fixed memory leak.
* src/main.cc: Added gnutls support. Replaced LIB_SSL with
ENABLE_BITTORRENT where they are not related to OpenSSL but
BitTorrent.
Removed instantiation of TrackerInitCommand. Instead,
TrackerWatcherCommand is instantiated and pushed to the command
queue.
* src/InitiateConnectionCommandFactory.cc: Replaced HAVE_LIBSSL
with
ENABLE_SSL.
* src/Request.cc: Replaced HAVE_LIBSSL with ENABLE_SSL.
* src/RequestSlotMan.cc:
(deleteCompletedRequestSlot)
If a piece is already acquired by another command, delete the
request
slots for the piece.
* src/TrackerUpdateCommand.cc:
(execute)
Changed log level of MSG_TRACKER_WARNING_MESSAGE from info to
warn.
Added a check whether peer list is null.
Fixed the bug that causes sending completed event to the tracker
several times.
* src/TrackerInitCommand.cc:
(execute)
Fixed the bug that causes sending completed event to the tracker
several times.
* src/AbstractDiskWriter.{h,cc}: Removed direct dependency on
OpenSSL
by using messageDigest.h.
2006-03-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* PeerConnection.cc: Replaced log message "keep-alive" with
"keep alive".
* PeerInteractionCommand.{h,cc}: Close connection if peer is
choking
localhost long time.
* TorrentMan.cc: When adding new peer with duplicate = true, if
the
number of peer list is equal to or grater than MAX_PEER_LIST,
delete
at most 100 failure entry from the list. If with duplicate =
false,
MAX_PEER_LIST is not checked.
* PeerListenCommand.cc: Fixed the argument order of log message.
2006-03-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* Logger.h: Moved enum LEVEL from SimpleLogger.h to here.
Added warn().
* SimpleLogger.h: Moved enum LEVEL to Logger.h.
Implemented warn().
Defined 2 macros(WRITE_LOG, WRITE_LOG_EX) to avoid duplicated
code.
2006-03-27 14:47:26 +00:00
|
|
|
#ifdef HAVE_LIBGNUTLS
|
|
|
|
gnutls_global_init();
|
|
|
|
#endif // HAVE_LIBGNUTLS
|
2006-07-04 10:57:56 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
2006-07-03 14:19:23 +00:00
|
|
|
xmlInitParser();
|
2006-07-04 10:57:56 +00:00
|
|
|
#endif // ENABLE_METALINK
|
2006-12-24 06:25:21 +00:00
|
|
|
SimpleRandomizer::init();
|
|
|
|
BitfieldManFactory::setDefaultRandomizer(SimpleRandomizer::getInstance());
|
2007-01-08 00:13:25 +00:00
|
|
|
FileAllocationMonitorFactory::setFactory(new ConsoleFileAllocationMonitorFactory());
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Option.h
(getAsBool): New function.
* src/Option.cc
(prefs.h): Included.
(defined): 0-length value is now recognized as undefined.
(getAsInt): Rewritten.
(getAsLLInt): Rewritten.
(getAsBool): New function.
* src/FeatureConfig.h: Rewritten.
* src/FeatureConfig.cc: Rewritten.
* src/prefs.h
(PREF_STDOUT_LOG): New definition.
(PREF_LOG): New definition.
(PREF_DIR): New definition.
(PREF_OUT): New definition.
(PREF_SPLIT): New definition.
(PREF_DAEMON): New definition.
(PREF_REFERER): New definition.
(PREF_TORRENT_FILE): New definition.
(PREF_LISTEN_PORT): New definition.
(PREF_METALINK_FILE): New definition.
(PREF_METALINK_VERSION): New definition.
(PREF_METALINK_LANGUAGE): New definition.
(PREF_METALINK_OS): New definition.
(PREF_METALINK_SERVERS): New definition.
* src/main.cc
(main): Following command-line parameters are now put into
Option
class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
metalinkLanguage, metalinkOs, metalinkServers
To fix the bug that aria2 can not handle http response header
properly.
* src/HttpHeader.cc
(put): Made name lowercased.
(defined): Made name lowercased.
(getFirst): Made name lowercased.
(get): Made name lowercased.
(getFirstAsInt): Rewritten.
(getFirstAsLLInt): Rewritten.
2006-08-03 12:36:02 +00:00
|
|
|
if(op->getAsBool(PREF_STDOUT_LOG)) {
|
2006-04-17 16:17:20 +00:00
|
|
|
LogFactory::setLogFile("/dev/stdout");
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Option.h
(getAsBool): New function.
* src/Option.cc
(prefs.h): Included.
(defined): 0-length value is now recognized as undefined.
(getAsInt): Rewritten.
(getAsLLInt): Rewritten.
(getAsBool): New function.
* src/FeatureConfig.h: Rewritten.
* src/FeatureConfig.cc: Rewritten.
* src/prefs.h
(PREF_STDOUT_LOG): New definition.
(PREF_LOG): New definition.
(PREF_DIR): New definition.
(PREF_OUT): New definition.
(PREF_SPLIT): New definition.
(PREF_DAEMON): New definition.
(PREF_REFERER): New definition.
(PREF_TORRENT_FILE): New definition.
(PREF_LISTEN_PORT): New definition.
(PREF_METALINK_FILE): New definition.
(PREF_METALINK_VERSION): New definition.
(PREF_METALINK_LANGUAGE): New definition.
(PREF_METALINK_OS): New definition.
(PREF_METALINK_SERVERS): New definition.
* src/main.cc
(main): Following command-line parameters are now put into
Option
class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
metalinkLanguage, metalinkOs, metalinkServers
To fix the bug that aria2 can not handle http response header
properly.
* src/HttpHeader.cc
(put): Made name lowercased.
(defined): Made name lowercased.
(getFirst): Made name lowercased.
(get): Made name lowercased.
(getFirstAsInt): Rewritten.
(getFirstAsLLInt): Rewritten.
2006-08-03 12:36:02 +00:00
|
|
|
} else if(op->get(PREF_LOG).size()) {
|
|
|
|
LogFactory::setLogFile(op->get(PREF_LOG));
|
2006-08-27 12:49:17 +00:00
|
|
|
} else {
|
|
|
|
LogFactory::setLogFile("/dev/null");
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
2006-11-08 16:25:38 +00:00
|
|
|
int exitStatus = EXIT_SUCCESS;
|
2006-04-19 17:23:58 +00:00
|
|
|
try {
|
2006-08-07 16:05:00 +00:00
|
|
|
Logger* logger = LogFactory::getInstance();
|
|
|
|
logger->info("%s %s", PACKAGE, PACKAGE_VERSION);
|
|
|
|
logger->info("Logging started.");
|
2006-04-19 17:23:58 +00:00
|
|
|
|
2007-03-21 10:19:23 +00:00
|
|
|
RequestFactoryHandle requestFactory = new RequestFactory();
|
|
|
|
requestFactory->setOption(op);
|
2007-03-29 11:29:45 +00:00
|
|
|
File netrccf(op->get(PREF_NETRC_PATH));
|
|
|
|
if(!op->getAsBool(PREF_NO_NETRC) && netrccf.isFile()) {
|
|
|
|
mode_t mode = netrccf.mode();
|
|
|
|
if(mode&(S_IRWXG|S_IRWXO)) {
|
|
|
|
logger->notice(".netrc file %s does not have correct permissions. It should be 600. netrc support disabled.",
|
|
|
|
op->get(PREF_NETRC_PATH).c_str());
|
|
|
|
} else {
|
|
|
|
NetrcHandle netrc = new Netrc();
|
|
|
|
netrc->parse(op->get(PREF_NETRC_PATH));
|
|
|
|
requestFactory->setNetrc(netrc);
|
|
|
|
}
|
|
|
|
}
|
2007-06-10 07:55:43 +00:00
|
|
|
|
|
|
|
CookieBoxFactoryHandle cookieBoxFactory = new CookieBoxFactory();
|
|
|
|
CookieBoxFactorySingletonHolder::instance(cookieBoxFactory);
|
|
|
|
if(op->defined(PREF_LOAD_COOKIES)) {
|
|
|
|
File cookieFile(op->get(PREF_LOAD_COOKIES));
|
|
|
|
if(cookieFile.isFile()) {
|
|
|
|
ifstream in(op->get(PREF_LOAD_COOKIES).c_str());
|
|
|
|
CookieBoxFactorySingletonHolder::instance()->loadDefaultCookie(in);
|
|
|
|
} else {
|
|
|
|
logger->error("Failed to load cookies from %s", op->get(PREF_LOAD_COOKIES).c_str());
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-21 10:19:23 +00:00
|
|
|
RequestFactorySingletonHolder::instance(requestFactory);
|
2007-05-20 13:51:52 +00:00
|
|
|
CUIDCounterHandle cuidCounter = new CUIDCounter();
|
|
|
|
CUIDCounterSingletonHolder::instance(cuidCounter);
|
2007-03-18 15:42:34 +00:00
|
|
|
|
2006-11-09 14:04:46 +00:00
|
|
|
Util::setGlobalSignalHandler(SIGPIPE, SIG_IGN, 0);
|
2006-03-21 14:12:51 +00:00
|
|
|
|
2007-06-30 09:52:39 +00:00
|
|
|
RequestInfo* firstReqInfo;
|
2006-08-07 16:05:00 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
|
|
|
if(op->defined(PREF_TORRENT_FILE)) {
|
2006-11-08 16:25:38 +00:00
|
|
|
firstReqInfo = new TorrentRequestInfo(op->get(PREF_TORRENT_FILE),
|
2006-08-07 16:05:00 +00:00
|
|
|
op);
|
|
|
|
Strings targetFiles;
|
|
|
|
if(op->defined(PREF_TORRENT_FILE) && !args.empty()) {
|
|
|
|
targetFiles = args;
|
2006-03-21 14:12:51 +00:00
|
|
|
}
|
2006-11-08 16:25:38 +00:00
|
|
|
((TorrentRequestInfo*)firstReqInfo)->setTargetFiles(targetFiles);
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|
2006-08-07 16:05:00 +00:00
|
|
|
else
|
|
|
|
#endif // ENABLE_BITTORRENT
|
2006-07-04 10:57:56 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
2006-08-07 16:05:00 +00:00
|
|
|
if(op->defined(PREF_METALINK_FILE)) {
|
2006-11-08 16:25:38 +00:00
|
|
|
firstReqInfo = new MetalinkRequestInfo(op->get(PREF_METALINK_FILE),
|
2007-05-20 13:51:52 +00:00
|
|
|
op);
|
2007-06-30 09:52:39 +00:00
|
|
|
Strings targetFiles;
|
|
|
|
if(op->defined(PREF_METALINK_FILE) && !args.empty()) {
|
|
|
|
targetFiles = args;
|
|
|
|
}
|
|
|
|
((MetalinkRequestInfo*)firstReqInfo)->setTargetFiles(targetFiles);
|
2007-05-20 13:51:52 +00:00
|
|
|
}
|
|
|
|
else
|
2006-08-07 16:05:00 +00:00
|
|
|
#endif // ENABLE_METALINK
|
2007-05-20 13:51:52 +00:00
|
|
|
if(op->defined(PREF_INPUT_FILE)) {
|
2007-07-05 15:45:03 +00:00
|
|
|
SharedHandle<UriListParser> flparser(0);
|
2007-07-05 15:14:00 +00:00
|
|
|
if(op->get(PREF_INPUT_FILE) == "-") {
|
2007-07-05 15:45:03 +00:00
|
|
|
flparser = new StreamUriListParser(cin);
|
2007-07-05 15:14:00 +00:00
|
|
|
} else {
|
|
|
|
if(!File(op->get(PREF_INPUT_FILE)).isFile()) {
|
|
|
|
throw new FatalException(EX_FILE_OPEN, op->get(PREF_INPUT_FILE).c_str(), "No such file");
|
|
|
|
}
|
2007-07-05 15:45:03 +00:00
|
|
|
flparser = new FileUriListParser(op->get(PREF_INPUT_FILE));
|
2007-07-05 15:14:00 +00:00
|
|
|
}
|
2007-05-20 13:51:52 +00:00
|
|
|
RequestGroups groups;
|
2007-07-05 15:14:00 +00:00
|
|
|
while(flparser->hasNext()) {
|
|
|
|
Strings uris = flparser->next();
|
2007-05-20 13:51:52 +00:00
|
|
|
if(!uris.empty()) {
|
2007-07-02 12:40:40 +00:00
|
|
|
Strings xuris;
|
|
|
|
ncopy(uris.begin(), uris.end(), op->getAsInt(PREF_SPLIT),
|
|
|
|
back_inserter(xuris));
|
|
|
|
RequestGroupHandle rg = new RequestGroup(xuris, op);
|
2007-05-20 13:51:52 +00:00
|
|
|
groups.push_back(rg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
firstReqInfo = new MultiUrlRequestInfo(groups, op);
|
2006-08-07 16:05:00 +00:00
|
|
|
}
|
2007-05-20 13:51:52 +00:00
|
|
|
else
|
|
|
|
{
|
2007-07-02 12:40:40 +00:00
|
|
|
Strings xargs;
|
|
|
|
ncopy(args.begin(), args.end(), op->getAsInt(PREF_SPLIT),
|
|
|
|
back_inserter(xargs));
|
|
|
|
firstReqInfo = new MultiUrlRequestInfo(xargs, op);
|
2007-05-20 13:51:52 +00:00
|
|
|
}
|
2006-02-17 13:35:04 +00:00
|
|
|
|
2006-11-08 16:25:38 +00:00
|
|
|
RequestInfos reqInfos;
|
|
|
|
if(firstReqInfo) {
|
|
|
|
reqInfos.push_front(firstReqInfo);
|
|
|
|
}
|
|
|
|
while(reqInfos.size()) {
|
|
|
|
RequestInfoHandle reqInfo = reqInfos.front();
|
|
|
|
reqInfos.pop_front();
|
|
|
|
RequestInfos nextReqInfos = reqInfo->execute();
|
|
|
|
copy(nextReqInfos.begin(), nextReqInfos.end(), front_inserter(reqInfos));
|
2007-05-20 13:51:52 +00:00
|
|
|
/*
|
2006-11-08 16:25:38 +00:00
|
|
|
if(reqInfo->isFail()) {
|
|
|
|
exitStatus = EXIT_FAILURE;
|
|
|
|
} else if(reqInfo->getFileInfo().checkReady()) {
|
2006-08-14 11:38:28 +00:00
|
|
|
cout << _("Now verifying checksum.\n"
|
|
|
|
"This may take some time depending on your PC environment"
|
|
|
|
" and the size of file.") << endl;
|
2006-11-08 16:25:38 +00:00
|
|
|
if(reqInfo->getFileInfo().check()) {
|
2006-08-14 11:38:28 +00:00
|
|
|
cout << _("checksum OK.") << endl;
|
2006-04-28 15:55:11 +00:00
|
|
|
} else {
|
2006-08-07 16:05:00 +00:00
|
|
|
// TODO
|
2006-08-14 11:38:28 +00:00
|
|
|
cout << _("checksum ERROR.") << endl;
|
2006-11-08 16:25:38 +00:00
|
|
|
exitStatus = EXIT_FAILURE;
|
2006-04-06 12:52:16 +00:00
|
|
|
}
|
2006-04-01 14:39:45 +00:00
|
|
|
}
|
2007-05-20 13:51:52 +00:00
|
|
|
*/
|
2006-03-21 14:12:51 +00:00
|
|
|
}
|
2006-08-07 16:05:00 +00:00
|
|
|
} catch(Exception* ex) {
|
2007-05-20 14:27:28 +00:00
|
|
|
cerr << "Exception caught:\n" << ex->getMsg() << endl;
|
2006-08-07 16:05:00 +00:00
|
|
|
delete ex;
|
|
|
|
exit(EXIT_FAILURE);
|
2006-03-02 02:54:49 +00:00
|
|
|
}
|
2006-05-09 15:54:14 +00:00
|
|
|
delete op;
|
|
|
|
LogFactory::release();
|
2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* configure.in: Added gnutls support. Added several CPP macros.
* m4/openssl.m4: Added.
* src/SocketCore.{h,cc}: Drop const quarifier from writeData(),
readData(), peekData(). Added gnutls support.
* src/HttpDownloadCommand.cc: Removed SleepCommand.h
* src/TrackerWatcherCommand.{h,cc}: Added. This command creates
TrackerInitCommand periodicaly(TorrentMan::minInterval).
* src/TorrentMan.cc: Remove downloadedSize == 0 check from
save().
Instead, added a check for whether setup method has executed
successfully.
* src/TorrentMan.h: Added member vaiable setupComplete. Updated
DEFAULT_ANNOUNCE_INTERVAL and DEFAULT_ANNOUNCE_MIN_INTERVAL to
300.
* src/Makefile.am: Updated.
* src/messageDigest.h: Added. This is a macro calculating SHA1
digest
using whether OpenSSL or gcrypt, depending on the result of
configure
script.
* src/ShaVisitor.{h,cc}: Removed direct dependency on OpenSSL by
using
messageDigest.h.
* src/TorrentAutoSaveCommand.h: Removed unused variable cuid.
* src/PeerListenCommand.cc: Added log about port binded
successfully.
Fixed memory leak.
* src/main.cc: Added gnutls support. Replaced LIB_SSL with
ENABLE_BITTORRENT where they are not related to OpenSSL but
BitTorrent.
Removed instantiation of TrackerInitCommand. Instead,
TrackerWatcherCommand is instantiated and pushed to the command
queue.
* src/InitiateConnectionCommandFactory.cc: Replaced HAVE_LIBSSL
with
ENABLE_SSL.
* src/Request.cc: Replaced HAVE_LIBSSL with ENABLE_SSL.
* src/RequestSlotMan.cc:
(deleteCompletedRequestSlot)
If a piece is already acquired by another command, delete the
request
slots for the piece.
* src/TrackerUpdateCommand.cc:
(execute)
Changed log level of MSG_TRACKER_WARNING_MESSAGE from info to
warn.
Added a check whether peer list is null.
Fixed the bug that causes sending completed event to the tracker
several times.
* src/TrackerInitCommand.cc:
(execute)
Fixed the bug that causes sending completed event to the tracker
several times.
* src/AbstractDiskWriter.{h,cc}: Removed direct dependency on
OpenSSL
by using messageDigest.h.
2006-03-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* PeerConnection.cc: Replaced log message "keep-alive" with
"keep alive".
* PeerInteractionCommand.{h,cc}: Close connection if peer is
choking
localhost long time.
* TorrentMan.cc: When adding new peer with duplicate = true, if
the
number of peer list is equal to or grater than MAX_PEER_LIST,
delete
at most 100 failure entry from the list. If with duplicate =
false,
MAX_PEER_LIST is not checked.
* PeerListenCommand.cc: Fixed the argument order of log message.
2006-03-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* Logger.h: Moved enum LEVEL from SimpleLogger.h to here.
Added warn().
* SimpleLogger.h: Moved enum LEVEL to Logger.h.
Implemented warn().
Defined 2 macros(WRITE_LOG, WRITE_LOG_EX) to avoid duplicated
code.
2006-03-27 14:47:26 +00:00
|
|
|
#ifdef HAVE_LIBGNUTLS
|
|
|
|
gnutls_global_deinit();
|
|
|
|
#endif // HAVE_LIBGNUTLS
|
2006-07-04 10:57:56 +00:00
|
|
|
#ifdef ENABLE_METALINK
|
2006-07-03 14:19:23 +00:00
|
|
|
xmlCleanupParser();
|
2006-07-04 10:57:56 +00:00
|
|
|
#endif // ENABLE_METALINK
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Option.h
(getAsBool): New function.
* src/Option.cc
(prefs.h): Included.
(defined): 0-length value is now recognized as undefined.
(getAsInt): Rewritten.
(getAsLLInt): Rewritten.
(getAsBool): New function.
* src/FeatureConfig.h: Rewritten.
* src/FeatureConfig.cc: Rewritten.
* src/prefs.h
(PREF_STDOUT_LOG): New definition.
(PREF_LOG): New definition.
(PREF_DIR): New definition.
(PREF_OUT): New definition.
(PREF_SPLIT): New definition.
(PREF_DAEMON): New definition.
(PREF_REFERER): New definition.
(PREF_TORRENT_FILE): New definition.
(PREF_LISTEN_PORT): New definition.
(PREF_METALINK_FILE): New definition.
(PREF_METALINK_VERSION): New definition.
(PREF_METALINK_LANGUAGE): New definition.
(PREF_METALINK_OS): New definition.
(PREF_METALINK_SERVERS): New definition.
* src/main.cc
(main): Following command-line parameters are now put into
Option
class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
metalinkLanguage, metalinkOs, metalinkServers
To fix the bug that aria2 can not handle http response header
properly.
* src/HttpHeader.cc
(put): Made name lowercased.
(defined): Made name lowercased.
(getFirst): Made name lowercased.
(get): Made name lowercased.
(getFirstAsInt): Rewritten.
(getFirstAsLLInt): Rewritten.
2006-08-03 12:36:02 +00:00
|
|
|
FeatureConfig::release();
|
2006-11-08 16:25:38 +00:00
|
|
|
return exitStatus;
|
2006-02-17 13:35:04 +00:00
|
|
|
}
|