2006-08-08 Tatsuhiro Tsujikawa <tujikawa@rednoah.com>

* src/FtpNegotiateCommand.cc
	(recvGreeting): Call disableWriteCheckSocket just after
	socket->setBlockingMode(). This avoids unnecessary CPU-hog loop.

2006-08-07  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>

	* src/PeerChokeCommand.h
	(PeerChokeCommand): Rearranged the arguments.
	* src/PeerChokeCommand.cc
	(PeerChokeCommand): Rearranged the arguments.

	* src/MetalinkEntry.h
	(Checksum.h): Included.
	(md5): Removed.
	(sha1): Removed.
	(checksum): New variable.
	(operator=): Updated.
	(check): Removed.

	* src/prefs.h
	(PREF_LOWEST_SPEED_LIMIT): New definition.
	(PREF_FOLLOW_TORRENT): New definition.
	(PREF_SELECT_FILE): New definition.
	(PREF_FOLLOW_METALINK): New definition.

	* src/MetalinkResource.h
	(TYPE_HTTPS): Added to enum TYPE.

	* src/TorrentMan.cc
	(~TorrentMan): Rewritten.

	* src/MultiDiskWriter.cc
	(MultiDiskAdaptor): Updated according to the changes in
	MessageDigestContext.
	(~MultiDiskAdaptor): Updated according to the changes in
	MessageDigestContext.
	(hashUpdate): Updated according to the changes in 
MessageDigestContext.
	(sha1Sum): Updated according to the changes in 
MessageDigestContext.

	* src/Util.h
	(fileChecksum): Updated according to the changes in
	MessageDigestContext.
	* src/Util.cc
	(sha1Sum): Updated according to the changes in 
MessageDigestContext.
	(fileChecksum): Updated according to the changes in
	MessageDigestContext.

	* src/messageDigest.h: Rewritten.

	* src/MetalinkEntry.cc
	(check): Removed.
	(Supported): Updated.
	(dropUnsupportedResource): Fixed a memory leak.

	* src/ShaVisitor.cc
	(ShaVisitor): Updated according to the changes in 
MessageDigestContext.
	(~ShaVisitor): Updated according to the changes in
	MessageDigestContext.
	(visit): Updated according to the changes in 
MessageDigestContext.

	* src/main.cc
	(main): Rewritten the portion of download loop. 
--lowest-speed-limit
	command-line option added.

	* src/DownloadEngine.h
	(SocketEntry): New class.
	(SocketEntries): New definition.
	(PairFind): Removed.
	(SockCmdMap): Removed.
	* src/DownloadEngine.cc
	(DownloadEngine): Rewritten.
	(~DownloadEngine): Rewritten.
	(run): Renamed activeCommandUuids as activeUuids.
	(SetDescriptor): Rewritten.
	(AccumulateActiveCommandUuid): Removed.
	(AccumulateActiveUuid): New function object.
	(waitData): Rewritten.
	(updateFdSet): Rewritten.
	(addSocket): Rewritten.
	(deleteSocket): Rewritten.
	(addSocketForReadCheck): Rewritten.
	(deleteSocketForReadCheck): Rewritten.
	(addSocketForWriteCheck): Rewritten.
	(deleteSocketForWriteCheck): Rewritten.
	
	* src/Xml2MetalinkProcessor.cc
	(getEntry): Rewritten the portion of MetalinkEntry creation.

	* src/DownloadCommand.cc
	(executeInternal): Added the check routine for lowest speed 
limit.

	* src/AbstractDiskWriter.cc
	(AbstractDiskWriter): Updated according to the changes in
	MessageDigestContext.
	(~AbstractDiskWriter): Updated according to the changes in
	MessageDigestContext.
	(sha1Sum): Updated according to the changes in 
MessageDigestContext.

	* src/RequestInfo.h: New class.

	* src/UrlRequestInfo.h: New class.
	* src/UrlRequestInfo.cc: New class.

	* src/TorrentRequestInfo.h: New class.
	* src/TorrentRequestInfo.cc: New class.

	* src/MetalinkRequestInfo.h: New class.
	* src/MetalinkRequestInfo.cc: New class.

	* src/Checksum.h: New class.

	* src/DownloadEngineFactory.h: New class.
	* src/DownloadEngineFactory.cc: New class.
pull/1/head
Tatsuhiro Tsujikawa 2006-08-07 16:05:00 +00:00
parent 9251b47f6c
commit 58dbaafc85
46 changed files with 1793 additions and 945 deletions

116
ChangeLog
View File

@ -1,3 +1,119 @@
2006-08-08 Tatsuhiro Tsujikawa <tujikawa@rednoah.com>
* src/FtpNegotiateCommand.cc
(recvGreeting): Call disableWriteCheckSocket just after
socket->setBlockingMode(). This avoids unnecessary CPU-hog loop.
2006-08-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/PeerChokeCommand.h
(PeerChokeCommand): Rearranged the arguments.
* src/PeerChokeCommand.cc
(PeerChokeCommand): Rearranged the arguments.
* src/MetalinkEntry.h
(Checksum.h): Included.
(md5): Removed.
(sha1): Removed.
(checksum): New variable.
(operator=): Updated.
(check): Removed.
* src/prefs.h
(PREF_LOWEST_SPEED_LIMIT): New definition.
(PREF_FOLLOW_TORRENT): New definition.
(PREF_SELECT_FILE): New definition.
(PREF_FOLLOW_METALINK): New definition.
* src/MetalinkResource.h
(TYPE_HTTPS): Added to enum TYPE.
* src/TorrentMan.cc
(~TorrentMan): Rewritten.
* src/MultiDiskWriter.cc
(MultiDiskAdaptor): Updated according to the changes in
MessageDigestContext.
(~MultiDiskAdaptor): Updated according to the changes in
MessageDigestContext.
(hashUpdate): Updated according to the changes in MessageDigestContext.
(sha1Sum): Updated according to the changes in MessageDigestContext.
* src/Util.h
(fileChecksum): Updated according to the changes in
MessageDigestContext.
* src/Util.cc
(sha1Sum): Updated according to the changes in MessageDigestContext.
(fileChecksum): Updated according to the changes in
MessageDigestContext.
* src/messageDigest.h: Rewritten.
* src/MetalinkEntry.cc
(check): Removed.
(Supported): Updated.
(dropUnsupportedResource): Fixed a memory leak.
* src/ShaVisitor.cc
(ShaVisitor): Updated according to the changes in MessageDigestContext.
(~ShaVisitor): Updated according to the changes in
MessageDigestContext.
(visit): Updated according to the changes in MessageDigestContext.
* src/main.cc
(main): Rewritten the portion of download loop. --lowest-speed-limit
command-line option added.
* src/DownloadEngine.h
(SocketEntry): New class.
(SocketEntries): New definition.
(PairFind): Removed.
(SockCmdMap): Removed.
* src/DownloadEngine.cc
(DownloadEngine): Rewritten.
(~DownloadEngine): Rewritten.
(run): Renamed activeCommandUuids as activeUuids.
(SetDescriptor): Rewritten.
(AccumulateActiveCommandUuid): Removed.
(AccumulateActiveUuid): New function object.
(waitData): Rewritten.
(updateFdSet): Rewritten.
(addSocket): Rewritten.
(deleteSocket): Rewritten.
(addSocketForReadCheck): Rewritten.
(deleteSocketForReadCheck): Rewritten.
(addSocketForWriteCheck): Rewritten.
(deleteSocketForWriteCheck): Rewritten.
* src/Xml2MetalinkProcessor.cc
(getEntry): Rewritten the portion of MetalinkEntry creation.
* src/DownloadCommand.cc
(executeInternal): Added the check routine for lowest speed limit.
* src/AbstractDiskWriter.cc
(AbstractDiskWriter): Updated according to the changes in
MessageDigestContext.
(~AbstractDiskWriter): Updated according to the changes in
MessageDigestContext.
(sha1Sum): Updated according to the changes in MessageDigestContext.
* src/RequestInfo.h: New class.
* src/UrlRequestInfo.h: New class.
* src/UrlRequestInfo.cc: New class.
* src/TorrentRequestInfo.h: New class.
* src/TorrentRequestInfo.cc: New class.
* src/MetalinkRequestInfo.h: New class.
* src/MetalinkRequestInfo.cc: New class.
* src/Checksum.h: New class.
* src/DownloadEngineFactory.h: New class.
* src/DownloadEngineFactory.cc: New class.
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> 2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Option.h * src/Option.h

3
TODO
View File

@ -10,8 +10,7 @@
* Add max peers command-line option * Add max peers command-line option
* Refacturing HttpConnection and FtpConnection * Refacturing HttpConnection and FtpConnection
* Query resource by location * Query resource by location
* Log version
* List available os, version, etc for metalink * List available os, version, etc for metalink
* bittorrent in metalink
* rename Time to something appropriate * rename Time to something appropriate
* ipv6(RFC2428 for ftp) * ipv6(RFC2428 for ftp)
* add ru.po

26
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for aria2c 0.6.1. # Generated by GNU Autoconf 2.59 for aria2c 0.7.0.
# #
# Report bugs to <tujikawa@rednoah.com>. # Report bugs to <tujikawa@rednoah.com>.
# #
@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package. # Identity of this package.
PACKAGE_NAME='aria2c' PACKAGE_NAME='aria2c'
PACKAGE_TARNAME='aria2c' PACKAGE_TARNAME='aria2c'
PACKAGE_VERSION='0.6.1' PACKAGE_VERSION='0.7.0'
PACKAGE_STRING='aria2c 0.6.1' PACKAGE_STRING='aria2c 0.7.0'
PACKAGE_BUGREPORT='tujikawa@rednoah.com' PACKAGE_BUGREPORT='tujikawa@rednoah.com'
ac_unique_file="src/Socket.h" ac_unique_file="src/Socket.h"
@ -788,7 +788,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures aria2c 0.6.1 to adapt to many kinds of systems. \`configure' configures aria2c 0.7.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -854,7 +854,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of aria2c 0.6.1:";; short | recursive ) echo "Configuration of aria2c 0.7.0:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1000,7 +1000,7 @@ fi
test -n "$ac_init_help" && exit 0 test -n "$ac_init_help" && exit 0
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
aria2c configure 0.6.1 aria2c configure 0.7.0
generated by GNU Autoconf 2.59 generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc. Copyright (C) 2003 Free Software Foundation, Inc.
@ -1014,7 +1014,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by aria2c $as_me 0.6.1, which was It was created by aria2c $as_me 0.7.0, which was
generated by GNU Autoconf 2.59. Invocation command line was generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@ $ $0 $@
@ -1657,7 +1657,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='aria2c' PACKAGE='aria2c'
VERSION='0.6.1' VERSION='0.7.0'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@ -1927,7 +1927,7 @@ localedir=${datadir}/locale
# Check whether --with-gnutls or --without-gnutls was given. # Check whether --with-gnutls or --without-gnutls was given.
if test "${with_gnutls+set}" = set; then if test "${with_gnutls+set}" = set; then
withval="$with_gnutls" withval="$with_gnutls"
with_gnutls=$enableval with_gnutls=$withval
else else
with_gnutls=yes with_gnutls=yes
fi; fi;
@ -1935,7 +1935,7 @@ fi;
# Check whether --with-openssl or --without-openssl was given. # Check whether --with-openssl or --without-openssl was given.
if test "${with_openssl+set}" = set; then if test "${with_openssl+set}" = set; then
withval="$with_openssl" withval="$with_openssl"
with_openssl=$enableval with_openssl=$withval
else else
with_openssl=yes with_openssl=yes
fi; fi;
@ -1943,7 +1943,7 @@ fi;
# Check whether --with-libxml2 or --without-libxml2 was given. # Check whether --with-libxml2 or --without-libxml2 was given.
if test "${with_libxml2+set}" = set; then if test "${with_libxml2+set}" = set; then
withval="$with_libxml2" withval="$with_libxml2"
with_libxml2=$enableval with_libxml2=$withval
else else
with_libxml2=yes with_libxml2=yes
fi; fi;
@ -11943,7 +11943,7 @@ _ASBOX
} >&5 } >&5
cat >&5 <<_CSEOF cat >&5 <<_CSEOF
This file was extended by aria2c $as_me 0.6.1, which was This file was extended by aria2c $as_me 0.7.0, which was
generated by GNU Autoconf 2.59. Invocation command line was generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -12006,7 +12006,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\ ac_cs_version="\\
aria2c config.status 0.6.1 aria2c config.status 0.7.0
configured by $0, generated by GNU Autoconf 2.59, configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
# #
AC_PREREQ(2.59) AC_PREREQ(2.59)
AC_INIT(aria2c, 0.6.1, tujikawa@rednoah.com) AC_INIT(aria2c, 0.7.0, tujikawa@rednoah.com)
AM_INIT_AUTOMAKE() AM_INIT_AUTOMAKE()
AM_PATH_CPPUNIT(1.10.2) AM_PATH_CPPUNIT(1.10.2)
AC_CONFIG_SRCDIR([src/Socket.h]) AC_CONFIG_SRCDIR([src/Socket.h])
@ -13,9 +13,9 @@ localedir=${datadir}/locale
AC_SUBST(localedir) AC_SUBST(localedir)
# Checks for arguments. # Checks for arguments.
AC_ARG_WITH([gnutls], [ --with-gnutls use gnutls library if installed. Default: yes], [with_gnutls=$enableval], [with_gnutls=yes]) AC_ARG_WITH([gnutls], [ --with-gnutls use gnutls library if installed. Default: yes], [with_gnutls=$withval], [with_gnutls=yes])
AC_ARG_WITH([openssl], [ --with-openssl use openssl library if installed. Default: yes], [with_openssl=$enableval], [with_openssl=yes]) AC_ARG_WITH([openssl], [ --with-openssl use openssl library if installed. Default: yes], [with_openssl=$withval], [with_openssl=yes])
AC_ARG_WITH([libxml2], [ --with-libxml2 use libxml2 library if installed. Default: yes], [with_libxml2=$enableval], [with_libxml2=yes]) AC_ARG_WITH([libxml2], [ --with-libxml2 use libxml2 library if installed. Default: yes], [with_libxml2=$withval], [with_libxml2=yes])
AC_ARG_ENABLE([bittorrent], [ --enable-bittorrent enable BitTorrent support. Default: yes], [enable_bittorrent=$enableval], [enable_bittorrent=yes]) AC_ARG_ENABLE([bittorrent], [ --enable-bittorrent enable BitTorrent support. Default: yes], [enable_bittorrent=$enableval], [enable_bittorrent=yes])
AC_ARG_ENABLE([metalink], [ --enable-metalink enable Metalink support. Default: yes], [enable_metalink=$enableval], [enable_metalink=yes]) AC_ARG_ENABLE([metalink], [ --enable-metalink enable Metalink support. Default: yes], [enable_metalink=$enableval], [enable_metalink=yes])

View File

@ -1,2 +1,6 @@
../src/RequestInfo.h \
../src/message.h \ ../src/message.h \
../src/DownloadEngineFactory.cc \
../src/TorrentRequestInfo.cc \
../src/UrlRequestInfo.cc \
../src/main.cc ../src/main.cc

View File

@ -1,2 +1,6 @@
src/RequestInfo.h
src/message.h src/message.h
src/DownloadEngineFactory.cc
src/TorrentRequestInfo.cc
src/UrlRequestInfo.cc
src/main.cc src/main.cc

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n" "Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n"
"POT-Creation-Date: 2006-07-21 00:57+0900\n" "POT-Creation-Date: 2006-08-07 22:15+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -16,6 +16,19 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: src/RequestInfo.h:76
#, c-format
msgid ""
"\n"
"The download was complete. <%s>\n"
msgstr ""
#: src/RequestInfo.h:84
msgid ""
"\n"
"The download was not complete because of errors. Check the log.\n"
msgstr ""
#: src/message.h:27 #: src/message.h:27
#, c-format #, c-format
msgid "CUID#%d - The download for one segment completed successfully." msgid "CUID#%d - The download for one segment completed successfully."
@ -329,39 +342,34 @@ msgstr ""
msgid "Failed to peek data, cause: %s" msgid "Failed to peek data, cause: %s"
msgstr "" msgstr ""
#: src/main.cc:76 #: src/DownloadEngineFactory.cc:102
#, c-format msgid "Errors occurred while binding port.\n"
msgid ""
"\n"
"The download was complete. <%s>\n"
msgstr "" msgstr ""
#: src/main.cc:84 #: src/TorrentRequestInfo.cc:71
msgid "" msgid "Files:"
"\n"
"The download was not complete because of errors. Check the log.\n"
msgstr "" msgstr ""
#: src/main.cc:101 #: src/UrlRequestInfo.cc:57
msgid "" msgid ""
"\n" "\n"
"stopping application...\n" "stopping application...\n"
msgstr "" msgstr ""
#: src/main.cc:107 #: src/UrlRequestInfo.cc:62
msgid "done\n" msgid "done\n"
msgstr "" msgstr ""
#: src/main.cc:123 #: src/UrlRequestInfo.cc:86
#, c-format #, c-format
msgid "Unrecognized URL or unsupported protocol: %s\n" msgid "Unrecognized URL or unsupported protocol: %s\n"
msgstr "" msgstr ""
#: src/main.cc:129 #: src/main.cc:71
msgid " version " msgid " version "
msgstr "" msgstr ""
#: src/main.cc:133 #: src/main.cc:78
msgid "" msgid ""
"This program is free software; you can redistribute it and/or modify\n" "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" "it under the terms of the GNU General Public License as published by\n"
@ -378,50 +386,50 @@ msgid ""
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"
msgstr "" msgstr ""
#: src/main.cc:147 #: src/main.cc:92
#, c-format #, c-format
msgid "Contact Info: %s\n" msgid "Contact Info: %s\n"
msgstr "" msgstr ""
#: src/main.cc:153 #: src/main.cc:98
#, c-format #, c-format
msgid "Usage: %s [options] URL ...\n" msgid "Usage: %s [options] URL ...\n"
msgstr "" msgstr ""
#: src/main.cc:155 #: src/main.cc:100
#, c-format #, c-format
msgid " %s [options] -T TORRENT_FILE FILE ...\n" msgid " %s [options] -T TORRENT_FILE FILE ...\n"
msgstr "" msgstr ""
#: src/main.cc:158 #: src/main.cc:103
#, c-format #, c-format
msgid " %s [options] -M METALINK_FILE\n" msgid " %s [options] -M METALINK_FILE\n"
msgstr "" msgstr ""
#: src/main.cc:161 #: src/main.cc:106
msgid "Options:" msgid "Options:"
msgstr "" msgstr ""
#: src/main.cc:162 #: src/main.cc:107
msgid " -d, --dir=DIR The directory to store downloaded file." msgid " -d, --dir=DIR The directory to store downloaded file."
msgstr "" msgstr ""
#: src/main.cc:163 #: src/main.cc:108
msgid " -o, --out=FILE The file name for downloaded file." msgid " -o, --out=FILE The file name for downloaded file."
msgstr "" msgstr ""
#: src/main.cc:164 #: src/main.cc:109
msgid "" msgid ""
" -l, --log=LOG The file path to store log. If '-' is " " -l, --log=LOG The file path to store log. If '-' is "
"specified,\n" "specified,\n"
" log is written to stdout." " log is written to stdout."
msgstr "" msgstr ""
#: src/main.cc:166 #: src/main.cc:111
msgid " -D, --daemon Run as daemon." msgid " -D, --daemon Run as daemon."
msgstr "" msgstr ""
#: src/main.cc:167 #: src/main.cc:112
msgid "" msgid ""
" -s, --split=N Download a file using N connections. N must " " -s, --split=N Download a file using N connections. N must "
"be\n" "be\n"
@ -431,65 +439,65 @@ msgid ""
" N connections." " N connections."
msgstr "" msgstr ""
#: src/main.cc:171 #: src/main.cc:116
msgid "" msgid ""
" --retry-wait=SEC Set amount of time in second between requests\n" " --retry-wait=SEC Set amount of time in second between requests\n"
" for errors. Specify a value between 0 and 60.\n" " for errors. Specify a value between 0 and 60.\n"
" Default: 5" " Default: 5"
msgstr "" msgstr ""
#: src/main.cc:174 #: src/main.cc:119
msgid " -t, --timeout=SEC Set timeout in second. Default: 60" msgid " -t, --timeout=SEC Set timeout in second. Default: 60"
msgstr "" msgstr ""
#: src/main.cc:175 #: src/main.cc:120
msgid "" msgid ""
" -m, --max-tries=N Set number of tries. 0 means unlimited.\n" " -m, --max-tries=N Set number of tries. 0 means unlimited.\n"
" Default: 5" " Default: 5"
msgstr "" msgstr ""
#: src/main.cc:177 #: src/main.cc:122
msgid "" msgid ""
" --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n" " --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n"
" K or M(1K = 1024, 1M = 1024K). This\n" " K or M(1K = 1024, 1M = 1024K). This\n"
" value must be greater than or equal to\n" " value must be greater than or equal to\n"
" 1024." " 1024. Default: 1M"
msgstr "" msgstr ""
#: src/main.cc:181 #: src/main.cc:126
msgid "" msgid ""
" --http-proxy=HOST:PORT Use HTTP proxy server. This affects to all\n" " --http-proxy=HOST:PORT Use HTTP proxy server. This affects to all\n"
" URLs." " URLs."
msgstr "" msgstr ""
#: src/main.cc:183 #: src/main.cc:128
msgid " --http-user=USER Set HTTP user. This affects to all URLs." msgid " --http-user=USER Set HTTP user. This affects to all URLs."
msgstr "" msgstr ""
#: src/main.cc:184 #: src/main.cc:129
msgid "" msgid ""
" --http-passwd=PASSWD Set HTTP password. This affects to all URLs." " --http-passwd=PASSWD Set HTTP password. This affects to all URLs."
msgstr "" msgstr ""
#: src/main.cc:185 #: src/main.cc:130
msgid "" msgid ""
" --http-proxy-user=USER Set HTTP proxy user. This affects to all URLs" " --http-proxy-user=USER Set HTTP proxy user. This affects to all URLs"
msgstr "" msgstr ""
#: src/main.cc:186 #: src/main.cc:131
msgid "" msgid ""
" --http-proxy-passwd=PASSWD Set HTTP proxy password. This affects to all " " --http-proxy-passwd=PASSWD Set HTTP proxy password. This affects to all "
"URLs." "URLs."
msgstr "" msgstr ""
#: src/main.cc:187 #: src/main.cc:132
msgid "" msgid ""
" --http-proxy-method=METHOD Set the method to use in proxy request.\n" " --http-proxy-method=METHOD Set the method to use in proxy request.\n"
" METHOD is either 'get' or 'tunnel'.\n" " METHOD is either 'get' or 'tunnel'.\n"
" Default: tunnel" " Default: tunnel"
msgstr "" msgstr ""
#: src/main.cc:190 #: src/main.cc:135
msgid "" msgid ""
" --http-auth-scheme=SCHEME Set HTTP authentication scheme. Currently, " " --http-auth-scheme=SCHEME Set HTTP authentication scheme. Currently, "
"basic\n" "basic\n"
@ -497,23 +505,23 @@ msgid ""
" Default: basic" " Default: basic"
msgstr "" msgstr ""
#: src/main.cc:193 #: src/main.cc:138
msgid " --referer=REFERER Set Referer. This affects to all URLs." msgid " --referer=REFERER Set Referer. This affects to all URLs."
msgstr "" msgstr ""
#: src/main.cc:194 #: src/main.cc:139
msgid "" msgid ""
" --ftp-user=USER Set FTP user. This affects to all URLs.\n" " --ftp-user=USER Set FTP user. This affects to all URLs.\n"
" Default: anonymous" " Default: anonymous"
msgstr "" msgstr ""
#: src/main.cc:196 #: src/main.cc:141
msgid "" msgid ""
" --ftp-passwd=PASSWD Set FTP password. This affects to all URLs.\n" " --ftp-passwd=PASSWD Set FTP password. This affects to all URLs.\n"
" Default: ARIA2USER@" " Default: ARIA2USER@"
msgstr "" msgstr ""
#: src/main.cc:198 #: src/main.cc:143
msgid "" msgid ""
" --ftp-type=TYPE Set FTP transfer type. TYPE is either " " --ftp-type=TYPE Set FTP transfer type. TYPE is either "
"'binary'\n" "'binary'\n"
@ -521,11 +529,11 @@ msgid ""
" Default: binary" " Default: binary"
msgstr "" msgstr ""
#: src/main.cc:201 #: src/main.cc:146
msgid " -p, --ftp-pasv Use passive mode in FTP." msgid " -p, --ftp-pasv Use passive mode in FTP."
msgstr "" msgstr ""
#: src/main.cc:202 #: src/main.cc:147
msgid "" msgid ""
" --ftp-via-http-proxy=METHOD Use HTTP proxy in FTP. METHOD is either 'get' " " --ftp-via-http-proxy=METHOD Use HTTP proxy in FTP. METHOD is either 'get' "
"or\n" "or\n"
@ -533,11 +541,26 @@ msgid ""
" Default: tunnel" " Default: tunnel"
msgstr "" msgstr ""
#: src/main.cc:206 #: src/main.cc:150
msgid ""
" --lowest-speed-limit Close connection if download speed is lower "
"than\n"
" or equal to this value. 0 means aria2 does "
"not\n"
" care lowest speed limit. You can use K or M "
"in\n"
" the same manner as in --min-segment-size "
"option.\n"
" This option does not affect BitTorrent "
"download.\n"
" Default: 0"
msgstr ""
#: src/main.cc:157
msgid " -T, --torrent-file=TORRENT_FILE The file path to .torrent file." msgid " -T, --torrent-file=TORRENT_FILE The file path to .torrent file."
msgstr "" msgstr ""
#: src/main.cc:207 #: src/main.cc:158
msgid "" msgid ""
" --follow-torrent=true|false Setting this option to false prevents aria2 " " --follow-torrent=true|false Setting this option to false prevents aria2 "
"to\n" "to\n"
@ -546,25 +569,25 @@ msgid ""
" Default: true" " Default: true"
msgstr "" msgstr ""
#: src/main.cc:211 #: src/main.cc:162
msgid "" msgid ""
" -S, --show-files Print file listing of .torrent file and exit." " -S, --show-files Print file listing of .torrent file and exit."
msgstr "" msgstr ""
#: src/main.cc:212 #: src/main.cc:163
msgid "" msgid ""
" --direct-file-mapping=true|false Directly read from and write to each file\n" " --direct-file-mapping=true|false Directly read from and write to each file\n"
" mentioned in .torrent file.\n" " mentioned in .torrent file.\n"
" Default: true" " Default: true"
msgstr "" msgstr ""
#: src/main.cc:215 #: src/main.cc:166
msgid "" msgid ""
" --listen-port=PORT Set port number to listen to for peer " " --listen-port=PORT Set port number to listen to for peer "
"connection." "connection."
msgstr "" msgstr ""
#: src/main.cc:216 #: src/main.cc:167
msgid "" msgid ""
" --upload-limit=SPEED Set upload speed limit in KB/sec. aria2 tries " " --upload-limit=SPEED Set upload speed limit in KB/sec. aria2 tries "
"to\n" "to\n"
@ -572,7 +595,7 @@ msgid ""
"unlimited." "unlimited."
msgstr "" msgstr ""
#: src/main.cc:218 #: src/main.cc:169
msgid "" msgid ""
" --select-file=INDEX... Set file to download by specifing its index.\n" " --select-file=INDEX... Set file to download by specifing its index.\n"
" You can know file index through --show-files\n" " You can know file index through --show-files\n"
@ -584,11 +607,11 @@ msgid ""
" ',' and '-' can be used together." " ',' and '-' can be used together."
msgstr "" msgstr ""
#: src/main.cc:226 #: src/main.cc:177
msgid " -M, --metalink-file=METALINK_FILE The file path to .metalink file." msgid " -M, --metalink-file=METALINK_FILE The file path to .metalink file."
msgstr "" msgstr ""
#: src/main.cc:227 #: src/main.cc:178
msgid "" msgid ""
" -C, --metalink-servers=NUM_SERVERS The number of servers to connect to\n" " -C, --metalink-servers=NUM_SERVERS The number of servers to connect to\n"
" simultaneously. If more than one connection " " simultaneously. If more than one connection "
@ -597,20 +620,20 @@ msgid ""
" Default: 15" " Default: 15"
msgstr "" msgstr ""
#: src/main.cc:231 #: src/main.cc:182
msgid " --metalink-version=VERSION The version of file to download." msgid " --metalink-version=VERSION The version of file to download."
msgstr "" msgstr ""
#: src/main.cc:232 #: src/main.cc:183
msgid " --metalink-language=LANGUAGE The language of file to download." msgid " --metalink-language=LANGUAGE The language of file to download."
msgstr "" msgstr ""
#: src/main.cc:233 #: src/main.cc:184
msgid "" msgid ""
" --metalink-os=OS The operating system the file is targeted." " --metalink-os=OS The operating system the file is targeted."
msgstr "" msgstr ""
#: src/main.cc:234 #: src/main.cc:185
msgid "" msgid ""
" --follow-metalink=true|false Setting this option to false prevents aria2 " " --follow-metalink=true|false Setting this option to false prevents aria2 "
"to\n" "to\n"
@ -619,155 +642,151 @@ msgid ""
" Default: true" " Default: true"
msgstr "" msgstr ""
#: src/main.cc:239 #: src/main.cc:190
msgid " -v, --version Print the version number and exit." msgid " -v, --version Print the version number and exit."
msgstr "" msgstr ""
#: src/main.cc:240 #: src/main.cc:191
msgid " -h, --help Print this message and exit." msgid " -h, --help Print this message and exit."
msgstr "" msgstr ""
#: src/main.cc:243 #: src/main.cc:194
msgid "" msgid ""
" You can specify multiple URLs. All URLs must point to the same file\n" " You can specify multiple URLs. All URLs must point to the same file\n"
" or downloading fails." " or downloading fails."
msgstr "" msgstr ""
#: src/main.cc:248 #: src/main.cc:199
msgid "" msgid ""
" Specify files in multi-file torrent to download. Use conjunction with\n" " Specify files in multi-file torrent to download. Use conjunction with\n"
" -T option. This arguments are ignored if you specify --select-file option." " -T option. This arguments are ignored if you specify --select-file option."
msgstr "" msgstr ""
#: src/main.cc:252 #: src/main.cc:203
msgid "Examples:" msgid "Examples:"
msgstr "" msgstr ""
#: src/main.cc:253 #: src/main.cc:204
msgid " Download a file by 1 connection:" msgid " Download a file by 1 connection:"
msgstr "" msgstr ""
#: src/main.cc:255 #: src/main.cc:206
msgid " Download a file by 2 connections:" msgid " Download a file by 2 connections:"
msgstr "" msgstr ""
#: src/main.cc:257 #: src/main.cc:208
msgid " Download a file by 2 connections, each connects to a different server:" msgid " Download a file by 2 connections, each connects to a different server:"
msgstr "" msgstr ""
#: src/main.cc:259 #: src/main.cc:210
msgid " You can mix up different protocols:" msgid " You can mix up different protocols:"
msgstr "" msgstr ""
#: src/main.cc:263 #: src/main.cc:214
msgid " Download a torrent:" msgid " Download a torrent:"
msgstr "" msgstr ""
#: src/main.cc:265 #: src/main.cc:216
msgid " Download a torrent using local .torrent file:" msgid " Download a torrent using local .torrent file:"
msgstr "" msgstr ""
#: src/main.cc:267 #: src/main.cc:218
msgid " Download only selected files:" msgid " Download only selected files:"
msgstr "" msgstr ""
#: src/main.cc:269 #: src/main.cc:220
msgid " Print file listing of .torrent file:" msgid " Print file listing of .torrent file:"
msgstr "" msgstr ""
#: src/main.cc:274 #: src/main.cc:225
msgid " Metalink downloading:" msgid " Metalink downloading:"
msgstr "" msgstr ""
#: src/main.cc:276 #: src/main.cc:227
msgid " Download a file using local .metalink file:" msgid " Download a file using local .metalink file:"
msgstr "" msgstr ""
#: src/main.cc:278 #: src/main.cc:229
msgid " Metalink downloading with preferences:" msgid " Metalink downloading with preferences:"
msgstr "" msgstr ""
#: src/main.cc:282 #: src/main.cc:233
#, c-format #, c-format
msgid "Report bugs to %s" msgid "Report bugs to %s"
msgstr "" msgstr ""
#: src/main.cc:446 #: src/main.cc:358
msgid "unrecognized proxy format" msgid "unrecognized proxy format"
msgstr "" msgstr ""
#: src/main.cc:473 #: src/main.cc:385
msgid "Currently, supported authentication scheme is basic." msgid "Currently, supported authentication scheme is basic."
msgstr "" msgstr ""
#: src/main.cc:482 #: src/main.cc:394
msgid "retry-wait must be between 0 and 60." msgid "retry-wait must be between 0 and 60."
msgstr "" msgstr ""
#: src/main.cc:499 #: src/main.cc:411
msgid "ftp-type must be either 'binary' or 'ascii'." msgid "ftp-type must be either 'binary' or 'ascii'."
msgstr "" msgstr ""
#: src/main.cc:508 #: src/main.cc:420
msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'." msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'."
msgstr "" msgstr ""
#: src/main.cc:526 #: src/main.cc:428
msgid "min-segment-size invalid" msgid "min-segment-size invalid"
msgstr "" msgstr ""
#: src/main.cc:537 #: src/main.cc:439
msgid "http-proxy-method must be either 'get' or 'tunnel'." msgid "http-proxy-method must be either 'get' or 'tunnel'."
msgstr "" msgstr ""
#: src/main.cc:545 #: src/main.cc:447
msgid "listen-port must be between 1024 and 65535." msgid "listen-port must be between 1024 and 65535."
msgstr "" msgstr ""
#: src/main.cc:556 #: src/main.cc:460
msgid "follow-torrent must be either 'true' or 'false'." msgid "follow-torrent must be either 'true' or 'false'."
msgstr "" msgstr ""
#: src/main.cc:570 #: src/main.cc:474
msgid "direct-file-mapping must be either 'true' or 'false'." msgid "direct-file-mapping must be either 'true' or 'false'."
msgstr "" msgstr ""
#: src/main.cc:578 #: src/main.cc:482
msgid "upload-limit must be greater than or equal to 0." msgid "upload-limit must be greater than or equal to 0."
msgstr "" msgstr ""
#: src/main.cc:603 #: src/main.cc:507
msgid "follow-metalink must be either 'true' or 'false'." msgid "follow-metalink must be either 'true' or 'false'."
msgstr "" msgstr ""
#: src/main.cc:630 #: src/main.cc:515
msgid "lowest-speed-limit must be greater than or equal to 0"
msgstr ""
#: src/main.cc:544
msgid "split must be between 1 and 5." msgid "split must be between 1 and 5."
msgstr "" msgstr ""
#: src/main.cc:640 #: src/main.cc:556
msgid "timeout must be between 1 and 600" msgid "timeout must be between 1 and 600"
msgstr "" msgstr ""
#: src/main.cc:649 #: src/main.cc:565
msgid "max-tries invalid" msgid "max-tries invalid"
msgstr "" msgstr ""
#: src/main.cc:671 #: src/main.cc:587
msgid "metalink-servers must be greater than 0." msgid "metalink-servers must be greater than 0."
msgstr "" msgstr ""
#: src/main.cc:689 #: src/main.cc:607
msgid "specify at least one URL" msgid "specify at least one URL"
msgstr "" msgstr ""
#: src/main.cc:696 #: src/main.cc:614
msgid "daemon failed" msgid "daemon failed"
msgstr "" msgstr ""
#: src/main.cc:837
msgid "Files:"
msgstr ""
#: src/main.cc:868
msgid "Errors occurred while binding port.\n"
msgstr ""

BIN
po/de.gmo

Binary file not shown.

231
po/de.po
View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: de\n" "Project-Id-Version: de\n"
"Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n" "Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n"
"POT-Creation-Date: 2006-07-21 00:57+0900\n" "POT-Creation-Date: 2006-08-07 22:15+0900\n"
"PO-Revision-Date: 2006-05-05 19:44+0900\n" "PO-Revision-Date: 2006-05-05 19:44+0900\n"
"Last-Translator: Hermann J. Beckers <hj.beckers@onlinehome.de>\n" "Last-Translator: Hermann J. Beckers <hj.beckers@onlinehome.de>\n"
"Language-Team: deutsch <de@li.org>\n" "Language-Team: deutsch <de@li.org>\n"
@ -16,6 +16,23 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.3\n" "X-Generator: KBabel 1.3\n"
#: src/RequestInfo.h:76
#, c-format
msgid ""
"\n"
"The download was complete. <%s>\n"
msgstr ""
"\n"
"Abruf ist vollständig. <%s>\n"
#: src/RequestInfo.h:84
msgid ""
"\n"
"The download was not complete because of errors. Check the log.\n"
msgstr ""
"\n"
"Abruf wegen Fehlern nicht vollständig. Überprüfen Sie die Log-Datei.\n"
#: src/message.h:27 #: src/message.h:27
#, c-format #, c-format
msgid "CUID#%d - The download for one segment completed successfully." msgid "CUID#%d - The download for one segment completed successfully."
@ -338,24 +355,15 @@ msgstr "Konnte Daten nicht erhalten, Ursache: %s"
msgid "Failed to peek data, cause: %s" msgid "Failed to peek data, cause: %s"
msgstr "Datenermittelung fehlgeschlagen, Ursache: %s" msgstr "Datenermittelung fehlgeschlagen, Ursache: %s"
#: src/main.cc:76 #: src/DownloadEngineFactory.cc:102
#, c-format msgid "Errors occurred while binding port.\n"
msgid "" msgstr "Fehler beim Binden an Port aufgetreten.\n"
"\n"
"The download was complete. <%s>\n"
msgstr ""
"\n"
"Abruf ist vollständig. <%s>\n"
#: src/main.cc:84 #: src/TorrentRequestInfo.cc:71
msgid "" msgid "Files:"
"\n" msgstr "Dateien:"
"The download was not complete because of errors. Check the log.\n"
msgstr ""
"\n"
"Abruf wegen Fehlern nicht vollständig. Überprüfen Sie die Log-Datei.\n"
#: src/main.cc:101 #: src/UrlRequestInfo.cc:57
msgid "" msgid ""
"\n" "\n"
"stopping application...\n" "stopping application...\n"
@ -363,20 +371,20 @@ msgstr ""
"\n" "\n"
"Anwendung wird gestoppt ...\n" "Anwendung wird gestoppt ...\n"
#: src/main.cc:107 #: src/UrlRequestInfo.cc:62
msgid "done\n" msgid "done\n"
msgstr "erledigt\n" msgstr "erledigt\n"
#: src/main.cc:123 #: src/UrlRequestInfo.cc:86
#, c-format #, c-format
msgid "Unrecognized URL or unsupported protocol: %s\n" msgid "Unrecognized URL or unsupported protocol: %s\n"
msgstr "URL nicht erkannt oder nicht unterstütztes Protokoll: %s\n" msgstr "URL nicht erkannt oder nicht unterstütztes Protokoll: %s\n"
#: src/main.cc:129 #: src/main.cc:71
msgid " version " msgid " version "
msgstr " Version " msgstr " Version "
#: src/main.cc:133 #: src/main.cc:78
msgid "" msgid ""
"This program is free software; you can redistribute it and/or modify\n" "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" "it under the terms of the GNU General Public License as published by\n"
@ -406,41 +414,41 @@ msgstr ""
"along with this program; if not, write to the Free Software\n" "along with this program; if not, write to the Free Software\n"
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"
#: src/main.cc:147 #: src/main.cc:92
#, c-format #, c-format
msgid "Contact Info: %s\n" msgid "Contact Info: %s\n"
msgstr "Kontakt-Info: %s\n" msgstr "Kontakt-Info: %s\n"
#: src/main.cc:153 #: src/main.cc:98
#, c-format #, c-format
msgid "Usage: %s [options] URL ...\n" msgid "Usage: %s [options] URL ...\n"
msgstr "Aufruf: %s [Optionen] URL ...\n" msgstr "Aufruf: %s [Optionen] URL ...\n"
#: src/main.cc:155 #: src/main.cc:100
#, c-format #, c-format
msgid " %s [options] -T TORRENT_FILE FILE ...\n" msgid " %s [options] -T TORRENT_FILE FILE ...\n"
msgstr " %s [Optionen] -T TORRENT_FILE FILE ...\n" msgstr " %s [Optionen] -T TORRENT_FILE FILE ...\n"
#: src/main.cc:158 #: src/main.cc:103
#, fuzzy, c-format #, fuzzy, c-format
msgid " %s [options] -M METALINK_FILE\n" msgid " %s [options] -M METALINK_FILE\n"
msgstr " %s [Optionen] -T TORRENT_FILE FILE ...\n" msgstr " %s [Optionen] -T TORRENT_FILE FILE ...\n"
#: src/main.cc:161 #: src/main.cc:106
msgid "Options:" msgid "Options:"
msgstr "Optionen:" msgstr "Optionen:"
#: src/main.cc:162 #: src/main.cc:107
msgid " -d, --dir=DIR The directory to store downloaded file." msgid " -d, --dir=DIR The directory to store downloaded file."
msgstr "" msgstr ""
" -d, --dir=DIR Verzeichnis zum Speichern der abgerufenen " " -d, --dir=DIR Verzeichnis zum Speichern der abgerufenen "
"Datei." "Datei."
#: src/main.cc:163 #: src/main.cc:108
msgid " -o, --out=FILE The file name for downloaded file." msgid " -o, --out=FILE The file name for downloaded file."
msgstr " -o, --out=FILE Dateiname für die abgerufene Datei." msgstr " -o, --out=FILE Dateiname für die abgerufene Datei."
#: src/main.cc:164 #: src/main.cc:109
msgid "" msgid ""
" -l, --log=LOG The file path to store log. If '-' is " " -l, --log=LOG The file path to store log. If '-' is "
"specified,\n" "specified,\n"
@ -451,11 +459,11 @@ msgstr ""
" wird das Log auf die Standardausgabe " " wird das Log auf die Standardausgabe "
"geschrieben." "geschrieben."
#: src/main.cc:166 #: src/main.cc:111
msgid " -D, --daemon Run as daemon." msgid " -D, --daemon Run as daemon."
msgstr " -D, --daemon Start als Daemon-Prozeß." msgstr " -D, --daemon Start als Daemon-Prozeß."
#: src/main.cc:167 #: src/main.cc:112
msgid "" msgid ""
" -s, --split=N Download a file using N connections. N must " " -s, --split=N Download a file using N connections. N must "
"be\n" "be\n"
@ -471,7 +479,7 @@ msgstr ""
" Daher verbindet sich aria2 zu jeder URL mit\n" " Daher verbindet sich aria2 zu jeder URL mit\n"
" N Verbindungen." " N Verbindungen."
#: src/main.cc:171 #: src/main.cc:116
msgid "" msgid ""
" --retry-wait=SEC Set amount of time in second between requests\n" " --retry-wait=SEC Set amount of time in second between requests\n"
" for errors. Specify a value between 0 and 60.\n" " for errors. Specify a value between 0 and 60.\n"
@ -483,12 +491,12 @@ msgstr ""
"und 60 an.\n" "und 60 an.\n"
" Fehlwert: 5" " Fehlwert: 5"
#: src/main.cc:174 #: src/main.cc:119
msgid " -t, --timeout=SEC Set timeout in second. Default: 60" msgid " -t, --timeout=SEC Set timeout in second. Default: 60"
msgstr "" msgstr ""
" -t, --timeout=SEC Setzt Wartezeit in Sekunden. Fehlwert: 60" " -t, --timeout=SEC Setzt Wartezeit in Sekunden. Fehlwert: 60"
#: src/main.cc:175 #: src/main.cc:120
msgid "" msgid ""
" -m, --max-tries=N Set number of tries. 0 means unlimited.\n" " -m, --max-tries=N Set number of tries. 0 means unlimited.\n"
" Default: 5" " Default: 5"
@ -496,12 +504,13 @@ msgstr ""
" -m, --max-tries=N Anzahl Versuche. 0 bedeutet unbegrenzt.\n" " -m, --max-tries=N Anzahl Versuche. 0 bedeutet unbegrenzt.\n"
" Fehlwert: 5" " Fehlwert: 5"
#: src/main.cc:177 #: src/main.cc:122
#, fuzzy
msgid "" msgid ""
" --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n" " --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n"
" K or M(1K = 1024, 1M = 1024K). This\n" " K or M(1K = 1024, 1M = 1024K). This\n"
" value must be greater than or equal to\n" " value must be greater than or equal to\n"
" 1024." " 1024. Default: 1M"
msgstr "" msgstr ""
" --min-segment-size=SIZE[K|M] Setzt die minimale Segment-Größe. Sie können \n" " --min-segment-size=SIZE[K|M] Setzt die minimale Segment-Größe. Sie können \n"
" K oder M(1K = 1024, 1M = 1024K) anhängen. " " K oder M(1K = 1024, 1M = 1024K) anhängen. "
@ -509,7 +518,7 @@ msgstr ""
" Wert muss größer oder gleich \n" " Wert muss größer oder gleich \n"
" 1024 sein." " 1024 sein."
#: src/main.cc:181 #: src/main.cc:126
msgid "" msgid ""
" --http-proxy=HOST:PORT Use HTTP proxy server. This affects to all\n" " --http-proxy=HOST:PORT Use HTTP proxy server. This affects to all\n"
" URLs." " URLs."
@ -517,26 +526,26 @@ msgstr ""
" --http-proxy=HOST:PORT HTTP-Proxyserver benutzen. Dies betrifft alle\n" " --http-proxy=HOST:PORT HTTP-Proxyserver benutzen. Dies betrifft alle\n"
" URLs." " URLs."
#: src/main.cc:183 #: src/main.cc:128
msgid " --http-user=USER Set HTTP user. This affects to all URLs." msgid " --http-user=USER Set HTTP user. This affects to all URLs."
msgstr "" msgstr ""
" --http-user=USER HTTP-Anwendername angeben. Dies betrifft alle " " --http-user=USER HTTP-Anwendername angeben. Dies betrifft alle "
"URLs." "URLs."
#: src/main.cc:184 #: src/main.cc:129
msgid "" msgid ""
" --http-passwd=PASSWD Set HTTP password. This affects to all URLs." " --http-passwd=PASSWD Set HTTP password. This affects to all URLs."
msgstr "" msgstr ""
" --http-passwd=PASSWD HTTP-Passwort setzen. Dies betrifft alle URLs." " --http-passwd=PASSWD HTTP-Passwort setzen. Dies betrifft alle URLs."
#: src/main.cc:185 #: src/main.cc:130
msgid "" msgid ""
" --http-proxy-user=USER Set HTTP proxy user. This affects to all URLs" " --http-proxy-user=USER Set HTTP proxy user. This affects to all URLs"
msgstr "" msgstr ""
" --http-proxy-user=USER HTTP-Proxy-Anwender setzen. Dies betrifft alle " " --http-proxy-user=USER HTTP-Proxy-Anwender setzen. Dies betrifft alle "
"URLs." "URLs."
#: src/main.cc:186 #: src/main.cc:131
msgid "" msgid ""
" --http-proxy-passwd=PASSWD Set HTTP proxy password. This affects to all " " --http-proxy-passwd=PASSWD Set HTTP proxy password. This affects to all "
"URLs." "URLs."
@ -544,7 +553,7 @@ msgstr ""
" --http-proxy-passwd=PASSWD HTTP-Proxy-Passwort setzen. Dies betrifft alle " " --http-proxy-passwd=PASSWD HTTP-Proxy-Passwort setzen. Dies betrifft alle "
"URLs." "URLs."
#: src/main.cc:187 #: src/main.cc:132
msgid "" msgid ""
" --http-proxy-method=METHOD Set the method to use in proxy request.\n" " --http-proxy-method=METHOD Set the method to use in proxy request.\n"
" METHOD is either 'get' or 'tunnel'.\n" " METHOD is either 'get' or 'tunnel'.\n"
@ -555,7 +564,7 @@ msgstr ""
" METHOD ist entweder 'get' oder 'tunnel'.\n" " METHOD ist entweder 'get' oder 'tunnel'.\n"
" Fehlwert: tunnel" " Fehlwert: tunnel"
#: src/main.cc:190 #: src/main.cc:135
msgid "" msgid ""
" --http-auth-scheme=SCHEME Set HTTP authentication scheme. Currently, " " --http-auth-scheme=SCHEME Set HTTP authentication scheme. Currently, "
"basic\n" "basic\n"
@ -567,11 +576,11 @@ msgstr ""
" das einzig zulässige Schema.\n" " das einzig zulässige Schema.\n"
" Fehlwert: basic" " Fehlwert: basic"
#: src/main.cc:193 #: src/main.cc:138
msgid " --referer=REFERER Set Referer. This affects to all URLs." msgid " --referer=REFERER Set Referer. This affects to all URLs."
msgstr " --referer=REFERER Referer setzen. Dies betrifft alle URLs." msgstr " --referer=REFERER Referer setzen. Dies betrifft alle URLs."
#: src/main.cc:194 #: src/main.cc:139
msgid "" msgid ""
" --ftp-user=USER Set FTP user. This affects to all URLs.\n" " --ftp-user=USER Set FTP user. This affects to all URLs.\n"
" Default: anonymous" " Default: anonymous"
@ -579,7 +588,7 @@ msgstr ""
" --ftp-user=USER FTP-Anwender setzen. Dies betrifft alle URLs.\n" " --ftp-user=USER FTP-Anwender setzen. Dies betrifft alle URLs.\n"
" Fehlwert: anonymous" " Fehlwert: anonymous"
#: src/main.cc:196 #: src/main.cc:141
msgid "" msgid ""
" --ftp-passwd=PASSWD Set FTP password. This affects to all URLs.\n" " --ftp-passwd=PASSWD Set FTP password. This affects to all URLs.\n"
" Default: ARIA2USER@" " Default: ARIA2USER@"
@ -587,7 +596,7 @@ msgstr ""
" --ftp-passwd=PASSWD FTP-Passwort setzen. Dies betrifft alle URLs.\n" " --ftp-passwd=PASSWD FTP-Passwort setzen. Dies betrifft alle URLs.\n"
" Fehlwert: ARIA2USER@" " Fehlwert: ARIA2USER@"
#: src/main.cc:198 #: src/main.cc:143
msgid "" msgid ""
" --ftp-type=TYPE Set FTP transfer type. TYPE is either " " --ftp-type=TYPE Set FTP transfer type. TYPE is either "
"'binary'\n" "'binary'\n"
@ -599,11 +608,11 @@ msgstr ""
" oder 'ascii'.\n" " oder 'ascii'.\n"
" Fehlwert: binary" " Fehlwert: binary"
#: src/main.cc:201 #: src/main.cc:146
msgid " -p, --ftp-pasv Use passive mode in FTP." msgid " -p, --ftp-pasv Use passive mode in FTP."
msgstr " -p, --ftp-pasv Passiv-Modus für FTP benutzen." msgstr " -p, --ftp-pasv Passiv-Modus für FTP benutzen."
#: src/main.cc:202 #: src/main.cc:147
msgid "" msgid ""
" --ftp-via-http-proxy=METHOD Use HTTP proxy in FTP. METHOD is either 'get' " " --ftp-via-http-proxy=METHOD Use HTTP proxy in FTP. METHOD is either 'get' "
"or\n" "or\n"
@ -615,11 +624,26 @@ msgstr ""
" 'tunnel'.\n" " 'tunnel'.\n"
" Fehlwert: tunnel" " Fehlwert: tunnel"
#: src/main.cc:206 #: src/main.cc:150
msgid ""
" --lowest-speed-limit Close connection if download speed is lower "
"than\n"
" or equal to this value. 0 means aria2 does "
"not\n"
" care lowest speed limit. You can use K or M "
"in\n"
" the same manner as in --min-segment-size "
"option.\n"
" This option does not affect BitTorrent "
"download.\n"
" Default: 0"
msgstr ""
#: src/main.cc:157
msgid " -T, --torrent-file=TORRENT_FILE The file path to .torrent file." msgid " -T, --torrent-file=TORRENT_FILE The file path to .torrent file."
msgstr " -T, --torrent-file=TORRENT_FILE Datenpfad zur torrent-Datei." msgstr " -T, --torrent-file=TORRENT_FILE Datenpfad zur torrent-Datei."
#: src/main.cc:207 #: src/main.cc:158
msgid "" msgid ""
" --follow-torrent=true|false Setting this option to false prevents aria2 " " --follow-torrent=true|false Setting this option to false prevents aria2 "
"to\n" "to\n"
@ -634,14 +658,14 @@ msgstr ""
" auf .torrent endet.\n" " auf .torrent endet.\n"
" Fehlwert: true" " Fehlwert: true"
#: src/main.cc:211 #: src/main.cc:162
msgid "" msgid ""
" -S, --show-files Print file listing of .torrent file and exit." " -S, --show-files Print file listing of .torrent file and exit."
msgstr "" msgstr ""
" -S, --show-files Dateiliste der .torrent-Datei ausgeben und " " -S, --show-files Dateiliste der .torrent-Datei ausgeben und "
"beenden." "beenden."
#: src/main.cc:212 #: src/main.cc:163
msgid "" msgid ""
" --direct-file-mapping=true|false Directly read from and write to each file\n" " --direct-file-mapping=true|false Directly read from and write to each file\n"
" mentioned in .torrent file.\n" " mentioned in .torrent file.\n"
@ -651,7 +675,7 @@ msgstr ""
" .torrent-Datei erwähnten Datei.\n" " .torrent-Datei erwähnten Datei.\n"
" Fehlwert: true" " Fehlwert: true"
#: src/main.cc:215 #: src/main.cc:166
msgid "" msgid ""
" --listen-port=PORT Set port number to listen to for peer " " --listen-port=PORT Set port number to listen to for peer "
"connection." "connection."
@ -659,7 +683,7 @@ msgstr ""
" --listen-port=PORT Port-Nummer zum Lauschen auf Peer-Verbindungen " " --listen-port=PORT Port-Nummer zum Lauschen auf Peer-Verbindungen "
"setzen." "setzen."
#: src/main.cc:216 #: src/main.cc:167
msgid "" msgid ""
" --upload-limit=SPEED Set upload speed limit in KB/sec. aria2 tries " " --upload-limit=SPEED Set upload speed limit in KB/sec. aria2 tries "
"to\n" "to\n"
@ -671,7 +695,7 @@ msgstr ""
" Sendegeschwindigkeit unter SPEED zu halten. 0 " " Sendegeschwindigkeit unter SPEED zu halten. 0 "
"bedeutet keine Begrenzung." "bedeutet keine Begrenzung."
#: src/main.cc:218 #: src/main.cc:169
msgid "" msgid ""
" --select-file=INDEX... Set file to download by specifing its index.\n" " --select-file=INDEX... Set file to download by specifing its index.\n"
" You can know file index through --show-files\n" " You can know file index through --show-files\n"
@ -691,12 +715,12 @@ msgstr ""
" Sie können auch '-' verwenden wie in \"1-5\".\n" " Sie können auch '-' verwenden wie in \"1-5\".\n"
" ',' und '-' können zusammen benutzt werden." " ',' und '-' können zusammen benutzt werden."
#: src/main.cc:226 #: src/main.cc:177
#, fuzzy #, fuzzy
msgid " -M, --metalink-file=METALINK_FILE The file path to .metalink file." msgid " -M, --metalink-file=METALINK_FILE The file path to .metalink file."
msgstr " -T, --torrent-file=TORRENT_FILE Datenpfad zur torrent-Datei." msgstr " -T, --torrent-file=TORRENT_FILE Datenpfad zur torrent-Datei."
#: src/main.cc:227 #: src/main.cc:178
#, fuzzy #, fuzzy
msgid "" msgid ""
" -C, --metalink-servers=NUM_SERVERS The number of servers to connect to\n" " -C, --metalink-servers=NUM_SERVERS The number of servers to connect to\n"
@ -712,20 +736,20 @@ msgstr ""
" auf .torrent endet.\n" " auf .torrent endet.\n"
" Fehlwert: true" " Fehlwert: true"
#: src/main.cc:231 #: src/main.cc:182
msgid " --metalink-version=VERSION The version of file to download." msgid " --metalink-version=VERSION The version of file to download."
msgstr "" msgstr ""
#: src/main.cc:232 #: src/main.cc:183
msgid " --metalink-language=LANGUAGE The language of file to download." msgid " --metalink-language=LANGUAGE The language of file to download."
msgstr "" msgstr ""
#: src/main.cc:233 #: src/main.cc:184
msgid "" msgid ""
" --metalink-os=OS The operating system the file is targeted." " --metalink-os=OS The operating system the file is targeted."
msgstr "" msgstr ""
#: src/main.cc:234 #: src/main.cc:185
#, fuzzy #, fuzzy
msgid "" msgid ""
" --follow-metalink=true|false Setting this option to false prevents aria2 " " --follow-metalink=true|false Setting this option to false prevents aria2 "
@ -741,15 +765,15 @@ msgstr ""
" auf .torrent endet.\n" " auf .torrent endet.\n"
" Fehlwert: true" " Fehlwert: true"
#: src/main.cc:239 #: src/main.cc:190
msgid " -v, --version Print the version number and exit." msgid " -v, --version Print the version number and exit."
msgstr " -v, --version Versionsnummer ausgeben und beenden." msgstr " -v, --version Versionsnummer ausgeben und beenden."
#: src/main.cc:240 #: src/main.cc:191
msgid " -h, --help Print this message and exit." msgid " -h, --help Print this message and exit."
msgstr " -h, --help Diese Anzeige ausgeben und beenden." msgstr " -h, --help Diese Anzeige ausgeben und beenden."
#: src/main.cc:243 #: src/main.cc:194
msgid "" msgid ""
" You can specify multiple URLs. All URLs must point to the same file\n" " You can specify multiple URLs. All URLs must point to the same file\n"
" or downloading fails." " or downloading fails."
@ -758,7 +782,7 @@ msgstr ""
"verweisen\n" "verweisen\n"
"oder der Abruf schlägt fehl." "oder der Abruf schlägt fehl."
#: src/main.cc:248 #: src/main.cc:199
msgid "" msgid ""
" Specify files in multi-file torrent to download. Use conjunction with\n" " Specify files in multi-file torrent to download. Use conjunction with\n"
" -T option. This arguments are ignored if you specify --select-file option." " -T option. This arguments are ignored if you specify --select-file option."
@ -768,140 +792,137 @@ msgstr ""
" -T-Option. Diese Argumente werden ignoriert, wenn sie die Option --select-" " -T-Option. Diese Argumente werden ignoriert, wenn sie die Option --select-"
"file angeben." "file angeben."
#: src/main.cc:252 #: src/main.cc:203
msgid "Examples:" msgid "Examples:"
msgstr "Beispiele:" msgstr "Beispiele:"
#: src/main.cc:253 #: src/main.cc:204
msgid " Download a file by 1 connection:" msgid " Download a file by 1 connection:"
msgstr " Abruf einer Datei über 1 Verbindung:" msgstr " Abruf einer Datei über 1 Verbindung:"
#: src/main.cc:255 #: src/main.cc:206
msgid " Download a file by 2 connections:" msgid " Download a file by 2 connections:"
msgstr " Abruf einer Datei mit 2 Verbindungen:" msgstr " Abruf einer Datei mit 2 Verbindungen:"
#: src/main.cc:257 #: src/main.cc:208
msgid " Download a file by 2 connections, each connects to a different server:" msgid " Download a file by 2 connections, each connects to a different server:"
msgstr "" msgstr ""
" Abruf einer Datei über 2 Verbindungen, jede verbindet zu einem anderen " " Abruf einer Datei über 2 Verbindungen, jede verbindet zu einem anderen "
"Server:" "Server:"
#: src/main.cc:259 #: src/main.cc:210
msgid " You can mix up different protocols:" msgid " You can mix up different protocols:"
msgstr " Sie können verschiedene Protokolle mischen:" msgstr " Sie können verschiedene Protokolle mischen:"
#: src/main.cc:263 #: src/main.cc:214
msgid " Download a torrent:" msgid " Download a torrent:"
msgstr " Einen torrent abrufen:" msgstr " Einen torrent abrufen:"
#: src/main.cc:265 #: src/main.cc:216
msgid " Download a torrent using local .torrent file:" msgid " Download a torrent using local .torrent file:"
msgstr " Einen torrent mit einer lokalen .torrent-Datei abrufen:" msgstr " Einen torrent mit einer lokalen .torrent-Datei abrufen:"
#: src/main.cc:267 #: src/main.cc:218
msgid " Download only selected files:" msgid " Download only selected files:"
msgstr " Nur ausgewählte Dateien abrufen:" msgstr " Nur ausgewählte Dateien abrufen:"
#: src/main.cc:269 #: src/main.cc:220
msgid " Print file listing of .torrent file:" msgid " Print file listing of .torrent file:"
msgstr " Dateiliste einer .torrent-Datei ausgeben:" msgstr " Dateiliste einer .torrent-Datei ausgeben:"
#: src/main.cc:274 #: src/main.cc:225
msgid " Metalink downloading:" msgid " Metalink downloading:"
msgstr "" msgstr ""
#: src/main.cc:276 #: src/main.cc:227
#, fuzzy #, fuzzy
msgid " Download a file using local .metalink file:" msgid " Download a file using local .metalink file:"
msgstr " Einen torrent mit einer lokalen .torrent-Datei abrufen:" msgstr " Einen torrent mit einer lokalen .torrent-Datei abrufen:"
#: src/main.cc:278 #: src/main.cc:229
msgid " Metalink downloading with preferences:" msgid " Metalink downloading with preferences:"
msgstr "" msgstr ""
#: src/main.cc:282 #: src/main.cc:233
#, c-format #, c-format
msgid "Report bugs to %s" msgid "Report bugs to %s"
msgstr "Fehler an %s melden" msgstr "Fehler an %s melden"
#: src/main.cc:446 #: src/main.cc:358
msgid "unrecognized proxy format" msgid "unrecognized proxy format"
msgstr "nicht erkanntes Proxy-Format" msgstr "nicht erkanntes Proxy-Format"
#: src/main.cc:473 #: src/main.cc:385
msgid "Currently, supported authentication scheme is basic." msgid "Currently, supported authentication scheme is basic."
msgstr "Derzeit unterstütztes Authentifizierungsschema ist basic." msgstr "Derzeit unterstütztes Authentifizierungsschema ist basic."
#: src/main.cc:482 #: src/main.cc:394
msgid "retry-wait must be between 0 and 60." msgid "retry-wait must be between 0 and 60."
msgstr "retry-wait muss zwischen 0 und 60 liegen." msgstr "retry-wait muss zwischen 0 und 60 liegen."
#: src/main.cc:499 #: src/main.cc:411
msgid "ftp-type must be either 'binary' or 'ascii'." msgid "ftp-type must be either 'binary' or 'ascii'."
msgstr "ftp-type muss entweder 'binary' oder 'ascii' sein." msgstr "ftp-type muss entweder 'binary' oder 'ascii' sein."
#: src/main.cc:508 #: src/main.cc:420
msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'." msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'."
msgstr "ftp-via-http-proxy muss entweder 'get' oder 'tunnel' sein." msgstr "ftp-via-http-proxy muss entweder 'get' oder 'tunnel' sein."
#: src/main.cc:526 #: src/main.cc:428
msgid "min-segment-size invalid" msgid "min-segment-size invalid"
msgstr "min-segment-size ungültig" msgstr "min-segment-size ungültig"
#: src/main.cc:537 #: src/main.cc:439
msgid "http-proxy-method must be either 'get' or 'tunnel'." msgid "http-proxy-method must be either 'get' or 'tunnel'."
msgstr "http-proxy-method muss entweder 'get' oder 'tunnel' sein." msgstr "http-proxy-method muss entweder 'get' oder 'tunnel' sein."
#: src/main.cc:545 #: src/main.cc:447
msgid "listen-port must be between 1024 and 65535." msgid "listen-port must be between 1024 and 65535."
msgstr "listen-port muss zwischen 1024 und 65535 liegen." msgstr "listen-port muss zwischen 1024 und 65535 liegen."
#: src/main.cc:556 #: src/main.cc:460
msgid "follow-torrent must be either 'true' or 'false'." msgid "follow-torrent must be either 'true' or 'false'."
msgstr "follow-torrent muss entweder 'true' oder 'false' sein." msgstr "follow-torrent muss entweder 'true' oder 'false' sein."
#: src/main.cc:570 #: src/main.cc:474
msgid "direct-file-mapping must be either 'true' or 'false'." msgid "direct-file-mapping must be either 'true' or 'false'."
msgstr "direct-file-mapping muss entweder 'true' oder 'false' sein." msgstr "direct-file-mapping muss entweder 'true' oder 'false' sein."
#: src/main.cc:578 #: src/main.cc:482
msgid "upload-limit must be greater than or equal to 0." msgid "upload-limit must be greater than or equal to 0."
msgstr "upload-limit muss größer oder gleich 0 sein." msgstr "upload-limit muss größer oder gleich 0 sein."
#: src/main.cc:603 #: src/main.cc:507
#, fuzzy #, fuzzy
msgid "follow-metalink must be either 'true' or 'false'." msgid "follow-metalink must be either 'true' or 'false'."
msgstr "follow-torrent muss entweder 'true' oder 'false' sein." msgstr "follow-torrent muss entweder 'true' oder 'false' sein."
#: src/main.cc:630 #: src/main.cc:515
#, fuzzy
msgid "lowest-speed-limit must be greater than or equal to 0"
msgstr "upload-limit muss größer oder gleich 0 sein."
#: src/main.cc:544
msgid "split must be between 1 and 5." msgid "split must be between 1 and 5."
msgstr "split muss zwischen 1 und 5 liegen." msgstr "split muss zwischen 1 und 5 liegen."
#: src/main.cc:640 #: src/main.cc:556
msgid "timeout must be between 1 and 600" msgid "timeout must be between 1 and 600"
msgstr "timeout muss zwischen 1 und 600 liegen." msgstr "timeout muss zwischen 1 und 600 liegen."
#: src/main.cc:649 #: src/main.cc:565
msgid "max-tries invalid" msgid "max-tries invalid"
msgstr "max-tries ungültig" msgstr "max-tries ungültig"
#: src/main.cc:671 #: src/main.cc:587
#, fuzzy #, fuzzy
msgid "metalink-servers must be greater than 0." msgid "metalink-servers must be greater than 0."
msgstr "upload-limit muss größer oder gleich 0 sein." msgstr "upload-limit muss größer oder gleich 0 sein."
#: src/main.cc:689 #: src/main.cc:607
msgid "specify at least one URL" msgid "specify at least one URL"
msgstr "Geben Sie zumindest eine URL an" msgstr "Geben Sie zumindest eine URL an"
#: src/main.cc:696 #: src/main.cc:614
msgid "daemon failed" msgid "daemon failed"
msgstr "Daemon-Start nicht erfolgreich" msgstr "Daemon-Start nicht erfolgreich"
#: src/main.cc:837
msgid "Files:"
msgstr "Dateien:"
#: src/main.cc:868
msgid "Errors occurred while binding port.\n"
msgstr "Fehler beim Binden an Port aufgetreten.\n"

BIN
po/ja.gmo

Binary file not shown.

231
po/ja.po
View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: aria2c 0.2.1\n" "Project-Id-Version: aria2c 0.2.1\n"
"Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n" "Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n"
"POT-Creation-Date: 2006-07-21 00:57+0900\n" "POT-Creation-Date: 2006-08-07 22:15+0900\n"
"PO-Revision-Date: 2006-07-04 01:41+0900\n" "PO-Revision-Date: 2006-07-04 01:41+0900\n"
"Last-Translator: Tatsuhiro Tsujikawa <tujikawa@rednoah.com>\n" "Last-Translator: Tatsuhiro Tsujikawa <tujikawa@rednoah.com>\n"
"Language-Team: Japanese <ja@li.org>\n" "Language-Team: Japanese <ja@li.org>\n"
@ -16,6 +16,23 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n" "Plural-Forms: nplurals=1; plural=0;\n"
#: src/RequestInfo.h:76
#, c-format
msgid ""
"\n"
"The download was complete. <%s>\n"
msgstr ""
"\n"
"<%s> のダウンロードが完了しました.\n"
#: src/RequestInfo.h:84
msgid ""
"\n"
"The download was not complete because of errors. Check the log.\n"
msgstr ""
"\n"
"ダウンロードはエラーのため完了していません. ログを確認してください.\n"
#: src/message.h:27 #: src/message.h:27
#, c-format #, c-format
msgid "CUID#%d - The download for one segment completed successfully." msgid "CUID#%d - The download for one segment completed successfully."
@ -341,24 +358,15 @@ msgstr "
msgid "Failed to peek data, cause: %s" msgid "Failed to peek data, cause: %s"
msgstr "データの peek に失敗しました. 原因: %s" msgstr "データの peek に失敗しました. 原因: %s"
#: src/main.cc:76 #: src/DownloadEngineFactory.cc:102
#, c-format msgid "Errors occurred while binding port.\n"
msgid "" msgstr "ポートをバインド中にエラーが発生しました.\n"
"\n"
"The download was complete. <%s>\n"
msgstr ""
"\n"
"<%s> のダウンロードが完了しました.\n"
#: src/main.cc:84 #: src/TorrentRequestInfo.cc:71
msgid "" msgid "Files:"
"\n" msgstr "ファイル:"
"The download was not complete because of errors. Check the log.\n"
msgstr ""
"\n"
"ダウンロードはエラーのため完了していません. ログを確認してください.\n"
#: src/main.cc:101 #: src/UrlRequestInfo.cc:57
msgid "" msgid ""
"\n" "\n"
"stopping application...\n" "stopping application...\n"
@ -366,22 +374,22 @@ msgstr ""
"\n" "\n"
"アプリケーションを終了しています...\n" "アプリケーションを終了しています...\n"
#: src/main.cc:107 #: src/UrlRequestInfo.cc:62
msgid "done\n" msgid "done\n"
msgstr "完了\n" msgstr "完了\n"
#: src/main.cc:123 #: src/UrlRequestInfo.cc:86
#, c-format #, c-format
msgid "Unrecognized URL or unsupported protocol: %s\n" msgid "Unrecognized URL or unsupported protocol: %s\n"
msgstr "" msgstr ""
"%s は, 理解できない URL フォーマット, または, サポートされないプロトコルで" "%s は, 理解できない URL フォーマット, または, サポートされないプロトコルで"
"す.\n" "す.\n"
#: src/main.cc:129 #: src/main.cc:71
msgid " version " msgid " version "
msgstr " バージョン " msgstr " バージョン "
#: src/main.cc:133 #: src/main.cc:78
msgid "" msgid ""
"This program is free software; you can redistribute it and/or modify\n" "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" "it under the terms of the GNU General Public License as published by\n"
@ -411,41 +419,41 @@ msgstr ""
"along with this program; if not, write to the Free Software\n" "along with this program; if not, write to the Free Software\n"
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"
#: src/main.cc:147 #: src/main.cc:92
#, c-format #, c-format
msgid "Contact Info: %s\n" msgid "Contact Info: %s\n"
msgstr "連絡先: %s\n" msgstr "連絡先: %s\n"
#: src/main.cc:153 #: src/main.cc:98
#, c-format #, c-format
msgid "Usage: %s [options] URL ...\n" msgid "Usage: %s [options] URL ...\n"
msgstr "使い方: %s [オプション] URL ...\n" msgstr "使い方: %s [オプション] URL ...\n"
#: src/main.cc:155 #: src/main.cc:100
#, c-format #, c-format
msgid " %s [options] -T TORRENT_FILE FILE ...\n" msgid " %s [options] -T TORRENT_FILE FILE ...\n"
msgstr " %s [オプション] -T TORRENT_FILE FILE ...\n" msgstr " %s [オプション] -T TORRENT_FILE FILE ...\n"
#: src/main.cc:158 #: src/main.cc:103
#, c-format #, c-format
msgid " %s [options] -M METALINK_FILE\n" msgid " %s [options] -M METALINK_FILE\n"
msgstr " %s [オプション] -M METALINK_FILE\n" msgstr " %s [オプション] -M METALINK_FILE\n"
#: src/main.cc:161 #: src/main.cc:106
msgid "Options:" msgid "Options:"
msgstr "オプション:" msgstr "オプション:"
#: src/main.cc:162 #: src/main.cc:107
msgid " -d, --dir=DIR The directory to store downloaded file." msgid " -d, --dir=DIR The directory to store downloaded file."
msgstr "" msgstr ""
" -d, --dir=DIR ダウンロードしたファイルを保存するディレクトリ." " -d, --dir=DIR ダウンロードしたファイルを保存するディレクトリ."
#: src/main.cc:163 #: src/main.cc:108
msgid " -o, --out=FILE The file name for downloaded file." msgid " -o, --out=FILE The file name for downloaded file."
msgstr "" msgstr ""
" -o, --out=FILE ダウンロードしたファイルの保存先ファイル名." " -o, --out=FILE ダウンロードしたファイルの保存先ファイル名."
#: src/main.cc:164 #: src/main.cc:109
msgid "" msgid ""
" -l, --log=LOG The file path to store log. If '-' is " " -l, --log=LOG The file path to store log. If '-' is "
"specified,\n" "specified,\n"
@ -455,11 +463,11 @@ msgstr ""
"力\n" "力\n"
" に出力します." " に出力します."
#: src/main.cc:166 #: src/main.cc:111
msgid " -D, --daemon Run as daemon." msgid " -D, --daemon Run as daemon."
msgstr " -D, --daemon デーモンとして起動します." msgstr " -D, --daemon デーモンとして起動します."
#: src/main.cc:167 #: src/main.cc:112
msgid "" msgid ""
" -s, --split=N Download a file using N connections. N must " " -s, --split=N Download a file using N connections. N must "
"be\n" "be\n"
@ -478,7 +486,7 @@ msgstr ""
"ショ\n" "ショ\n"
" ンを確立します." " ンを確立します."
#: src/main.cc:171 #: src/main.cc:116
msgid "" msgid ""
" --retry-wait=SEC Set amount of time in second between requests\n" " --retry-wait=SEC Set amount of time in second between requests\n"
" for errors. Specify a value between 0 and 60.\n" " for errors. Specify a value between 0 and 60.\n"
@ -489,13 +497,13 @@ msgstr ""
" す. 0 - 60 の値を指定してください.\n" " す. 0 - 60 の値を指定してください.\n"
" デフォルト値: 5" " デフォルト値: 5"
#: src/main.cc:174 #: src/main.cc:119
msgid " -t, --timeout=SEC Set timeout in second. Default: 60" msgid " -t, --timeout=SEC Set timeout in second. Default: 60"
msgstr "" msgstr ""
" -t, --timeout=SEC タイムアウトとなる時間を秒で指定します.\n" " -t, --timeout=SEC タイムアウトとなる時間を秒で指定します.\n"
" デフォルト値: 60" " デフォルト値: 60"
#: src/main.cc:175 #: src/main.cc:120
msgid "" msgid ""
" -m, --max-tries=N Set number of tries. 0 means unlimited.\n" " -m, --max-tries=N Set number of tries. 0 means unlimited.\n"
" Default: 5" " Default: 5"
@ -504,12 +512,13 @@ msgstr ""
"行\n" "行\n"
" します. デフォルト値: 5" " します. デフォルト値: 5"
#: src/main.cc:177 #: src/main.cc:122
#, fuzzy
msgid "" msgid ""
" --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n" " --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n"
" K or M(1K = 1024, 1M = 1024K). This\n" " K or M(1K = 1024, 1M = 1024K). This\n"
" value must be greater than or equal to\n" " value must be greater than or equal to\n"
" 1024." " 1024. Default: 1M"
msgstr "" msgstr ""
" --min-segment-size=SIZE[K|M] 最小のセグメント・サイズを指定します. K または " " --min-segment-size=SIZE[K|M] 最小のセグメント・サイズを指定します. K または "
"M\n" "M\n"
@ -517,7 +526,7 @@ msgstr ""
"1024K).\n" "1024K).\n"
" 1024 以上の値を指定してください." " 1024 以上の値を指定してください."
#: src/main.cc:181 #: src/main.cc:126
msgid "" msgid ""
" --http-proxy=HOST:PORT Use HTTP proxy server. This affects to all\n" " --http-proxy=HOST:PORT Use HTTP proxy server. This affects to all\n"
" URLs." " URLs."
@ -526,14 +535,14 @@ msgstr ""
"シ\n" "シ\n"
" ョンはすべての URL に影響します." " ョンはすべての URL に影響します."
#: src/main.cc:183 #: src/main.cc:128
msgid " --http-user=USER Set HTTP user. This affects to all URLs." msgid " --http-user=USER Set HTTP user. This affects to all URLs."
msgstr "" msgstr ""
" --http-user=USER HTTP での認証ユーザーを指定します. このオプショ" " --http-user=USER HTTP での認証ユーザーを指定します. このオプショ"
"ン\n" "ン\n"
" はすべての URL に影響します." " はすべての URL に影響します."
#: src/main.cc:184 #: src/main.cc:129
msgid "" msgid ""
" --http-passwd=PASSWD Set HTTP password. This affects to all URLs." " --http-passwd=PASSWD Set HTTP password. This affects to all URLs."
msgstr "" msgstr ""
@ -541,7 +550,7 @@ msgstr ""
"ショ\n" "ショ\n"
" ンはすべての URL に影響します." " ンはすべての URL に影響します."
#: src/main.cc:185 #: src/main.cc:130
msgid "" msgid ""
" --http-proxy-user=USER Set HTTP proxy user. This affects to all URLs" " --http-proxy-user=USER Set HTTP proxy user. This affects to all URLs"
msgstr "" msgstr ""
@ -551,7 +560,7 @@ msgstr ""
"ま\n" "ま\n"
" す." " す."
#: src/main.cc:186 #: src/main.cc:131
msgid "" msgid ""
" --http-proxy-passwd=PASSWD Set HTTP proxy password. This affects to all " " --http-proxy-passwd=PASSWD Set HTTP proxy password. This affects to all "
"URLs." "URLs."
@ -562,7 +571,7 @@ msgstr ""
"し\n" "し\n"
" ます." " ます."
#: src/main.cc:187 #: src/main.cc:132
msgid "" msgid ""
" --http-proxy-method=METHOD Set the method to use in proxy request.\n" " --http-proxy-method=METHOD Set the method to use in proxy request.\n"
" METHOD is either 'get' or 'tunnel'.\n" " METHOD is either 'get' or 'tunnel'.\n"
@ -573,7 +582,7 @@ msgstr ""
" す. 'get' または 'tunnel' を指定してください.\n" " す. 'get' または 'tunnel' を指定してください.\n"
" デフォルト値: tunnel" " デフォルト値: tunnel"
#: src/main.cc:190 #: src/main.cc:135
msgid "" msgid ""
" --http-auth-scheme=SCHEME Set HTTP authentication scheme. Currently, " " --http-auth-scheme=SCHEME Set HTTP authentication scheme. Currently, "
"basic\n" "basic\n"
@ -585,14 +594,14 @@ msgstr ""
" いるのは basic です. \n" " いるのは basic です. \n"
" デフォルト値: basic" " デフォルト値: basic"
#: src/main.cc:193 #: src/main.cc:138
msgid " --referer=REFERER Set Referer. This affects to all URLs." msgid " --referer=REFERER Set Referer. This affects to all URLs."
msgstr "" msgstr ""
" --referer=REFERER リファラーを指定します. このオプションはすべて" " --referer=REFERER リファラーを指定します. このオプションはすべて"
"の\n" "の\n"
" URL に影響します." " URL に影響します."
#: src/main.cc:194 #: src/main.cc:139
msgid "" msgid ""
" --ftp-user=USER Set FTP user. This affects to all URLs.\n" " --ftp-user=USER Set FTP user. This affects to all URLs.\n"
" Default: anonymous" " Default: anonymous"
@ -602,7 +611,7 @@ msgstr ""
" はすべての URL に影響します.\n" " はすべての URL に影響します.\n"
" デフォルト値: anonymous" " デフォルト値: anonymous"
#: src/main.cc:196 #: src/main.cc:141
msgid "" msgid ""
" --ftp-passwd=PASSWD Set FTP password. This affects to all URLs.\n" " --ftp-passwd=PASSWD Set FTP password. This affects to all URLs.\n"
" Default: ARIA2USER@" " Default: ARIA2USER@"
@ -612,7 +621,7 @@ msgstr ""
" ンはすべての URL に影響します.\n" " ンはすべての URL に影響します.\n"
" デフォルト値: ARIA2USER@" " デフォルト値: ARIA2USER@"
#: src/main.cc:198 #: src/main.cc:143
msgid "" msgid ""
" --ftp-type=TYPE Set FTP transfer type. TYPE is either " " --ftp-type=TYPE Set FTP transfer type. TYPE is either "
"'binary'\n" "'binary'\n"
@ -623,11 +632,11 @@ msgstr ""
" 'ascii' を指定してください. デフォルト値: " " 'ascii' を指定してください. デフォルト値: "
"binary" "binary"
#: src/main.cc:201 #: src/main.cc:146
msgid " -p, --ftp-pasv Use passive mode in FTP." msgid " -p, --ftp-pasv Use passive mode in FTP."
msgstr " -p, --ftp-pasv FTP で passive モードを使用します." msgstr " -p, --ftp-pasv FTP で passive モードを使用します."
#: src/main.cc:202 #: src/main.cc:147
msgid "" msgid ""
" --ftp-via-http-proxy=METHOD Use HTTP proxy in FTP. METHOD is either 'get' " " --ftp-via-http-proxy=METHOD Use HTTP proxy in FTP. METHOD is either 'get' "
"or\n" "or\n"
@ -640,11 +649,26 @@ msgstr ""
"く\n" "く\n"
" ださい. デフォルト値: tunnel" " ださい. デフォルト値: tunnel"
#: src/main.cc:206 #: src/main.cc:150
msgid ""
" --lowest-speed-limit Close connection if download speed is lower "
"than\n"
" or equal to this value. 0 means aria2 does "
"not\n"
" care lowest speed limit. You can use K or M "
"in\n"
" the same manner as in --min-segment-size "
"option.\n"
" This option does not affect BitTorrent "
"download.\n"
" Default: 0"
msgstr ""
#: src/main.cc:157
msgid " -T, --torrent-file=TORRENT_FILE The file path to .torrent file." msgid " -T, --torrent-file=TORRENT_FILE The file path to .torrent file."
msgstr " -T, --torrent-file=TORRENT_FILE .torrent ファイルのパスを指定." msgstr " -T, --torrent-file=TORRENT_FILE .torrent ファイルのパスを指定."
#: src/main.cc:207 #: src/main.cc:158
msgid "" msgid ""
" --follow-torrent=true|false Setting this option to false prevents aria2 " " --follow-torrent=true|false Setting this option to false prevents aria2 "
"to\n" "to\n"
@ -659,7 +683,7 @@ msgstr ""
" は, BitTorrent モードに入りません.\n" " は, BitTorrent モードに入りません.\n"
" デフォルト値: true" " デフォルト値: true"
#: src/main.cc:211 #: src/main.cc:162
msgid "" msgid ""
" -S, --show-files Print file listing of .torrent file and exit." " -S, --show-files Print file listing of .torrent file and exit."
msgstr "" msgstr ""
@ -667,7 +691,7 @@ msgstr ""
"し\n" "し\n"
" 終了します." " 終了します."
#: src/main.cc:212 #: src/main.cc:163
msgid "" msgid ""
" --direct-file-mapping=true|false Directly read from and write to each file\n" " --direct-file-mapping=true|false Directly read from and write to each file\n"
" mentioned in .torrent file.\n" " mentioned in .torrent file.\n"
@ -678,14 +702,14 @@ msgstr ""
" します.\n" " します.\n"
" デフォルト値: true" " デフォルト値: true"
#: src/main.cc:215 #: src/main.cc:166
msgid "" msgid ""
" --listen-port=PORT Set port number to listen to for peer " " --listen-port=PORT Set port number to listen to for peer "
"connection." "connection."
msgstr "" msgstr ""
" --listen-port=PORT ピアからの接続を受け付けるポート番号を指定." " --listen-port=PORT ピアからの接続を受け付けるポート番号を指定."
#: src/main.cc:216 #: src/main.cc:167
msgid "" msgid ""
" --upload-limit=SPEED Set upload speed limit in KB/sec. aria2 tries " " --upload-limit=SPEED Set upload speed limit in KB/sec. aria2 tries "
"to\n" "to\n"
@ -698,7 +722,7 @@ msgstr ""
"し\n" "し\n"
" ます. 0 は速度無制限を意味します." " ます. 0 は速度無制限を意味します."
#: src/main.cc:218 #: src/main.cc:169
msgid "" msgid ""
" --select-file=INDEX... Set file to download by specifing its index.\n" " --select-file=INDEX... Set file to download by specifing its index.\n"
" You can know file index through --show-files\n" " You can know file index through --show-files\n"
@ -719,11 +743,11 @@ msgstr ""
" また, '-' を使って範囲指定もできます: \"1-5\"\n" " また, '-' を使って範囲指定もできます: \"1-5\"\n"
" ',' と '-' は組み合わせて使うことができます." " ',' と '-' は組み合わせて使うことができます."
#: src/main.cc:226 #: src/main.cc:177
msgid " -M, --metalink-file=METALINK_FILE The file path to .metalink file." msgid " -M, --metalink-file=METALINK_FILE The file path to .metalink file."
msgstr " -M, --metalink-file=METALINK_FILE .metalink ファイルのパスを指定." msgstr " -M, --metalink-file=METALINK_FILE .metalink ファイルのパスを指定."
#: src/main.cc:227 #: src/main.cc:178
msgid "" msgid ""
" -C, --metalink-servers=NUM_SERVERS The number of servers to connect to\n" " -C, --metalink-servers=NUM_SERVERS The number of servers to connect to\n"
" simultaneously. If more than one connection " " simultaneously. If more than one connection "
@ -737,15 +761,15 @@ msgstr ""
" 使用してください.\n" " 使用してください.\n"
" デフォルト値: 15" " デフォルト値: 15"
#: src/main.cc:231 #: src/main.cc:182
msgid " --metalink-version=VERSION The version of file to download." msgid " --metalink-version=VERSION The version of file to download."
msgstr " --metalink-version=VERSION ダウンロードするファイルのバージョン." msgstr " --metalink-version=VERSION ダウンロードするファイルのバージョン."
#: src/main.cc:232 #: src/main.cc:183
msgid " --metalink-language=LANGUAGE The language of file to download." msgid " --metalink-language=LANGUAGE The language of file to download."
msgstr " --metalink-language=LANGUAGE ダウンロードするファイルの言語." msgstr " --metalink-language=LANGUAGE ダウンロードするファイルの言語."
#: src/main.cc:233 #: src/main.cc:184
msgid "" msgid ""
" --metalink-os=OS The operating system the file is targeted." " --metalink-os=OS The operating system the file is targeted."
msgstr "" msgstr ""
@ -753,7 +777,7 @@ msgstr ""
"レー\n" "レー\n"
" ティング・システム." " ティング・システム."
#: src/main.cc:234 #: src/main.cc:185
msgid "" msgid ""
" --follow-metalink=true|false Setting this option to false prevents aria2 " " --follow-metalink=true|false Setting this option to false prevents aria2 "
"to\n" "to\n"
@ -768,16 +792,16 @@ msgstr ""
" は, Metalink モードに入りません.\n" " は, Metalink モードに入りません.\n"
" デフォルト値: true" " デフォルト値: true"
#: src/main.cc:239 #: src/main.cc:190
msgid " -v, --version Print the version number and exit." msgid " -v, --version Print the version number and exit."
msgstr " -v, --version バージョン番号を表示し, 終了します." msgstr " -v, --version バージョン番号を表示し, 終了します."
#: src/main.cc:240 #: src/main.cc:191
msgid " -h, --help Print this message and exit." msgid " -h, --help Print this message and exit."
msgstr "" msgstr ""
" -h, --help このヘルプメッセージを表示し, 終了します." " -h, --help このヘルプメッセージを表示し, 終了します."
#: src/main.cc:243 #: src/main.cc:194
msgid "" msgid ""
" You can specify multiple URLs. All URLs must point to the same file\n" " You can specify multiple URLs. All URLs must point to the same file\n"
" or downloading fails." " or downloading fails."
@ -786,7 +810,7 @@ msgstr ""
"れ\n" "れ\n"
" ばなりません. さもなくばダウンロードは失敗します." " ばなりません. さもなくばダウンロードは失敗します."
#: src/main.cc:248 #: src/main.cc:199
msgid "" msgid ""
" Specify files in multi-file torrent to download. Use conjunction with\n" " Specify files in multi-file torrent to download. Use conjunction with\n"
" -T option. This arguments are ignored if you specify --select-file option." " -T option. This arguments are ignored if you specify --select-file option."
@ -795,135 +819,132 @@ msgstr ""
"ン\n" "ン\n"
" と共に使用します. --select-file オプションと併用はできません." " と共に使用します. --select-file オプションと併用はできません."
#: src/main.cc:252 #: src/main.cc:203
msgid "Examples:" msgid "Examples:"
msgstr "例:" msgstr "例:"
#: src/main.cc:253 #: src/main.cc:204
msgid " Download a file by 1 connection:" msgid " Download a file by 1 connection:"
msgstr " 1 コネクションでのダウンロード:" msgstr " 1 コネクションでのダウンロード:"
#: src/main.cc:255 #: src/main.cc:206
msgid " Download a file by 2 connections:" msgid " Download a file by 2 connections:"
msgstr " 2 コネクションでのダウンロード:" msgstr " 2 コネクションでのダウンロード:"
#: src/main.cc:257 #: src/main.cc:208
msgid " Download a file by 2 connections, each connects to a different server:" msgid " Download a file by 2 connections, each connects to a different server:"
msgstr " 二つの異なるサーバーに接続してダウンロード:" msgstr " 二つの異なるサーバーに接続してダウンロード:"
#: src/main.cc:259 #: src/main.cc:210
msgid " You can mix up different protocols:" msgid " You can mix up different protocols:"
msgstr " 異なるプロトコルを混合させてダウンロード:" msgstr " 異なるプロトコルを混合させてダウンロード:"
#: src/main.cc:263 #: src/main.cc:214
msgid " Download a torrent:" msgid " Download a torrent:"
msgstr " torrent をダウンロード:" msgstr " torrent をダウンロード:"
#: src/main.cc:265 #: src/main.cc:216
msgid " Download a torrent using local .torrent file:" msgid " Download a torrent using local .torrent file:"
msgstr " ローカル .torrent ファイルを使ってダウンロード:" msgstr " ローカル .torrent ファイルを使ってダウンロード:"
#: src/main.cc:267 #: src/main.cc:218
msgid " Download only selected files:" msgid " Download only selected files:"
msgstr " ファイルを指定してダウンロード:" msgstr " ファイルを指定してダウンロード:"
#: src/main.cc:269 #: src/main.cc:220
msgid " Print file listing of .torrent file:" msgid " Print file listing of .torrent file:"
msgstr " この .torrent ファイルに含まれるファイルリストを表示:" msgstr " この .torrent ファイルに含まれるファイルリストを表示:"
#: src/main.cc:274 #: src/main.cc:225
msgid " Metalink downloading:" msgid " Metalink downloading:"
msgstr " Metalink でダウンロード:" msgstr " Metalink でダウンロード:"
#: src/main.cc:276 #: src/main.cc:227
msgid " Download a file using local .metalink file:" msgid " Download a file using local .metalink file:"
msgstr " ローカル .metalink ファイルを使ってダウンロード:" msgstr " ローカル .metalink ファイルを使ってダウンロード:"
#: src/main.cc:278 #: src/main.cc:229
msgid " Metalink downloading with preferences:" msgid " Metalink downloading with preferences:"
msgstr " ユーザ設定による Metalink ダウンロード:" msgstr " ユーザ設定による Metalink ダウンロード:"
#: src/main.cc:282 #: src/main.cc:233
#, c-format #, c-format
msgid "Report bugs to %s" msgid "Report bugs to %s"
msgstr "バグレポートはこちらへ: %s" msgstr "バグレポートはこちらへ: %s"
#: src/main.cc:446 #: src/main.cc:358
msgid "unrecognized proxy format" msgid "unrecognized proxy format"
msgstr "理解できないProxyフォーマットです." msgstr "理解できないProxyフォーマットです."
#: src/main.cc:473 #: src/main.cc:385
msgid "Currently, supported authentication scheme is basic." msgid "Currently, supported authentication scheme is basic."
msgstr "現在サポートされている認証方法は basic です." msgstr "現在サポートされている認証方法は basic です."
#: src/main.cc:482 #: src/main.cc:394
msgid "retry-wait must be between 0 and 60." msgid "retry-wait must be between 0 and 60."
msgstr "retry-wait は 0 から 60 の間で指定してください." msgstr "retry-wait は 0 から 60 の間で指定してください."
#: src/main.cc:499 #: src/main.cc:411
msgid "ftp-type must be either 'binary' or 'ascii'." msgid "ftp-type must be either 'binary' or 'ascii'."
msgstr "ftp-type は 'binary' または 'ascii' を指定してください." msgstr "ftp-type は 'binary' または 'ascii' を指定してください."
#: src/main.cc:508 #: src/main.cc:420
msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'." msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'."
msgstr "ftp-via-http-proxy は 'get' または 'tunnel' を指定してください." msgstr "ftp-via-http-proxy は 'get' または 'tunnel' を指定してください."
#: src/main.cc:526 #: src/main.cc:428
msgid "min-segment-size invalid" msgid "min-segment-size invalid"
msgstr "min-segment-size が不正です." msgstr "min-segment-size が不正です."
#: src/main.cc:537 #: src/main.cc:439
msgid "http-proxy-method must be either 'get' or 'tunnel'." msgid "http-proxy-method must be either 'get' or 'tunnel'."
msgstr "http-proxy-method は 'get' または 'tunnel' を指定してください." msgstr "http-proxy-method は 'get' または 'tunnel' を指定してください."
#: src/main.cc:545 #: src/main.cc:447
msgid "listen-port must be between 1024 and 65535." msgid "listen-port must be between 1024 and 65535."
msgstr "listen-port は 1024 - 65535 の値を指定してください." msgstr "listen-port は 1024 - 65535 の値を指定してください."
#: src/main.cc:556 #: src/main.cc:460
msgid "follow-torrent must be either 'true' or 'false'." msgid "follow-torrent must be either 'true' or 'false'."
msgstr "follow-torrent は 'true' または 'false を指定してください." msgstr "follow-torrent は 'true' または 'false を指定してください."
#: src/main.cc:570 #: src/main.cc:474
msgid "direct-file-mapping must be either 'true' or 'false'." msgid "direct-file-mapping must be either 'true' or 'false'."
msgstr "direct-file-mapping は 'true' または 'false を指定してください." msgstr "direct-file-mapping は 'true' または 'false を指定してください."
#: src/main.cc:578 #: src/main.cc:482
msgid "upload-limit must be greater than or equal to 0." msgid "upload-limit must be greater than or equal to 0."
msgstr "upload-limit は 0 以上の数を指定してください." msgstr "upload-limit は 0 以上の数を指定してください."
#: src/main.cc:603 #: src/main.cc:507
msgid "follow-metalink must be either 'true' or 'false'." msgid "follow-metalink must be either 'true' or 'false'."
msgstr "follow-metalink は 'true' または 'false を指定してください." msgstr "follow-metalink は 'true' または 'false を指定してください."
#: src/main.cc:630 #: src/main.cc:515
#, fuzzy
msgid "lowest-speed-limit must be greater than or equal to 0"
msgstr "upload-limit は 0 以上の数を指定してください."
#: src/main.cc:544
msgid "split must be between 1 and 5." msgid "split must be between 1 and 5."
msgstr "split は 1 - 5 の値を指定してください." msgstr "split は 1 - 5 の値を指定してください."
#: src/main.cc:640 #: src/main.cc:556
msgid "timeout must be between 1 and 600" msgid "timeout must be between 1 and 600"
msgstr "timeout は 1 - 600 の値を指定してください." msgstr "timeout は 1 - 600 の値を指定してください."
#: src/main.cc:649 #: src/main.cc:565
msgid "max-tries invalid" msgid "max-tries invalid"
msgstr "max-tries が不正です." msgstr "max-tries が不正です."
#: src/main.cc:671 #: src/main.cc:587
msgid "metalink-servers must be greater than 0." msgid "metalink-servers must be greater than 0."
msgstr "metalink-servers は 0 以上の数を指定してください." msgstr "metalink-servers は 0 以上の数を指定してください."
#: src/main.cc:689 #: src/main.cc:607
msgid "specify at least one URL" msgid "specify at least one URL"
msgstr "一個以上の URL を指定してください." msgstr "一個以上の URL を指定してください."
#: src/main.cc:696 #: src/main.cc:614
msgid "daemon failed" msgid "daemon failed"
msgstr "デーモン起動に失敗" msgstr "デーモン起動に失敗"
#: src/main.cc:837
msgid "Files:"
msgstr "ファイル:"
#: src/main.cc:868
msgid "Errors occurred while binding port.\n"
msgstr "ポートをバインド中にエラーが発生しました.\n"

View File

@ -30,17 +30,21 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
AbstractDiskWriter::AbstractDiskWriter():fd(0) { AbstractDiskWriter::AbstractDiskWriter():
fd(0)
#ifdef ENABLE_MESSAGE_DIGEST
,ctx(DIGEST_ALGO_SHA1)
#endif // ENABLE_MESSAGE_DIGEST
{
#ifdef ENABLE_MESSAGE_DIGEST #ifdef ENABLE_MESSAGE_DIGEST
ctx.setAlgo(MessageDigestContext::ALGO_SHA1); ctx.digestInit();
digestInit(ctx);
#endif // ENABLE_MESSAGE_DIGEST #endif // ENABLE_MESSAGE_DIGEST
} }
AbstractDiskWriter::~AbstractDiskWriter() { AbstractDiskWriter::~AbstractDiskWriter() {
closeFile(); closeFile();
#ifdef ENABLE_MESSAGE_DIGEST #ifdef ENABLE_MESSAGE_DIGEST
digestFree(ctx); ctx.digestFree();
#endif // ENABLE_MESSAGE_DIGEST #endif // ENABLE_MESSAGE_DIGEST
} }
@ -100,7 +104,7 @@ int AbstractDiskWriter::readDataInternal(char* data, int len) {
string AbstractDiskWriter::sha1Sum(long long int offset, long long int length) { string AbstractDiskWriter::sha1Sum(long long int offset, long long int length) {
#ifdef ENABLE_MESSAGE_DIGEST #ifdef ENABLE_MESSAGE_DIGEST
digestReset(ctx); ctx.digestReset();
try { try {
int BUFSIZE = 16*1024; int BUFSIZE = 16*1024;
char buf[BUFSIZE]; char buf[BUFSIZE];
@ -108,7 +112,7 @@ string AbstractDiskWriter::sha1Sum(long long int offset, long long int length) {
if(BUFSIZE != readData(buf, BUFSIZE, offset)) { if(BUFSIZE != readData(buf, BUFSIZE, offset)) {
throw string("error"); throw string("error");
} }
digestUpdate(ctx, buf, BUFSIZE); ctx.digestUpdate(buf, BUFSIZE);
offset += BUFSIZE; offset += BUFSIZE;
} }
int r = length%BUFSIZE; int r = length%BUFSIZE;
@ -116,10 +120,10 @@ string AbstractDiskWriter::sha1Sum(long long int offset, long long int length) {
if(r != readData(buf, r, offset)) { if(r != readData(buf, r, offset)) {
throw string("error"); throw string("error");
} }
digestUpdate(ctx, buf, r); ctx.digestUpdate(buf, r);
} }
unsigned char hashValue[20]; unsigned char hashValue[20];
digestFinal(ctx, hashValue); ctx.digestFinal(hashValue);
return Util::toHex(hashValue, 20); return Util::toHex(hashValue, 20);
} catch(string ex) { } catch(string ex) {
throw new DlAbortEx(EX_FILE_SHA1SUM, filename.c_str(), strerror(errno)); throw new DlAbortEx(EX_FILE_SHA1SUM, filename.c_str(), strerror(errno));

64
src/Checksum.h Normal file
View File

@ -0,0 +1,64 @@
/* <!-- copyright */
/*
* aria2 - a simple utility for downloading files faster
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* copyright --> */
#ifndef _D_CHECKSUM_H_
#define _D_CHECKSUM_H_
#include "common.h"
#include "messageDigest.h"
#ifdef ENABLE_MESSAGE_DIGEST
class Checksum {
private:
string md;
MessageDigestContext::DigestAlgo algo;
public:
Checksum(const string& md, MessageDigestContext::DigestAlgo algo):
md(md),
algo(algo) {}
Checksum():
algo(DIGEST_ALGO_SHA1) {}
~Checksum() {}
bool isEmpty() const {
return md.size() == 0;
}
void setMessageDigest(const string& md) {
this->md = md;
}
const string& getMessageDigest() const {
return md;
}
void setDigestAlgo(MessageDigestContext::DigestAlgo algo) {
this->algo = algo;
}
const MessageDigestContext::DigestAlgo& getDigestAlgo() const {
return algo;
}
};
#else
class Checksum {
};
#endif // ENABLE_MESSAGE_DIGEST
#endif // _D_CHECKSUM_H_

View File

@ -20,12 +20,14 @@
*/ */
/* copyright --> */ /* copyright --> */
#include "DownloadCommand.h" #include "DownloadCommand.h"
#include <sys/time.h>
#include "Util.h" #include "Util.h"
#include "DlRetryEx.h" #include "DlRetryEx.h"
#include "DlAbortEx.h"
#include "HttpInitiateConnectionCommand.h" #include "HttpInitiateConnectionCommand.h"
#include "InitiateConnectionCommandFactory.h" #include "InitiateConnectionCommandFactory.h"
#include "message.h" #include "message.h"
#include "prefs.h"
#include <sys/time.h>
DownloadCommand::DownloadCommand(int cuid, Request* req, DownloadEngine* e, DownloadCommand::DownloadCommand(int cuid, Request* req, DownloadEngine* e,
const SocketHandle& s): const SocketHandle& s):
@ -59,6 +61,13 @@ bool DownloadCommand::executeInternal(Segment seg) {
seg.speed = (int)((seg.ds-lastSize)/(diff*1.0)); seg.speed = (int)((seg.ds-lastSize)/(diff*1.0));
sw.reset(); sw.reset();
lastSize = seg.ds; lastSize = seg.ds;
int lowestLimit = e->option->getAsInt(PREF_LOWEST_SPEED_LIMIT);
if(lowestLimit > 0 && seg.speed <= lowestLimit) {
throw new DlAbortEx("CUID#%d - Too slow Downloading speed: %d <= %d(B/s)",
cuid,
seg.speed,
lowestLimit);
}
} }
if(e->segmentMan->totalSize != 0 && bufSize == 0) { if(e->segmentMan->totalSize != 0 && bufSize == 0) {
throw new DlRetryEx(EX_GOT_EOF); throw new DlRetryEx(EX_GOT_EOF);

View File

@ -32,14 +32,13 @@
using namespace std; using namespace std;
DownloadEngine::DownloadEngine():noWait(false), segmentMan(NULL) { DownloadEngine::DownloadEngine():noWait(false), segmentMan(0) {
logger = LogFactory::getInstance(); logger = LogFactory::getInstance();
} }
DownloadEngine::~DownloadEngine() { DownloadEngine::~DownloadEngine() {
if(segmentMan != NULL) { delete segmentMan;
delete segmentMan; cleanQueue();
}
} }
void DownloadEngine::cleanQueue() { void DownloadEngine::cleanQueue() {
@ -66,7 +65,7 @@ public:
void DownloadEngine::run() { void DownloadEngine::run() {
initStatistics(); initStatistics();
Time cp; Time cp;
CommandUuids activeCommandUuids; CommandUuids activeUuids;
while(!commands.empty()) { while(!commands.empty()) {
if(cp.elapsed(1)) { if(cp.elapsed(1)) {
cp.reset(); cp.reset();
@ -79,8 +78,8 @@ void DownloadEngine::run() {
} }
} }
} else { } else {
for(CommandUuids::iterator itr = activeCommandUuids.begin(); for(CommandUuids::iterator itr = activeUuids.begin();
itr != activeCommandUuids.end(); itr++) { itr != activeUuids.end(); itr++) {
Commands::iterator comItr = find_if(commands.begin(), commands.end(), Commands::iterator comItr = find_if(commands.begin(), commands.end(),
FindCommand(*itr)); FindCommand(*itr));
assert(comItr != commands.end()); assert(comItr != commands.end());
@ -92,9 +91,9 @@ void DownloadEngine::run() {
} }
} }
afterEachIteration(); afterEachIteration();
activeCommandUuids.clear(); activeUuids.clear();
if(!noWait && !commands.empty()) { if(!noWait && !commands.empty()) {
waitData(activeCommandUuids); waitData(activeUuids);
} }
noWait = false; noWait = false;
calculateStatistics(); calculateStatistics();
@ -113,63 +112,86 @@ void DownloadEngine::shortSleep() const {
class SetDescriptor { class SetDescriptor {
private: private:
fd_set* fds_ptr;
int* max_ptr; int* max_ptr;
fd_set* rfds_ptr;
fd_set* wfds_ptr;
public: public:
SetDescriptor(int* max_ptr, fd_set* fds_ptr) SetDescriptor(int* max_ptr, fd_set* rfds_ptr, fd_set* wfds_ptr):
:fds_ptr(fds_ptr), max_ptr(max_ptr) {} max_ptr(max_ptr),
rfds_ptr(rfds_ptr),
wfds_ptr(wfds_ptr) {}
void operator()(const SockCmdMap::value_type& pa) { void operator()(const SocketEntry& entry) {
int fd = pa.first->getSockfd(); int fd = entry.socket->getSockfd();
FD_SET(fd, fds_ptr); switch(entry.type) {
case SocketEntry::TYPE_RD:
FD_SET(fd, rfds_ptr);
break;
case SocketEntry::TYPE_WR:
FD_SET(fd, wfds_ptr);
break;
}
if(*max_ptr < fd) { if(*max_ptr < fd) {
*max_ptr = fd; *max_ptr = fd;
} }
} }
}; };
class AccumulateActiveCommandUuid { class AccumulateActiveUuid {
private: private:
CommandUuids* activeCommandUuids_ptr; CommandUuids* activeUuids_ptr;
fd_set* fds_ptr; fd_set* rfds_ptr;
fd_set* wfds_ptr;
public: public:
AccumulateActiveCommandUuid(CommandUuids* activeCommandUuids_ptr, AccumulateActiveUuid(CommandUuids* activeUuids_ptr,
fd_set* fds_ptr) fd_set* rfds_ptr,
:activeCommandUuids_ptr(activeCommandUuids_ptr), fds_ptr(fds_ptr) {} fd_set* wfds_ptr):
activeUuids_ptr(activeUuids_ptr),
rfds_ptr(rfds_ptr),
wfds_ptr(wfds_ptr) {}
void operator()(const SockCmdMap::value_type& pa) { void operator()(const SocketEntry& entry) {
if(FD_ISSET(pa.first->getSockfd(), fds_ptr)) { if(FD_ISSET(entry.socket->getSockfd(), rfds_ptr) ||
activeCommandUuids_ptr->push_back(pa.second); FD_ISSET(entry.socket->getSockfd(), wfds_ptr)) {
activeUuids_ptr->push_back(entry.commandUuid);
} }
/*
switch(entry.type) {
case SocketEntry::TYPE_RD:
if(FD_ISSET(entry.socket->getSockfd(), rfds_ptr)) {
activeUuids_ptr->push_back(entry.commandUuid);
}
break;
case SocketEntry::TYPE_WR:
if(FD_ISSET(entry.socket->getSockfd(), wfds_ptr)) {
activeUuids_ptr->push_back(entry.commandUuid);
}
break;
}
*/
} }
}; };
void DownloadEngine::waitData(CommandUuids& activeCommandUuids) { void DownloadEngine::waitData(CommandUuids& activeUuids) {
fd_set rfds; fd_set rfds;
fd_set wfds; fd_set wfds;
int retval = 0; int retval = 0;
while(1) { struct timeval tv;
struct timeval tv;
memcpy(&rfds, &rfdset, sizeof(fd_set));
memcpy(&rfds, &rfdset, sizeof(fd_set)); memcpy(&wfds, &wfdset, sizeof(fd_set));
memcpy(&wfds, &wfdset, sizeof(fd_set));
tv.tv_sec = 1;
tv.tv_sec = 1; tv.tv_usec = 0;
tv.tv_usec = 0; retval = select(fdmax+1, &rfds, &wfds, NULL, &tv);
retval = select(fdmax+1, &rfds, &wfds, NULL, &tv);
if(retval != -1 || errno != EINTR) {
break;
}
}
if(retval > 0) { if(retval > 0) {
for_each(rsockmap.begin(), rsockmap.end(), for_each(socketEntries.begin(), socketEntries.end(),
AccumulateActiveCommandUuid(&activeCommandUuids, &rfds)); AccumulateActiveUuid(&activeUuids, &rfds, &wfds));
for_each(wsockmap.begin(), wsockmap.end(),
AccumulateActiveCommandUuid(&activeCommandUuids, &wfds)); sort(activeUuids.begin(), activeUuids.end());
sort(activeCommandUuids.begin(), activeCommandUuids.end()); activeUuids.erase(unique(activeUuids.begin(),
activeCommandUuids.erase(unique(activeCommandUuids.begin(), activeUuids.end()),
activeCommandUuids.end()), activeUuids.end());
activeCommandUuids.end());
} }
} }
@ -177,18 +199,15 @@ void DownloadEngine::updateFdSet() {
fdmax = 0; fdmax = 0;
FD_ZERO(&rfdset); FD_ZERO(&rfdset);
FD_ZERO(&wfdset); FD_ZERO(&wfdset);
for_each(rsockmap.begin(), rsockmap.end(), SetDescriptor(&fdmax, &rfdset)); for_each(socketEntries.begin(), socketEntries.end(),
for_each(wsockmap.begin(), wsockmap.end(), SetDescriptor(&fdmax, &wfdset)); SetDescriptor(&fdmax, &rfdset, &wfdset));
} }
bool DownloadEngine::addSocket(SockCmdMap& sockmap, bool DownloadEngine::addSocket(const SocketEntry& entry) {
const SocketHandle& socket, SocketEntries::iterator itr =
const CommandUuid& commandUuid) { find(socketEntries.begin(), socketEntries.end(), entry);
SockCmdMap::iterator itr = find_if(sockmap.begin(), sockmap.end(), if(itr == socketEntries.end()) {
PairFind<SocketHandle, CommandUuid>(socket, commandUuid)); socketEntries.push_back(entry);
if(itr == sockmap.end()) {
SockCmdMap::value_type vt(socket, commandUuid);
sockmap.insert(vt);
updateFdSet(); updateFdSet();
return true; return true;
} else { } else {
@ -196,15 +215,13 @@ bool DownloadEngine::addSocket(SockCmdMap& sockmap,
} }
} }
bool DownloadEngine::deleteSocket(SockCmdMap& sockmap, bool DownloadEngine::deleteSocket(const SocketEntry& entry) {
const SocketHandle& socket, SocketEntries::iterator itr =
const CommandUuid& commandUuid) { find(socketEntries.begin(), socketEntries.end(), entry);
SockCmdMap::iterator itr = find_if(sockmap.begin(), sockmap.end(), if(itr == socketEntries.end()) {
PairFind<SocketHandle, CommandUuid>(socket, commandUuid));
if(itr == sockmap.end()) {
return false; return false;
} else { } else {
sockmap.erase(itr); socketEntries.erase(itr);
updateFdSet(); updateFdSet();
return true; return true;
} }
@ -212,20 +229,24 @@ bool DownloadEngine::deleteSocket(SockCmdMap& sockmap,
bool DownloadEngine::addSocketForReadCheck(const SocketHandle& socket, bool DownloadEngine::addSocketForReadCheck(const SocketHandle& socket,
const CommandUuid& commandUuid) { const CommandUuid& commandUuid) {
return addSocket(rsockmap, socket, commandUuid); SocketEntry entry(socket, commandUuid, SocketEntry::TYPE_RD);
return addSocket(entry);
} }
bool DownloadEngine::deleteSocketForReadCheck(const SocketHandle& socket, bool DownloadEngine::deleteSocketForReadCheck(const SocketHandle& socket,
const CommandUuid& commandUuid) { const CommandUuid& commandUuid) {
return deleteSocket(rsockmap, socket, commandUuid); SocketEntry entry(socket, commandUuid, SocketEntry::TYPE_RD);
return deleteSocket(entry);
} }
bool DownloadEngine::addSocketForWriteCheck(const SocketHandle& socket, bool DownloadEngine::addSocketForWriteCheck(const SocketHandle& socket,
const CommandUuid& commandUuid) { const CommandUuid& commandUuid) {
return addSocket(wsockmap, socket, commandUuid); SocketEntry entry(socket, commandUuid, SocketEntry::TYPE_WR);
return addSocket(entry);
} }
bool DownloadEngine::deleteSocketForWriteCheck(const SocketHandle& socket, bool DownloadEngine::deleteSocketForWriteCheck(const SocketHandle& socket,
const CommandUuid& commandUuid) { const CommandUuid& commandUuid) {
return deleteSocket(wsockmap, socket, commandUuid); SocketEntry entry(socket, commandUuid, SocketEntry::TYPE_WR);
return deleteSocket(entry);
} }

View File

@ -32,22 +32,44 @@
typedef deque<SocketHandle> Sockets; typedef deque<SocketHandle> Sockets;
typedef deque<Command*> Commands; typedef deque<Command*> Commands;
typedef deque<CommandUuid> CommandUuids; typedef deque<CommandUuid> CommandUuids;
typedef multimap<SocketHandle, int> SockCmdMap;
class SocketEntry {
public:
enum TYPE {
TYPE_RD,
TYPE_WR,
};
SocketHandle socket;
CommandUuid commandUuid;
TYPE type;
public:
SocketEntry(const SocketHandle& socket,
const CommandUuid& commandUuid,
TYPE type):
socket(socket), commandUuid(commandUuid), type(type) {}
~SocketEntry() {}
bool operator==(const SocketEntry& entry) {
return socket == entry.socket &&
commandUuid == entry.commandUuid &&
type == entry.type;
}
};
typedef deque<SocketEntry> SocketEntries;
class DownloadEngine { class DownloadEngine {
private: private:
void waitData(CommandUuids& activeCommandUuids); void waitData(CommandUuids& activeUuids);
SockCmdMap rsockmap; SocketEntries socketEntries;
SockCmdMap wsockmap;
fd_set rfdset; fd_set rfdset;
fd_set wfdset; fd_set wfdset;
int fdmax; int fdmax;
void shortSleep() const; void shortSleep() const;
bool addSocket(SockCmdMap& sockmap, const SocketHandle& socket, bool addSocket(const SocketEntry& socketEntry);
const CommandUuid& commandUuid); bool deleteSocket(const SocketEntry& socketEntry);
bool deleteSocket(SockCmdMap& sockmap, const SocketHandle& socket,
const CommandUuid& commandUuid);
protected: protected:
const Logger* logger; const Logger* logger;
virtual void initStatistics() = 0; virtual void initStatistics() = 0;
@ -80,22 +102,5 @@ public:
}; };
template<class T1, class T2>
class PairFind {
private:
T1 first;
T2 second;
public:
PairFind(T1 t1, T2 t2):first(t1), second(t2) {}
bool operator()(const pair<T1, T2>& pa) {
if(pa.first == first && pa.second == second) {
return true;
} else {
return false;
}
}
};
#endif // _D_DOWNLOAD_ENGINE_H_ #endif // _D_DOWNLOAD_ENGINE_H_

View File

@ -0,0 +1,123 @@
/* <!-- copyright */
/*
* aria2 - a simple utility for downloading files faster
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* copyright --> */
#include "DownloadEngineFactory.h"
#include "prefs.h"
#include "DefaultDiskWriter.h"
#include "SplitSlowestSegmentSplitter.h"
#include "InitiateConnectionCommandFactory.h"
#include "ByteArrayDiskWriter.h"
#include "Util.h"
#ifdef ENABLE_BITTORRENT
# include "PeerListenCommand.h"
# include "TrackerWatcherCommand.h"
# include "TrackerUpdateCommand.h"
# include "TorrentAutoSaveCommand.h"
# include "PeerChokeCommand.h"
# include "HaveEraseCommand.h"
#endif // ENABLE_BITTORRENT
ConsoleDownloadEngine*
DownloadEngineFactory::newConsoleEngine(const Option* op,
const Requests& requests,
const Requests& reserved)
{
ConsoleDownloadEngine* e = new ConsoleDownloadEngine();
e->option = op;
e->segmentMan = new SegmentMan();
e->segmentMan->diskWriter = new DefaultDiskWriter();
e->segmentMan->dir = op->get(PREF_DIR);
e->segmentMan->ufilename = op->get(PREF_OUT);
e->segmentMan->option = op;
e->segmentMan->splitter = new SplitSlowestSegmentSplitter();
e->segmentMan->splitter->setMinSegmentSize(op->getAsLLInt(PREF_MIN_SEGMENT_SIZE));
e->segmentMan->reserved = reserved;
int cuidCounter = 1;
for(Requests::const_iterator itr = requests.begin();
itr != requests.end();
itr++, cuidCounter++) {
e->commands.push_back(InitiateConnectionCommandFactory::createInitiateConnectionCommand(cuidCounter, *itr, e));
}
return e;
}
#ifdef ENABLE_BITTORRENT
TorrentConsoleDownloadEngine*
DownloadEngineFactory::newTorrentConsoleEngine(const Option* op,
const string& torrentFile,
const Strings& targetFiles)
{
Request* req = new Request();
req->isTorrent = true;
req->setTrackerEvent(Request::STARTED);
TorrentConsoleDownloadEngine* te = new TorrentConsoleDownloadEngine();
te->option = op;
ByteArrayDiskWriter* byteArrayDiskWriter = new ByteArrayDiskWriter();
te->segmentMan = new SegmentMan();
te->segmentMan->diskWriter = byteArrayDiskWriter;
te->segmentMan->option = op;
te->segmentMan->splitter = new SplitSlowestSegmentSplitter();
te->segmentMan->splitter->setMinSegmentSize(op->getAsLLInt(PREF_MIN_SEGMENT_SIZE));
te->torrentMan = new TorrentMan();
te->torrentMan->setStoreDir(op->get(PREF_DIR));
te->torrentMan->option = op;
te->torrentMan->req = req;
Integers selectIndexes;
Util::unfoldRange(op->get(PREF_SELECT_FILE), selectIndexes);
if(selectIndexes.size()) {
te->torrentMan->setup(torrentFile, selectIndexes);
} else {
te->torrentMan->setup(torrentFile, targetFiles);
}
PeerListenCommand* listenCommand =
new PeerListenCommand(te->torrentMan->getNewCuid(), te);
int port;
int listenPort = op->getAsInt(PREF_LISTEN_PORT);
if(listenPort == -1) {
port = listenCommand->bindPort(6881, 6999);
} else {
port = listenCommand->bindPort(listenPort, listenPort);
}
if(port == -1) {
printf(_("Errors occurred while binding port.\n"));
exit(EXIT_FAILURE);
}
te->torrentMan->setPort(port);
te->commands.push_back(listenCommand);
te->commands.push_back(new TrackerWatcherCommand(te->torrentMan->getNewCuid(),
te,
te->torrentMan->minInterval));
te->commands.push_back(new TrackerUpdateCommand(te->torrentMan->getNewCuid(),
te));
te->commands.push_back(new TorrentAutoSaveCommand(te->torrentMan->getNewCuid(),
te,
op->getAsInt(PREF_AUTO_SAVE_INTERVAL)));
te->commands.push_back(new PeerChokeCommand(te->torrentMan->getNewCuid(),
te, 10));
te->commands.push_back(new HaveEraseCommand(te->torrentMan->getNewCuid(),
te, 10));
return te;
}
#endif // ENABLE_BITTORRENT

View File

@ -0,0 +1,46 @@
/* <!-- copyright */
/*
* aria2 - a simple utility for downloading files faster
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* copyright --> */
#ifndef _D_DOWNLOAD_ENGINE_FACTORY_H_
#define _D_DOWNLOAD_ENGINE_FACTORY_H_
#include "common.h"
#include "ConsoleDownloadEngine.h"
#ifdef ENABLE_BITTORRENT
# include "TorrentConsoleDownloadEngine.h"
#endif // ENABLE_BITTORRENT
class DownloadEngineFactory {
public:
static ConsoleDownloadEngine*
newConsoleEngine(const Option* option,
const Requests& requests,
const Requests& reserved);
#ifdef ENABLE_BITTORRENT
static TorrentConsoleDownloadEngine*
newTorrentConsoleEngine(const Option* option,
const string& torrentFile,
const Strings& targetFiles);
#endif // ENABLE_BITTORRENT
};
#endif // _D_DOWNLOAD_ENGINE_FACTORY_H_

View File

@ -57,6 +57,9 @@ bool FtpNegotiationCommand::executeInternal(Segment segment) {
bool FtpNegotiationCommand::recvGreeting() { bool FtpNegotiationCommand::recvGreeting() {
socket->setBlockingMode(); socket->setBlockingMode();
disableWriteCheckSocket();
setReadCheckSocket(socket);
int status = ftp->receiveResponse(); int status = ftp->receiveResponse();
if(status == 0) { if(status == 0) {
return false; return false;
@ -66,9 +69,6 @@ bool FtpNegotiationCommand::recvGreeting() {
} }
sequence = SEQ_SEND_USER; sequence = SEQ_SEND_USER;
setReadCheckSocket(socket);
disableWriteCheckSocket();
return true; return true;
} }

View File

@ -52,7 +52,10 @@ SRCS = Socket.h\
NullLogger.h\ NullLogger.h\
Time.cc Time.h\ Time.cc Time.h\
SharedHandle.h\ SharedHandle.h\
FeatureConfig.cc FeatureConfig.h FeatureConfig.cc FeatureConfig.h\
DownloadEngineFactory.cc DownloadEngineFactory.h\
RequestInfo.h\
UrlRequestInfo.cc UrlRequestInfo.h
if ENABLE_BITTORRENT if ENABLE_BITTORRENT
SRCS += MetaEntry.h\ SRCS += MetaEntry.h\
@ -108,7 +111,8 @@ SRCS += MetaEntry.h\
SuggestPieceMessage.cc SuggestPieceMessage.h\ SuggestPieceMessage.cc SuggestPieceMessage.h\
SimplePeerMessage.cc SimplePeerMessage.h\ SimplePeerMessage.cc SimplePeerMessage.h\
PeerMessageFactory.cc PeerMessageFactory.h\ PeerMessageFactory.cc PeerMessageFactory.h\
HaveEraseCommand.cc HaveEraseCommand.h HaveEraseCommand.cc HaveEraseCommand.h\
TorrentRequestInfo.cc TorrentRequestInfo.h
endif # ENABLE_BITTORRENT endif # ENABLE_BITTORRENT
if ENABLE_METALINK if ENABLE_METALINK
@ -116,15 +120,16 @@ SRCS += Metalinker.cc Metalinker.h\
MetalinkEntry.cc MetalinkEntry.h\ MetalinkEntry.cc MetalinkEntry.h\
MetalinkResource.cc MetalinkResource.h\ MetalinkResource.cc MetalinkResource.h\
MetalinkProcessor.h\ MetalinkProcessor.h\
Xml2MetalinkProcessor.cc Xml2MetalinkProcessor.h Xml2MetalinkProcessor.cc Xml2MetalinkProcessor.h\
MetalinkRequestInfo.cc MetalinkRequestInfo.h
endif # ENABLE_METALINK endif # ENABLE_METALINK
noinst_LIBRARIES = libaria2c.a noinst_LIBRARIES = libaria2c.a
libaria2c_a_SOURCES = $(SRCS) libaria2c_a_SOURCES = $(SRCS)
aria2c_LDADD = libaria2c.a @LIBINTL@ @ALLOCA@ @LIBGNUTLS_LIBS@\ aria2c_LDADD = libaria2c.a @LIBINTL@ @ALLOCA@ @LIBGNUTLS_LIBS@\
@LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@ @LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@
aria2c_LDFLAGS = -pg #aria2c_LDFLAGS = -pg
AM_CPPFLAGS = -Wall\ AM_CPPFLAGS = -Wall\
-I../lib -I../intl -I$(top_srcdir)/intl\ -I../lib -I../intl -I$(top_srcdir)/intl\
@LIBGNUTLS_CFLAGS@ @LIBGCRYPT_CFLAGS@ @OPENSSL_CFLAGS@ @XML_CPPFLAGS@\ @LIBGNUTLS_CFLAGS@ @LIBGCRYPT_CFLAGS@ @OPENSSL_CFLAGS@ @XML_CPPFLAGS@\
-D_FILE_OFFSET_BITS=64 -DLOCALEDIR=\"$(localedir)\" @DEFS@ -pg -D_FILE_OFFSET_BITS=64 -DLOCALEDIR=\"$(localedir)\" @DEFS@# -pg

View File

@ -91,13 +91,15 @@ bin_PROGRAMS = aria2c$(EXEEXT)
@ENABLE_BITTORRENT_TRUE@ SuggestPieceMessage.cc SuggestPieceMessage.h\ @ENABLE_BITTORRENT_TRUE@ SuggestPieceMessage.cc SuggestPieceMessage.h\
@ENABLE_BITTORRENT_TRUE@ SimplePeerMessage.cc SimplePeerMessage.h\ @ENABLE_BITTORRENT_TRUE@ SimplePeerMessage.cc SimplePeerMessage.h\
@ENABLE_BITTORRENT_TRUE@ PeerMessageFactory.cc PeerMessageFactory.h\ @ENABLE_BITTORRENT_TRUE@ PeerMessageFactory.cc PeerMessageFactory.h\
@ENABLE_BITTORRENT_TRUE@ HaveEraseCommand.cc HaveEraseCommand.h @ENABLE_BITTORRENT_TRUE@ HaveEraseCommand.cc HaveEraseCommand.h\
@ENABLE_BITTORRENT_TRUE@ TorrentRequestInfo.cc TorrentRequestInfo.h
@ENABLE_METALINK_TRUE@am__append_2 = Metalinker.cc Metalinker.h\ @ENABLE_METALINK_TRUE@am__append_2 = Metalinker.cc Metalinker.h\
@ENABLE_METALINK_TRUE@ MetalinkEntry.cc MetalinkEntry.h\ @ENABLE_METALINK_TRUE@ MetalinkEntry.cc MetalinkEntry.h\
@ENABLE_METALINK_TRUE@ MetalinkResource.cc MetalinkResource.h\ @ENABLE_METALINK_TRUE@ MetalinkResource.cc MetalinkResource.h\
@ENABLE_METALINK_TRUE@ MetalinkProcessor.h\ @ENABLE_METALINK_TRUE@ MetalinkProcessor.h\
@ENABLE_METALINK_TRUE@ Xml2MetalinkProcessor.cc Xml2MetalinkProcessor.h @ENABLE_METALINK_TRUE@ Xml2MetalinkProcessor.cc Xml2MetalinkProcessor.h\
@ENABLE_METALINK_TRUE@ MetalinkRequestInfo.cc MetalinkRequestInfo.h
subdir = src subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in alloca.c DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in alloca.c
@ -155,13 +157,14 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
AbstractDiskWriter.h File.cc File.h Option.cc Option.h \ AbstractDiskWriter.h File.cc File.h Option.cc Option.h \
Base64.cc Base64.h CookieBox.cc CookieBox.h messageDigest.h \ Base64.cc Base64.h CookieBox.cc CookieBox.h messageDigest.h \
LogFactory.cc LogFactory.h NullLogger.h Time.cc Time.h \ LogFactory.cc LogFactory.h NullLogger.h Time.cc Time.h \
SharedHandle.h FeatureConfig.cc FeatureConfig.h MetaEntry.h \ SharedHandle.h FeatureConfig.cc FeatureConfig.h \
Data.cc Data.h Dictionary.cc Dictionary.h List.cc List.h \ DownloadEngineFactory.cc DownloadEngineFactory.h RequestInfo.h \
MetaFileUtil.cc MetaFileUtil.h MetaEntryVisitor.h \ UrlRequestInfo.cc UrlRequestInfo.h MetaEntry.h Data.cc Data.h \
ShaVisitor.cc ShaVisitor.h TorrentMan.cc TorrentMan.h \ Dictionary.cc Dictionary.h List.cc List.h MetaFileUtil.cc \
PeerConnection.cc PeerConnection.h PeerMessageUtil.cc \ MetaFileUtil.h MetaEntryVisitor.h ShaVisitor.cc ShaVisitor.h \
PeerMessageUtil.h PeerAbstractCommand.cc PeerAbstractCommand.h \ TorrentMan.cc TorrentMan.h PeerConnection.cc PeerConnection.h \
PeerInitiateConnectionCommand.cc \ PeerMessageUtil.cc PeerMessageUtil.h PeerAbstractCommand.cc \
PeerAbstractCommand.h PeerInitiateConnectionCommand.cc \
PeerInitiateConnectionCommand.h PeerInteractionCommand.cc \ PeerInitiateConnectionCommand.h PeerInteractionCommand.cc \
PeerInteractionCommand.h Peer.cc Peer.h BitfieldMan.cc \ PeerInteractionCommand.h Peer.cc Peer.h BitfieldMan.cc \
BitfieldMan.h TorrentDownloadEngine.cc TorrentDownloadEngine.h \ BitfieldMan.h TorrentDownloadEngine.cc TorrentDownloadEngine.h \
@ -191,9 +194,11 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
SuggestPieceMessage.cc SuggestPieceMessage.h \ SuggestPieceMessage.cc SuggestPieceMessage.h \
SimplePeerMessage.cc SimplePeerMessage.h PeerMessageFactory.cc \ SimplePeerMessage.cc SimplePeerMessage.h PeerMessageFactory.cc \
PeerMessageFactory.h HaveEraseCommand.cc HaveEraseCommand.h \ PeerMessageFactory.h HaveEraseCommand.cc HaveEraseCommand.h \
Metalinker.cc Metalinker.h MetalinkEntry.cc MetalinkEntry.h \ TorrentRequestInfo.cc TorrentRequestInfo.h Metalinker.cc \
Metalinker.h MetalinkEntry.cc MetalinkEntry.h \
MetalinkResource.cc MetalinkResource.h MetalinkProcessor.h \ MetalinkResource.cc MetalinkResource.h MetalinkProcessor.h \
Xml2MetalinkProcessor.cc Xml2MetalinkProcessor.h Xml2MetalinkProcessor.cc Xml2MetalinkProcessor.h \
MetalinkRequestInfo.cc MetalinkRequestInfo.h
@ENABLE_BITTORRENT_TRUE@am__objects_1 = Data.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@am__objects_1 = Data.$(OBJEXT) \
@ENABLE_BITTORRENT_TRUE@ Dictionary.$(OBJEXT) List.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ Dictionary.$(OBJEXT) List.$(OBJEXT) \
@ENABLE_BITTORRENT_TRUE@ MetaFileUtil.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ MetaFileUtil.$(OBJEXT) \
@ -241,11 +246,13 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
@ENABLE_BITTORRENT_TRUE@ SuggestPieceMessage.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ SuggestPieceMessage.$(OBJEXT) \
@ENABLE_BITTORRENT_TRUE@ SimplePeerMessage.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ SimplePeerMessage.$(OBJEXT) \
@ENABLE_BITTORRENT_TRUE@ PeerMessageFactory.$(OBJEXT) \ @ENABLE_BITTORRENT_TRUE@ PeerMessageFactory.$(OBJEXT) \
@ENABLE_BITTORRENT_TRUE@ HaveEraseCommand.$(OBJEXT) @ENABLE_BITTORRENT_TRUE@ HaveEraseCommand.$(OBJEXT) \
@ENABLE_BITTORRENT_TRUE@ TorrentRequestInfo.$(OBJEXT)
@ENABLE_METALINK_TRUE@am__objects_2 = Metalinker.$(OBJEXT) \ @ENABLE_METALINK_TRUE@am__objects_2 = Metalinker.$(OBJEXT) \
@ENABLE_METALINK_TRUE@ MetalinkEntry.$(OBJEXT) \ @ENABLE_METALINK_TRUE@ MetalinkEntry.$(OBJEXT) \
@ENABLE_METALINK_TRUE@ MetalinkResource.$(OBJEXT) \ @ENABLE_METALINK_TRUE@ MetalinkResource.$(OBJEXT) \
@ENABLE_METALINK_TRUE@ Xml2MetalinkProcessor.$(OBJEXT) @ENABLE_METALINK_TRUE@ Xml2MetalinkProcessor.$(OBJEXT) \
@ENABLE_METALINK_TRUE@ MetalinkRequestInfo.$(OBJEXT)
am__objects_3 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \ am__objects_3 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
AbstractCommand.$(OBJEXT) \ AbstractCommand.$(OBJEXT) \
InitiateConnectionCommandFactory.$(OBJEXT) \ InitiateConnectionCommandFactory.$(OBJEXT) \
@ -269,7 +276,8 @@ am__objects_3 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
PreAllocationDiskWriter.$(OBJEXT) AbstractDiskWriter.$(OBJEXT) \ PreAllocationDiskWriter.$(OBJEXT) AbstractDiskWriter.$(OBJEXT) \
File.$(OBJEXT) Option.$(OBJEXT) Base64.$(OBJEXT) \ File.$(OBJEXT) Option.$(OBJEXT) Base64.$(OBJEXT) \
CookieBox.$(OBJEXT) LogFactory.$(OBJEXT) Time.$(OBJEXT) \ CookieBox.$(OBJEXT) LogFactory.$(OBJEXT) Time.$(OBJEXT) \
FeatureConfig.$(OBJEXT) $(am__objects_1) $(am__objects_2) FeatureConfig.$(OBJEXT) DownloadEngineFactory.$(OBJEXT) \
UrlRequestInfo.$(OBJEXT) $(am__objects_1) $(am__objects_2)
am_libaria2c_a_OBJECTS = $(am__objects_3) am_libaria2c_a_OBJECTS = $(am__objects_3)
libaria2c_a_OBJECTS = $(am_libaria2c_a_OBJECTS) libaria2c_a_OBJECTS = $(am_libaria2c_a_OBJECTS)
am__installdirs = "$(DESTDIR)$(bindir)" am__installdirs = "$(DESTDIR)$(bindir)"
@ -459,17 +467,19 @@ SRCS = Socket.h SocketCore.cc SocketCore.h Command.cc Command.h \
Base64.cc Base64.h CookieBox.cc CookieBox.h messageDigest.h \ Base64.cc Base64.h CookieBox.cc CookieBox.h messageDigest.h \
LogFactory.cc LogFactory.h NullLogger.h Time.cc Time.h \ LogFactory.cc LogFactory.h NullLogger.h Time.cc Time.h \
SharedHandle.h FeatureConfig.cc FeatureConfig.h \ SharedHandle.h FeatureConfig.cc FeatureConfig.h \
$(am__append_1) $(am__append_2) DownloadEngineFactory.cc DownloadEngineFactory.h RequestInfo.h \
UrlRequestInfo.cc UrlRequestInfo.h $(am__append_1) \
$(am__append_2)
noinst_LIBRARIES = libaria2c.a noinst_LIBRARIES = libaria2c.a
libaria2c_a_SOURCES = $(SRCS) libaria2c_a_SOURCES = $(SRCS)
aria2c_LDADD = libaria2c.a @LIBINTL@ @ALLOCA@ @LIBGNUTLS_LIBS@\ aria2c_LDADD = libaria2c.a @LIBINTL@ @ALLOCA@ @LIBGNUTLS_LIBS@\
@LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@ @LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@
aria2c_LDFLAGS = -pg #aria2c_LDFLAGS = -pg
AM_CPPFLAGS = -Wall\ AM_CPPFLAGS = -Wall\
-I../lib -I../intl -I$(top_srcdir)/intl\ -I../lib -I../intl -I$(top_srcdir)/intl\
@LIBGNUTLS_CFLAGS@ @LIBGCRYPT_CFLAGS@ @OPENSSL_CFLAGS@ @XML_CPPFLAGS@\ @LIBGNUTLS_CFLAGS@ @LIBGCRYPT_CFLAGS@ @OPENSSL_CFLAGS@ @XML_CPPFLAGS@\
-D_FILE_OFFSET_BITS=64 -DLOCALEDIR=\"$(localedir)\" @DEFS@ -pg -D_FILE_OFFSET_BITS=64 -DLOCALEDIR=\"$(localedir)\" @DEFS@# -pg
all: all-am all: all-am
@ -567,6 +577,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DiskAdaptor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DiskAdaptor.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DownloadCommand.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DownloadCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DownloadEngine.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DownloadEngine.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DownloadEngineFactory.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FeatureConfig.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FeatureConfig.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/File.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/File.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FtpConnection.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FtpConnection.Po@am__quote@
@ -595,6 +606,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LogFactory.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LogFactory.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetaFileUtil.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetaFileUtil.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkEntry.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkEntry.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkRequestInfo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkResource.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkResource.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Metalinker.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Metalinker.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiDiskAdaptor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiDiskAdaptor.Po@am__quote@
@ -635,9 +647,11 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TorrentConsoleDownloadEngine.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TorrentConsoleDownloadEngine.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TorrentDownloadEngine.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TorrentDownloadEngine.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TorrentMan.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TorrentMan.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TorrentRequestInfo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackerUpdateCommand.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackerUpdateCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackerWatcherCommand.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackerWatcherCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnchokeMessage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnchokeMessage.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UrlRequestInfo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Util.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xml2MetalinkProcessor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xml2MetalinkProcessor.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@

View File

@ -29,30 +29,6 @@ MetalinkEntry::~MetalinkEntry() {
for_each(resources.begin(), resources.end(), Deleter()); for_each(resources.begin(), resources.end(), Deleter());
} }
bool MetalinkEntry::check(const string& filename) const {
#ifdef ENABLE_MESSAGE_DIGEST
unsigned char buf[20];
int digestLength;
const string* digestPtr;
MessageDigestContext::HashAlgo algo;
if(!sha1.empty()) {
digestLength = 20;
algo = MessageDigestContext::ALGO_SHA1;
digestPtr = &sha1;
} else if(!md5.empty()) {
digestLength = 16;
algo = MessageDigestContext::ALGO_MD5;
digestPtr = &md5;
} else {
return true;
}
Util::fileChecksum(filename, buf, algo);
return *digestPtr == Util::toHex(buf, digestLength);
#else
return true;
#endif //ENABLE_MESSAGE_DIGEST
}
class PrefOrder { class PrefOrder {
public: public:
bool operator()(const MetalinkResource* res1, const MetalinkResource* res2) { bool operator()(const MetalinkResource* res1, const MetalinkResource* res2) {
@ -71,6 +47,10 @@ public:
switch(res->type) { switch(res->type) {
case MetalinkResource::TYPE_FTP: case MetalinkResource::TYPE_FTP:
case MetalinkResource::TYPE_HTTP: case MetalinkResource::TYPE_HTTP:
case MetalinkResource::TYPE_HTTPS:
#ifdef ENABLE_BITTORRENT
case MetalinkResource::TYPE_BITTORRENT:
#endif // ENABLE_BITTORRENT
return true; return true;
default: default:
return false; return false;
@ -81,5 +61,6 @@ public:
void MetalinkEntry::dropUnsupportedResource() { void MetalinkEntry::dropUnsupportedResource() {
MetalinkResources::iterator split = MetalinkResources::iterator split =
partition(resources.begin(), resources.end(), Supported()); partition(resources.begin(), resources.end(), Supported());
for_each(split, resources.end(), Deleter());
resources.erase(split, resources.end()); resources.erase(split, resources.end());
} }

View File

@ -24,6 +24,7 @@
#include "common.h" #include "common.h"
#include "MetalinkResource.h" #include "MetalinkResource.h"
#include "Checksum.h"
#include <deque> #include <deque>
typedef deque<MetalinkResource*> MetalinkResources; typedef deque<MetalinkResource*> MetalinkResources;
@ -35,8 +36,7 @@ public:
string language; string language;
string os; string os;
long long int size; long long int size;
string md5; Checksum checksum;
string sha1;
public: public:
MetalinkResources resources; MetalinkResources resources;
public: public:
@ -50,14 +50,11 @@ public:
this->language = metalinkEntry.language; this->language = metalinkEntry.language;
this->os = metalinkEntry.os; this->os = metalinkEntry.os;
this->size = metalinkEntry.size; this->size = metalinkEntry.size;
this->md5 = metalinkEntry.md5; this->checksum = metalinkEntry.checksum;
this->sha1 = metalinkEntry.sha1;
} }
return *this; return *this;
} }
bool check(const string& filename) const;
void dropUnsupportedResource(); void dropUnsupportedResource();
void reorderResourcesByPreference(); void reorderResourcesByPreference();

111
src/MetalinkRequestInfo.cc Normal file
View File

@ -0,0 +1,111 @@
/* <!-- copyright */
/*
* aria2 - a simple utility for downloading files faster
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* copyright --> */
#include "MetalinkRequestInfo.h"
#include "Xml2MetalinkProcessor.h"
#include "prefs.h"
#include "DlAbortEx.h"
#include "UrlRequestInfo.h"
class AccumulateNonP2PUrl {
private:
Strings* urlsPtr;
int split;
public:
AccumulateNonP2PUrl(Strings* urlsPtr,
int split)
:urlsPtr(urlsPtr),
split(split) {}
void operator()(const MetalinkResource* resource) {
switch(resource->type) {
case MetalinkResource::TYPE_HTTP:
case MetalinkResource::TYPE_HTTPS:
case MetalinkResource::TYPE_FTP:
for(int s = 1; s <= split; s++) {
urlsPtr->push_back(resource->url);
}
break;
}
}
};
class FindBitTorrentUrl {
public:
FindBitTorrentUrl() {}
bool operator()(const MetalinkResource* resource) {
if(resource->type == MetalinkResource::TYPE_BITTORRENT) {
return true;
} else {
return false;
}
}
};
RequestInfo* MetalinkRequestInfo::execute() {
RequestInfo* next = 0;
Xml2MetalinkProcessor proc;
Metalinker* metalinker = 0;
try {
metalinker = proc.parseFile(metalinkFile);
MetalinkEntry* entry =
metalinker->queryEntry(op->get(PREF_METALINK_VERSION),
op->get(PREF_METALINK_LANGUAGE),
op->get(PREF_METALINK_OS));
if(entry == 0) {
printf("No file matched with your preference.\n");
throw new DlAbortEx("No file matched with your preference.");
}
entry->dropUnsupportedResource();
MetalinkResources::iterator itr =
find_if(entry->resources.begin(),
entry->resources.end(),
FindBitTorrentUrl());
Strings urls;
int maxConnection = 0;
Checksum checksum;
if(itr == entry->resources.end()) {
entry->reorderResourcesByPreference();
for_each(entry->resources.begin(), entry->resources.end(),
AccumulateNonP2PUrl(&urls, op->getAsInt(PREF_SPLIT)));
maxConnection =
op->getAsInt(PREF_METALINK_SERVERS)*op->getAsInt(PREF_SPLIT);
// TODO
// set checksum
checksum = entry->checksum;
} else {
// BitTorrent downloading
urls.push_back((*itr)->url);
}
next = new UrlRequestInfo(urls, maxConnection, op);
next->setChecksum(checksum);
} catch(Exception* e) {
logger->error("Exception caught", e);
delete e;
fail = true;
}
delete metalinker;
return next;
}

41
src/MetalinkRequestInfo.h Normal file
View File

@ -0,0 +1,41 @@
/* <!-- copyright */
/*
* aria2 - a simple utility for downloading files faster
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* copyright --> */
#ifndef _D_METALINK_REQUEST_INFO_H_
#define _D_METALINK_REQUEST_INFO_H_
#include "RequestInfo.h"
class MetalinkRequestInfo : public RequestInfo {
private:
string metalinkFile;
public:
MetalinkRequestInfo(const string& metalinkFile, const Option* op):
RequestInfo(op),
metalinkFile(metalinkFile) {}
virtual ~MetalinkRequestInfo() {}
virtual RequestInfo* execute();
virtual DownloadEngine* getDownloadEngine() { return 0; }
};
#endif // _D_METALINK_REQUEST_INFO_H_

View File

@ -29,6 +29,7 @@ public:
enum TYPE { enum TYPE {
TYPE_FTP, TYPE_FTP,
TYPE_HTTP, TYPE_HTTP,
TYPE_HTTPS,
TYPE_BITTORRENT, TYPE_BITTORRENT,
TYPE_NOT_SUPPORTED TYPE_NOT_SUPPORTED
}; };

View File

@ -25,18 +25,15 @@
#include "message.h" #include "message.h"
#include <errno.h> #include <errno.h>
MultiDiskWriter::MultiDiskWriter(int pieceLength):pieceLength(pieceLength) { MultiDiskWriter::MultiDiskWriter(int pieceLength):
#ifdef ENABLE_MESSAGE_DIGEST pieceLength(pieceLength),
ctx.setAlgo(MessageDigestContext::ALGO_SHA1); ctx(DIGEST_ALGO_SHA1) {
digestInit(ctx); ctx.digestInit();
#endif // ENABLE_MESSAGE_DIGEST
} }
MultiDiskWriter::~MultiDiskWriter() { MultiDiskWriter::~MultiDiskWriter() {
clearEntries(); clearEntries();
#ifdef ENABLE_MESSAGE_DIGEST ctx.digestFree();
digestFree(ctx);
#endif // ENABLE_MESSAGE_DIGEST
} }
void MultiDiskWriter::clearEntries() { void MultiDiskWriter::clearEntries() {
@ -143,7 +140,6 @@ int MultiDiskWriter::readData(char* data, int len, long long int offset) {
return totalReadLength; return totalReadLength;
} }
#ifdef ENABLE_MESSAGE_DIGEST
void MultiDiskWriter::hashUpdate(DiskWriterEntry* entry, long long int offset, long long int length) { void MultiDiskWriter::hashUpdate(DiskWriterEntry* entry, long long int offset, long long int length) {
int BUFSIZE = 16*1024; int BUFSIZE = 16*1024;
char buf[BUFSIZE]; char buf[BUFSIZE];
@ -151,7 +147,7 @@ void MultiDiskWriter::hashUpdate(DiskWriterEntry* entry, long long int offset, l
if(BUFSIZE != entry->diskWriter->readData(buf, BUFSIZE, offset)) { if(BUFSIZE != entry->diskWriter->readData(buf, BUFSIZE, offset)) {
throw string("error"); throw string("error");
} }
digestUpdate(ctx, buf, BUFSIZE); ctx.digestUpdate(buf, BUFSIZE);
offset += BUFSIZE; offset += BUFSIZE;
} }
int r = length%BUFSIZE; int r = length%BUFSIZE;
@ -159,17 +155,15 @@ void MultiDiskWriter::hashUpdate(DiskWriterEntry* entry, long long int offset, l
if(r != entry->diskWriter->readData(buf, r, offset)) { if(r != entry->diskWriter->readData(buf, r, offset)) {
throw string("error"); throw string("error");
} }
digestUpdate(ctx, buf, r); ctx.digestUpdate(buf, r);
} }
} }
#endif // ENABLE_MESSAGE_DIGEST
string MultiDiskWriter::sha1Sum(long long int offset, long long int length) { string MultiDiskWriter::sha1Sum(long long int offset, long long int length) {
#ifdef ENABLE_MESSAGE_DIGEST
long long int fileOffset = offset; long long int fileOffset = offset;
bool reading = false; bool reading = false;
int rem = length; int rem = length;
digestReset(ctx); ctx.digestReset();
try { try {
for(DiskWriterEntries::iterator itr = diskWriterEntries.begin(); for(DiskWriterEntries::iterator itr = diskWriterEntries.begin();
itr != diskWriterEntries.end() && rem != 0; itr++) { itr != diskWriterEntries.end() && rem != 0; itr++) {
@ -187,13 +181,10 @@ string MultiDiskWriter::sha1Sum(long long int offset, long long int length) {
throw new DlAbortEx(EX_FILE_OFFSET_OUT_OF_RANGE, offset); throw new DlAbortEx(EX_FILE_OFFSET_OUT_OF_RANGE, offset);
} }
unsigned char hashValue[20]; unsigned char hashValue[20];
digestFinal(ctx, hashValue); ctx.digestFinal(hashValue);
return Util::toHex(hashValue, 20); return Util::toHex(hashValue, 20);
} catch(string ex) { } catch(string ex) {
throw new DlAbortEx(EX_FILE_SHA1SUM, "", strerror(errno)); throw new DlAbortEx(EX_FILE_SHA1SUM, "", strerror(errno));
} }
#else
return "";
#endif // ENABLE_MESSAGE_DIGEST
} }

View File

@ -48,10 +48,8 @@ private:
bool isInRange(const DiskWriterEntry* entry, long long int offset) const; bool isInRange(const DiskWriterEntry* entry, long long int offset) const;
int calculateLength(const DiskWriterEntry* entry, long long int fileOffset, int rem) const; int calculateLength(const DiskWriterEntry* entry, long long int fileOffset, int rem) const;
void clearEntries(); void clearEntries();
#ifdef ENABLE_MESSAGE_DIGEST
MessageDigestContext ctx; MessageDigestContext ctx;
void hashUpdate(DiskWriterEntry* entry, long long int offset, long long int length); void hashUpdate(DiskWriterEntry* entry, long long int offset, long long int length);
#endif // ENABLE_MESSAGE_DIGEST
public: public:
MultiDiskWriter(int pieceLength); MultiDiskWriter(int pieceLength);

View File

@ -22,7 +22,7 @@
#include "PeerChokeCommand.h" #include "PeerChokeCommand.h"
#include "Util.h" #include "Util.h"
PeerChokeCommand::PeerChokeCommand(int cuid, int interval, TorrentDownloadEngine* e):Command(cuid), interval(interval), e(e), rotate(0) {} PeerChokeCommand::PeerChokeCommand(int cuid, TorrentDownloadEngine* e, int interval):Command(cuid), interval(interval), e(e), rotate(0) {}
PeerChokeCommand::~PeerChokeCommand() {} PeerChokeCommand::~PeerChokeCommand() {}

View File

@ -38,7 +38,7 @@ private:
void optUnchokingPeer(Peers& peers) const; void optUnchokingPeer(Peers& peers) const;
public: public:
PeerChokeCommand(int cuid, int interval, TorrentDownloadEngine* e); PeerChokeCommand(int cuid, TorrentDownloadEngine* e, int interval);
virtual ~PeerChokeCommand(); virtual ~PeerChokeCommand();
bool execute(); bool execute();

116
src/RequestInfo.h Normal file
View File

@ -0,0 +1,116 @@
/* <!-- copyright */
/*
* aria2 - a simple utility for downloading files faster
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* copyright --> */
#ifndef _D_REQUEST_INFO_H_
#define _D_REQUEST_INFO_H_
#include "common.h"
#include "LogFactory.h"
#include "Option.h"
#include "DownloadEngine.h"
#include "Util.h"
#include "Checksum.h"
#include <signal.h>
class FileInfo {
public:
string filename;
long long int length;
Checksum checksum;
public:
FileInfo():length(0) {}
~FileInfo() {}
bool isEmpty() const {
return filename.size() == 0 && length == 0;
}
bool checkReady() const {
#ifdef ENABLE_MESSAGE_DIGEST
return !isEmpty() && !checksum.isEmpty();
#else
return false;
#endif // ENABLE_MESSAGE_DIGEST
}
bool check() const {
#ifdef ENABLE_MESSAGE_DIGEST
unsigned char md[MAX_MD_LENGTH];
Util::fileChecksum(filename, md, checksum.getDigestAlgo());
return Util::toHex(md,
MessageDigestContext::digestLength(checksum.getDigestAlgo()))
== checksum.getMessageDigest();
#else
return false;
#endif // ENABLE_MESSAGE_DIGEST
}
bool isTorrentFile() const {
return Util::endsWith(filename, ".torrent");
}
bool isMetalinkFile() const {
return Util::endsWith(filename, ".metalink");
}
};
class RequestInfo {
protected:
const Option* op;
const Logger* logger;
Checksum checksum;
FileInfo fileInfo;
bool fail;
void printDownloadCompeleteMessage(const string& filename) {
printf(_("\nThe download was complete. <%s>\n"), filename.c_str());
}
void printDownloadCompeleteMessage() {
printf("\nThe download was complete.\n");
}
void printDownloadAbortMessage() {
printf(_("\nThe download was not complete because of errors. Check the log.\n"));
}
public:
RequestInfo(const Option* op):
op(op),
fail(false)
{
logger = LogFactory::getInstance();
}
virtual ~RequestInfo() {}
virtual RequestInfo* execute() = 0;
virtual DownloadEngine* getDownloadEngine() = 0;
bool isFail() const { return fail; }
void setChecksum(const Checksum& checksum) {
this->checksum = checksum;
}
const Checksum& getChecksum() const { return checksum; }
const FileInfo& getFileInfo() const { return fileInfo; }
};
#endif // _D_REQUEST_INFO_H_

View File

@ -22,60 +22,49 @@
#include "ShaVisitor.h" #include "ShaVisitor.h"
#include "Util.h" #include "Util.h"
ShaVisitor::ShaVisitor() { ShaVisitor::ShaVisitor():
#ifdef ENABLE_MESSAGE_DIGEST ctx(DIGEST_ALGO_SHA1) {
ctx.setAlgo(MessageDigestContext::ALGO_SHA1); ctx.digestInit();
digestInit(ctx);
digestReset(ctx);
#endif // ENABLE_MESSAGE_DIGEST
} }
ShaVisitor::~ShaVisitor() { ShaVisitor::~ShaVisitor() {
#ifdef ENABLE_MESSAGE_DIGEST ctx.digestFree();
digestFree(ctx);
#endif // ENABLE_MESSAGE_DIGEST
} }
void ShaVisitor::visit(const Data* d) { void ShaVisitor::visit(const Data* d) {
#ifdef ENABLE_MESSAGE_DIGEST
if(d->isNumber()) { if(d->isNumber()) {
digestUpdate(ctx, "i", 1); ctx.digestUpdate("i", 1);
} else { } else {
string lenStr = Util::llitos(d->getLen()); string lenStr = Util::llitos(d->getLen());
digestUpdate(ctx, lenStr.c_str(), lenStr.size()); ctx.digestUpdate(lenStr.c_str(), lenStr.size());
digestUpdate(ctx, ":", 1); ctx.digestUpdate(":", 1);
} }
digestUpdate(ctx, d->getData(), d->getLen()); ctx.digestUpdate(d->getData(), d->getLen());
if(d->isNumber()) { if(d->isNumber()) {
digestUpdate(ctx, "e", 1); ctx.digestUpdate("e", 1);
} }
#endif // ENABLE_MESSAGE_DIGEST
} }
void ShaVisitor::visit(const Dictionary* d) { void ShaVisitor::visit(const Dictionary* d) {
#ifdef ENABLE_MESSAGE_DIGEST ctx.digestUpdate("d", 1);
digestUpdate(ctx, "d", 1);
const Order& v = d->getOrder(); const Order& v = d->getOrder();
for(Order::const_iterator itr = v.begin(); itr != v.end(); itr++) { for(Order::const_iterator itr = v.begin(); itr != v.end(); itr++) {
string lenStr = Util::llitos(itr->size()); string lenStr = Util::llitos(itr->size());
digestUpdate(ctx, lenStr.c_str(), lenStr.size()); ctx.digestUpdate(lenStr.c_str(), lenStr.size());
digestUpdate(ctx, ":", 1); ctx.digestUpdate(":", 1);
digestUpdate(ctx, itr->c_str(), itr->size()); ctx.digestUpdate(itr->c_str(), itr->size());
const MetaEntry* e = d->get(*itr); const MetaEntry* e = d->get(*itr);
this->visit(e); this->visit(e);
} }
digestUpdate(ctx, "e", 1); ctx.digestUpdate("e", 1);
#endif // ENABLE_MESSAGE_DIGEST
} }
void ShaVisitor::visit(const List* l) { void ShaVisitor::visit(const List* l) {
#ifdef ENABLE_MESSAGE_DIGEST ctx.digestUpdate("l", 1);
digestUpdate(ctx, "l", 1);
for(MetaList::const_iterator itr = l->getList().begin(); itr != l->getList().end(); itr++) { for(MetaList::const_iterator itr = l->getList().begin(); itr != l->getList().end(); itr++) {
this->visit(*itr); this->visit(*itr);
} }
digestUpdate(ctx, "e", 1); ctx.digestUpdate("e", 1);
#endif // ENABLE_MESSAGE_DIGEST
} }
void ShaVisitor::visit(const MetaEntry* e) { void ShaVisitor::visit(const MetaEntry* e) {
@ -89,8 +78,6 @@ void ShaVisitor::visit(const MetaEntry* e) {
} }
void ShaVisitor::getHash(unsigned char* hashValue, int& len) { void ShaVisitor::getHash(unsigned char* hashValue, int& len) {
#ifdef ENABLE_MESSAGE_DIGEST len = ctx.digestLength();
digestFinal(ctx, hashValue); ctx.digestFinal(hashValue);
len = 20;
#endif // ENABLE_MESSAGE_DIGEST
} }

View File

@ -27,15 +27,11 @@
#include "Dictionary.h" #include "Dictionary.h"
#include "List.h" #include "List.h"
#include "common.h" #include "common.h"
#ifdef ENABLE_MESSAGE_DIGEST
#include "messageDigest.h" #include "messageDigest.h"
#endif // ENABLE_MESSAGE_DIGEST
class ShaVisitor : public MetaEntryVisitor { class ShaVisitor : public MetaEntryVisitor {
private: private:
#ifdef ENABLE_MESSAGE_DIGEST
MessageDigestContext ctx; MessageDigestContext ctx;
#endif // ENABLE_MESSAGE_DIGEST
public: public:
ShaVisitor(); ShaVisitor();
~ShaVisitor(); ~ShaVisitor();

View File

@ -43,7 +43,7 @@
extern PeerHandle nullPeer; extern PeerHandle nullPeer;
TorrentMan::TorrentMan():bitfield(NULL), TorrentMan::TorrentMan():bitfield(0),
peerEntryIdCounter(0), peerEntryIdCounter(0),
cuidCounter(0), cuidCounter(0),
downloadLength(0), downloadLength(0),
@ -61,18 +61,16 @@ TorrentMan::TorrentMan():bitfield(NULL),
incomplete(0), incomplete(0),
connections(0), connections(0),
trackers(0), trackers(0),
diskAdaptor(NULL) req(0),
diskAdaptor(0)
{ {
logger = LogFactory::getInstance(); logger = LogFactory::getInstance();
} }
TorrentMan::~TorrentMan() { TorrentMan::~TorrentMan() {
if(bitfield != NULL) { delete bitfield;
delete bitfield; delete diskAdaptor;
} delete req;
if(diskAdaptor != NULL) {
delete diskAdaptor;
}
} }
// TODO do not use this method in application code // TODO do not use this method in application code

81
src/TorrentRequestInfo.cc Normal file
View File

@ -0,0 +1,81 @@
/* <!-- copyright */
/*
* aria2 - a simple utility for downloading files faster
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* copyright --> */
#include "TorrentRequestInfo.h"
#include "DownloadEngineFactory.h"
#include "prefs.h"
#include "Util.h"
extern RequestInfo* requestInfo;
extern void setSignalHander(int signal, void (*handler)(int), int flags);
void torrentHandler(int signal) {
((TorrentDownloadEngine*)requestInfo->getDownloadEngine())->
torrentMan->setHalt(true);
}
RequestInfo* TorrentRequestInfo::execute() {
if(op->get(PREF_SHOW_FILES) == V_TRUE) {
showFileEntry();
return 0;
}
e = DownloadEngineFactory::newTorrentConsoleEngine(op,
torrentFile,
targetFiles);
setSignalHander(SIGINT, torrentHandler, SA_RESETHAND);
setSignalHander(SIGTERM, torrentHandler, SA_RESETHAND);
try {
e->run();
if(e->torrentMan->downloadComplete()) {
printDownloadCompeleteMessage();
}
} catch(Exception* e) {
logger->error("Exception caught", e);
delete e;
fail = true;
}
setSignalHander(SIGINT, SIG_DFL, 0);
setSignalHander(SIGTERM, SIG_DFL, 0);
delete e;
return 0;
}
// TODO should be const TorrentMan* torrentMan
void TorrentRequestInfo::showFileEntry()
{
TorrentMan torrentMan;
torrentMan.option = op;
FileEntries fileEntries =
torrentMan.readFileEntryFromMetaInfoFile(torrentFile);
cout << _("Files:") << endl;
cout << "idx|path/length" << endl;
cout << "===+===========================================================================" << endl;
int count = 1;
for(FileEntries::const_iterator itr = fileEntries.begin();
itr != fileEntries.end(); count++, itr++) {
printf("%3d|%s\n |%s Bytes\n", count, itr->path.c_str(),
Util::llitos(itr->length, true).c_str());
cout << "---+---------------------------------------------------------------------------" << endl;
}
}

51
src/TorrentRequestInfo.h Normal file
View File

@ -0,0 +1,51 @@
/* <!-- copyright */
/*
* aria2 - a simple utility for downloading files faster
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* copyright --> */
#ifndef _D_TORRENT_REQUEST_INFO_H_
#define _D_TORRENT_REQUEST_INFO_H_
#include "RequestInfo.h"
#include "TorrentDownloadEngine.h"
class TorrentRequestInfo : public RequestInfo {
private:
string torrentFile;
TorrentDownloadEngine* e;
Strings targetFiles;
void showFileEntry();
public:
TorrentRequestInfo(const string& torrentFile, const Option* op):
RequestInfo(op),
torrentFile(torrentFile),
e(0) {}
virtual ~TorrentRequestInfo() {}
virtual RequestInfo* execute();
void setTargetFiles(const Strings& targetFiles) {
this->targetFiles = targetFiles;
}
virtual DownloadEngine* getDownloadEngine() { return e; }
};
#endif // _D_TORRENT_REQUEST_INFO_H_

146
src/UrlRequestInfo.cc Normal file
View File

@ -0,0 +1,146 @@
/* <!-- copyright */
/*
* aria2 - a simple utility for downloading files faster
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* copyright --> */
#include "UrlRequestInfo.h"
#include "TorrentRequestInfo.h"
#include "MetalinkRequestInfo.h"
#include "prefs.h"
#include "DownloadEngineFactory.h"
extern RequestInfo* requestInfo;
extern void setSignalHander(int signal, void (*handler)(int), int flags);
void UrlRequestInfo::adjustRequestSize(Requests& requests,
Requests& reserved,
int maxConnections) const
{
if(maxConnections > 0 && (int)requests.size() > maxConnections) {
copy(requests.begin()+maxConnections, requests.end(),
back_inserter(reserved));
//insert_iterator<Requests>(reserved, reserved.end()));
requests.erase(requests.begin()+maxConnections, requests.end());
}
}
RequestInfo* UrlRequestInfo::createNextRequestInfo() const
{
#ifdef ENABLE_BITTORRENT
if(op->getAsBool(PREF_FOLLOW_TORRENT) &&
Util::endsWith(fileInfo.filename, ".torrent")) {
return new TorrentRequestInfo(fileInfo.filename, op);
} else
#endif // ENABLE_BITTORRENT
#ifdef ENABLE_METALINK
if(op->getAsBool(PREF_FOLLOW_METALINK) &&
Util::endsWith(fileInfo.filename, ".metalink")) {
return new MetalinkRequestInfo(fileInfo.filename, op);
} else
#endif // ENABLE_METALINK
{
return 0;
}
}
void handler(int signal) {
printf(_("\nstopping application...\n"));
fflush(stdout);
requestInfo->getDownloadEngine()->segmentMan->save();
requestInfo->getDownloadEngine()->segmentMan->diskWriter->closeFile();
delete requestInfo->getDownloadEngine();
printf(_("done\n"));
exit(EXIT_SUCCESS);
}
class CreateRequest {
private:
Requests* requestsPtr;
string referer;
int split;
public:
CreateRequest(Requests* requestsPtr,
const string& referer,
int split)
:requestsPtr(requestsPtr),
referer(referer),
split(split) {}
void operator()(const string& url) {
for(int s = 1; s <= split; s++) {
Request* req = new Request();
req->setReferer(referer);
if(req->setUrl(url)) {
requestsPtr->push_back(req);
} else {
fprintf(stderr, _("Unrecognized URL or unsupported protocol: %s\n"),
req->getUrl().c_str());
delete req;
}
}
}
};
RequestInfo* UrlRequestInfo::execute() {
Requests requests;
Requests reserved;
for_each(urls.begin(), urls.end(),
CreateRequest(&requests,
op->get(PREF_REFERER),
op->getAsInt(PREF_SPLIT)));
adjustRequestSize(requests, reserved, maxConnections);
e = DownloadEngineFactory::newConsoleEngine(op, requests, reserved);
setSignalHander(SIGINT, handler, 0);
setSignalHander(SIGTERM, handler, 0);
RequestInfo* next = 0;
try {
e->run();
if(e->segmentMan->finished()) {
printDownloadCompeleteMessage(e->segmentMan->getFilePath());
fileInfo.filename = e->segmentMan->getFilePath();
fileInfo.length = e->segmentMan->totalSize;
fileInfo.checksum = checksum;
next = createNextRequestInfo();
} else {
e->segmentMan->save();
e->segmentMan->diskWriter->closeFile();
printDownloadAbortMessage();
}
} catch(Exception *e) {
logger->error("Exception caught", e);
delete e;
fail = true;
}
for_each(requests.begin(), requests.end(), Deleter());
for_each(reserved.begin(), reserved.end(), Deleter());
setSignalHander(SIGINT, SIG_DFL, 0);
setSignalHander(SIGTERM, SIG_DFL, 0);
delete e;
e = 0;
return next;
}

52
src/UrlRequestInfo.h Normal file
View File

@ -0,0 +1,52 @@
/* <!-- copyright */
/*
* aria2 - a simple utility for downloading files faster
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* copyright --> */
#ifndef _D_URL_REQUEST_INFO_H_
#define _D_URL_REQUEST_INFO_H_
#include "RequestInfo.h"
class UrlRequestInfo : public RequestInfo {
private:
Strings urls;
int maxConnections;
DownloadEngine* e;
RequestInfo* createNextRequestInfo() const;
void adjustRequestSize(Requests& requests,
Requests& reserved,
int maxConnections) const;
public:
UrlRequestInfo(const Strings& urls, int maxConnections, const Option* op):
RequestInfo(op),
urls(urls),
maxConnections(maxConnections),
e(0) {}
virtual ~UrlRequestInfo() {}
virtual RequestInfo* execute();
virtual DownloadEngine* getDownloadEngine() {
return e;
}
};
#endif // _D_URL_REQUEST_INFO_H_

View File

@ -363,21 +363,20 @@ string Util::getContentDispositionFilename(const string& header) {
#ifdef ENABLE_MESSAGE_DIGEST #ifdef ENABLE_MESSAGE_DIGEST
void Util::sha1Sum(unsigned char* digest, const void* data, int dataLength) { void Util::sha1Sum(unsigned char* digest, const void* data, int dataLength) {
MessageDigestContext ctx(MessageDigestContext::ALGO_SHA1); MessageDigestContext ctx(DIGEST_ALGO_SHA1);
digestInit(ctx); ctx.digestInit();
digestReset(ctx); ctx.digestUpdate(data, dataLength);
digestUpdate(ctx, data, dataLength); ctx.digestFinal(digest);
digestFinal(ctx, digest); ctx.digestFree();
digestFree(ctx);
} }
#endif // ENABLE_MESSAGE_DIGEST #endif // ENABLE_MESSAGE_DIGEST
#ifdef ENABLE_MESSAGE_DIGEST #ifdef ENABLE_MESSAGE_DIGEST
void Util::fileChecksum(const string& filename, unsigned char* digest, void Util::fileChecksum(const string& filename, unsigned char* digest,
MessageDigestContext::HashAlgo algo) { MessageDigestContext::DigestAlgo algo) {
MessageDigestContext ctx(algo); MessageDigestContext ctx(algo);
digestInit(ctx); ctx.digestInit();
digestReset(ctx); ctx.digestReset();
int BUFLEN = 4096; int BUFLEN = 4096;
char buf[BUFLEN]; char buf[BUFLEN];
@ -396,14 +395,14 @@ void Util::fileChecksum(const string& filename, unsigned char* digest,
throw new DlAbortEx(EX_FILE_READ, filename.c_str(), strerror(errno)); throw new DlAbortEx(EX_FILE_READ, filename.c_str(), strerror(errno));
} }
} else if(size > 0) { } else if(size > 0) {
digestUpdate(ctx, buf, size); ctx.digestUpdate(buf, size);
} }
if(size < BUFLEN) { if(size < BUFLEN) {
break; break;
} }
} }
digestFinal(ctx, digest); ctx.digestFinal(digest);
digestFree(ctx); ctx.digestFree();
} }
#endif // ENABLE_MESSAGE_DIGEST #endif // ENABLE_MESSAGE_DIGEST

View File

@ -92,7 +92,7 @@ public:
// For sha1, you need 20 bytes. For md5, 16 bytes. // For sha1, you need 20 bytes. For md5, 16 bytes.
#ifdef ENABLE_MESSAGE_DIGEST #ifdef ENABLE_MESSAGE_DIGEST
static void fileChecksum(const string& filename, unsigned char* digest, static void fileChecksum(const string& filename, unsigned char* digest,
MessageDigestContext::HashAlgo algo); MessageDigestContext::DigestAlgo algo);
#endif // ENABLE_MESSAGE_DIGEST #endif // ENABLE_MESSAGE_DIGEST
#ifdef ENABLE_BITTORRENT #ifdef ENABLE_BITTORRENT

View File

@ -88,8 +88,20 @@ MetalinkEntry* Xml2MetalinkProcessor::getEntry(const string& xpath) {
entry->version = Util::trim(xpathContent(xpath+"/m:version")); entry->version = Util::trim(xpathContent(xpath+"/m:version"));
entry->language = Util::trim(xpathContent(xpath+"/m:language")); entry->language = Util::trim(xpathContent(xpath+"/m:language"));
entry->os = Util::trim(xpathContent(xpath+"/m:os")); entry->os = Util::trim(xpathContent(xpath+"/m:os"));
entry->md5 = Util::toLower(Util::trim(xpathContent(xpath+"/m:verification/m:hash[@type=\"md5\"]"))); #ifdef ENABLE_MESSAGE_DIGEST
entry->sha1 = Util::toLower(Util::trim(xpathContent(xpath+"/m:verification/m:hash[@type=\"sha1\"]"))); string md;
md = Util::toLower(Util::trim(xpathContent(xpath+"/m:verification/m:hash[@type=\"sha1\"]")));
if(md.size() > 0) {
entry->checksum.setMessageDigest(md);
entry->checksum.setDigestAlgo(DIGEST_ALGO_SHA1);
} else {
md = Util::toLower(Util::trim(xpathContent(xpath+"/m:verification/m:hash[@type=\"md5\"]")));
if(md.size() > 0) {
entry->checksum.setMessageDigest(md);
entry->checksum.setDigestAlgo(DIGEST_ALGO_MD5);
}
}
#endif // ENABLE_MESSAGE_DIGEST
for(int index = 1; 1; index++) { for(int index = 1; 1; index++) {
MetalinkResource* resource = MetalinkResource* resource =
getResource(xpath+"/m:resources/m:url["+Util::itos(index)+"]"); getResource(xpath+"/m:resources/m:url["+Util::itos(index)+"]");
@ -121,6 +133,8 @@ MetalinkResource* Xml2MetalinkProcessor::getResource(const string& xpath) {
resource->type = MetalinkResource::TYPE_FTP; resource->type = MetalinkResource::TYPE_FTP;
} else if(type == "http") { } else if(type == "http") {
resource->type = MetalinkResource::TYPE_HTTP; resource->type = MetalinkResource::TYPE_HTTP;
} else if(type == "https") {
resource->type = MetalinkResource::TYPE_HTTPS;
} else if(type == "bittorrent") { } else if(type == "bittorrent") {
resource->type = MetalinkResource::TYPE_BITTORRENT; resource->type = MetalinkResource::TYPE_BITTORRENT;
} else { } else {

View File

@ -30,23 +30,11 @@
#include "InitiateConnectionCommandFactory.h" #include "InitiateConnectionCommandFactory.h"
#include "prefs.h" #include "prefs.h"
#include "FeatureConfig.h" #include "FeatureConfig.h"
#include "DownloadEngineFactory.h"
#ifdef ENABLE_BITTORRENT #include "UrlRequestInfo.h"
# include "TorrentConsoleDownloadEngine.h" #include "TorrentRequestInfo.h"
# include "TorrentMan.h" #include "MetalinkRequestInfo.h"
# include "PeerListenCommand.h" #include "Xml2MetalinkProcessor.h"
# include "TorrentAutoSaveCommand.h"
# include "TrackerWatcherCommand.h"
# include "TrackerUpdateCommand.h"
# include "HaveEraseCommand.h"
# include "ByteArrayDiskWriter.h"
# include "PeerChokeCommand.h"
#endif // ENABLE_BITTORRENT
#ifdef ENABLE_METALINK
# include "Xml2MetalinkProcessor.h"
#endif // ENABLE_METALINK
#include <deque> #include <deque>
#include <algorithm> #include <algorithm>
#include <time.h> #include <time.h>
@ -69,22 +57,7 @@ extern int optind, opterr, optopt;
using namespace std; using namespace std;
bool readyToTorrentMode = false; RequestInfo* requestInfo;
string downloadedTorrentFile;
bool readyToMetalinkMode = false;
string downloadedMetalinkFile;
void printDownloadCompeleteMessage(string filename) {
printf(_("\nThe download was complete. <%s>\n"), filename.c_str());
}
void printDownloadCompeleteMessage() {
printf("\nThe download was complete.\n");
}
void printDownloadAbortMessage() {
printf(_("\nThe download was not complete because of errors. Check the log.\n"));
}
void setSignalHander(int signal, void (*handler)(int), int flags) { void setSignalHander(int signal, void (*handler)(int), int flags) {
struct sigaction sigact; struct sigaction sigact;
@ -94,39 +67,6 @@ void setSignalHander(int signal, void (*handler)(int), int flags) {
sigaction(signal, &sigact, NULL); sigaction(signal, &sigact, NULL);
} }
DownloadEngine* e;
#ifdef ENABLE_BITTORRENT
TorrentDownloadEngine* te;
#endif // ENABLE_BITTORRENT
void handler(int signal) {
printf(_("\nstopping application...\n"));
fflush(stdout);
e->segmentMan->save();
e->segmentMan->diskWriter->closeFile();
e->cleanQueue();
delete e;
printf(_("done\n"));
exit(EXIT_SUCCESS);
}
#ifdef ENABLE_BITTORRENT
void torrentHandler(int signal) {
te->torrentMan->setHalt(true);
}
#endif // ENABLE_BITTORRENT
void createRequest(int cuid, const string& url, string referer, Requests& requests) {
Request* req = new Request();
req->setReferer(referer);
if(req->setUrl(url)) {
requests.push_back(req);
} else {
fprintf(stderr, _("Unrecognized URL or unsupported protocol: %s\n"), req->getUrl().c_str());
delete(req);
}
}
void showVersion() { void showVersion() {
cout << PACKAGE << _(" version ") << PACKAGE_VERSION << endl; cout << PACKAGE << _(" version ") << PACKAGE_VERSION << endl;
cout << "Copyright (C) 2006 Tatsuhiro Tsujikawa" << endl; cout << "Copyright (C) 2006 Tatsuhiro Tsujikawa" << endl;
@ -182,7 +122,7 @@ void showUsage() {
cout << _(" --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n" cout << _(" --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n"
" K or M(1K = 1024, 1M = 1024K). This\n" " K or M(1K = 1024, 1M = 1024K). This\n"
" value must be greater than or equal to\n" " value must be greater than or equal to\n"
" 1024.") << endl; " 1024. Default: 1M") << endl;
cout << _(" --http-proxy=HOST:PORT Use HTTP proxy server. This affects to all\n" cout << _(" --http-proxy=HOST:PORT Use HTTP proxy server. This affects to all\n"
" URLs.") << endl; " URLs.") << endl;
cout << _(" --http-user=USER Set HTTP user. This affects to all URLs.") << endl; cout << _(" --http-user=USER Set HTTP user. This affects to all URLs.") << endl;
@ -207,6 +147,12 @@ void showUsage() {
cout << _(" --ftp-via-http-proxy=METHOD Use HTTP proxy in FTP. METHOD is either 'get' or\n" cout << _(" --ftp-via-http-proxy=METHOD Use HTTP proxy in FTP. METHOD is either 'get' or\n"
" 'tunnel'.\n" " 'tunnel'.\n"
" Default: tunnel") << endl; " Default: tunnel") << endl;
cout << _(" --lowest-speed-limit Close connection if download speed is lower than\n"
" or equal to this value. 0 means aria2 does not\n"
" care lowest speed limit. You can use K or M in\n"
" the same manner as in --min-segment-size option.\n"
" This option does not affect BitTorrent download.\n"
" Default: 0") << endl;
#ifdef ENABLE_BITTORRENT #ifdef ENABLE_BITTORRENT
cout << _(" -T, --torrent-file=TORRENT_FILE The file path to .torrent file.") << endl; cout << _(" -T, --torrent-file=TORRENT_FILE The file path to .torrent file.") << endl;
cout << _(" --follow-torrent=true|false Setting this option to false prevents aria2 to\n" cout << _(" --follow-torrent=true|false Setting this option to false prevents aria2 to\n"
@ -288,52 +234,19 @@ void showUsage() {
cout << endl; cout << endl;
} }
bool normalDownload(const Requests& requests, long long int getRealSize(char* optarg) {
const Requests& reserved, string::size_type p = string(optarg).find_first_of("KM");
Option* op, int mult = 1;
string& downloadedFilename) { if(p != string::npos) {
setSignalHander(SIGINT, handler, 0); if(optarg[p] == 'K') {
setSignalHander(SIGTERM, handler, 0); mult = 1024;
} else if(optarg[p] == 'M') {
e = new ConsoleDownloadEngine(); mult = 1024*1024;
e->option = op;
e->segmentMan = new SegmentMan();
e->segmentMan->diskWriter = new DefaultDiskWriter();
e->segmentMan->dir = op->get(PREF_DIR);
e->segmentMan->ufilename = op->get(PREF_OUT);
e->segmentMan->option = op;
e->segmentMan->splitter = new SplitSlowestSegmentSplitter();
e->segmentMan->splitter->setMinSegmentSize(op->getAsLLInt(PREF_MIN_SEGMENT_SIZE));
e->segmentMan->reserved = reserved;
int cuidCounter = 1;
for(Requests::const_iterator itr = requests.begin();
itr != requests.end();
itr++, cuidCounter++) {
e->commands.push_back(InitiateConnectionCommandFactory::createInitiateConnectionCommand(cuidCounter, *itr, e));
}
e->run();
bool success = false;
if(e->segmentMan->finished()) {
printDownloadCompeleteMessage(e->segmentMan->getFilePath());
if(Util::endsWith(e->segmentMan->getFilePath(), ".torrent")) {
downloadedTorrentFile = e->segmentMan->getFilePath();
readyToTorrentMode = true;
} else if(Util::endsWith(e->segmentMan->getFilePath(), ".metalink")) {
downloadedMetalinkFile = e->segmentMan->getFilePath();
readyToMetalinkMode = true;
} }
downloadedFilename = e->segmentMan->getFilePath(); optarg[p] = '\0';
success = true;
} else {
e->segmentMan->save();
e->segmentMan->diskWriter->closeFile();
printDownloadAbortMessage();
} }
e->cleanQueue(); long long int size = strtoll(optarg, NULL, 10)*mult;
delete e; return size;
return success;
} }
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
@ -343,18 +256,6 @@ int main(int argc, char* argv[]) {
bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);
#endif // ENABLE_NLS #endif // ENABLE_NLS
Integers selectFileIndexes;
#ifdef ENABLE_BITTORRENT
bool followTorrent = true;
#else
bool followTorrent = false;
#endif // ENABLE_BITTORRENT
#ifdef ENABLE_METALINK
bool followMetalink = true;
#else
bool followMetalink = false;
#endif // ENABLE_METALINK
int c; int c;
Option* op = new Option(); Option* op = new Option();
op->put(PREF_STDOUT_LOG, V_FALSE); op->put(PREF_STDOUT_LOG, V_FALSE);
@ -363,6 +264,20 @@ int main(int argc, char* argv[]) {
op->put(PREF_DAEMON, V_FALSE); op->put(PREF_DAEMON, V_FALSE);
op->put(PREF_LISTEN_PORT, "-1"); op->put(PREF_LISTEN_PORT, "-1");
op->put(PREF_METALINK_SERVERS, "15"); op->put(PREF_METALINK_SERVERS, "15");
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
);
op->put(PREF_RETRY_WAIT, "5"); op->put(PREF_RETRY_WAIT, "5");
op->put(PREF_TIMEOUT, "60"); op->put(PREF_TIMEOUT, "60");
op->put(PREF_PEER_CONNECTION_TIMEOUT, "60"); op->put(PREF_PEER_CONNECTION_TIMEOUT, "60");
@ -377,6 +292,7 @@ int main(int argc, char* argv[]) {
op->put(PREF_AUTO_SAVE_INTERVAL, "60"); op->put(PREF_AUTO_SAVE_INTERVAL, "60");
op->put(PREF_DIRECT_FILE_MAPPING, V_TRUE); op->put(PREF_DIRECT_FILE_MAPPING, V_TRUE);
op->put(PREF_UPLOAD_LIMIT, "0"); op->put(PREF_UPLOAD_LIMIT, "0");
op->put(PREF_LOWEST_SPEED_LIMIT, "4000");
while(1) { while(1) {
int optIndex = 0; int optIndex = 0;
int lopt; int lopt;
@ -403,6 +319,7 @@ int main(int argc, char* argv[]) {
{ "ftp-via-http-proxy", required_argument, &lopt, 12 }, { "ftp-via-http-proxy", required_argument, &lopt, 12 },
{ "min-segment-size", required_argument, &lopt, 13 }, { "min-segment-size", required_argument, &lopt, 13 },
{ "http-proxy-method", required_argument, &lopt, 14 }, { "http-proxy-method", required_argument, &lopt, 14 },
{ "lowest-speed-limit", required_argument, &lopt, 200 },
#ifdef ENABLE_BITTORRENT #ifdef ENABLE_BITTORRENT
{ "torrent-file", required_argument, NULL, 'T' }, { "torrent-file", required_argument, NULL, 'T' },
{ "listen-port", required_argument, &lopt, 15 }, { "listen-port", required_argument, &lopt, 15 },
@ -506,17 +423,7 @@ int main(int argc, char* argv[]) {
} }
break; break;
case 13: { case 13: {
string::size_type p = string(optarg).find_first_of("KM"); long long int size = getRealSize(optarg);
int mult = 1;
if(p != string::npos) {
if(optarg[p] == 'K') {
mult = 1024;
} else if(optarg[p] == 'M') {
mult = 1024*1024;
}
optarg[p] = '\0';
}
long long int size = strtoll(optarg, NULL, 10)*mult;
if(size < 1024) { if(size < 1024) {
cerr << _("min-segment-size invalid") << endl; cerr << _("min-segment-size invalid") << endl;
showUsage(); showUsage();
@ -546,9 +453,9 @@ int main(int argc, char* argv[]) {
} }
case 16: case 16:
if(string(optarg) == "true") { if(string(optarg) == "true") {
followTorrent = true; op->put(PREF_FOLLOW_TORRENT, V_TRUE);
} else if(string(optarg) == "false") { } else if(string(optarg) == "false") {
followTorrent = false; op->put(PREF_FOLLOW_TORRENT, V_FALSE);
} else { } else {
cerr << _("follow-torrent must be either 'true' or 'false'.") << endl; cerr << _("follow-torrent must be either 'true' or 'false'.") << endl;
showUsage(); showUsage();
@ -580,7 +487,7 @@ int main(int argc, char* argv[]) {
break; break;
} }
case 21: case 21:
Util::unfoldRange(optarg, selectFileIndexes); op->put(PREF_SELECT_FILE, optarg);
break; break;
case 100: case 100:
op->put(PREF_METALINK_VERSION, optarg); op->put(PREF_METALINK_VERSION, optarg);
@ -593,15 +500,25 @@ int main(int argc, char* argv[]) {
break; break;
case 103: case 103:
if(string(optarg) == "true") { if(string(optarg) == "true") {
followMetalink = true; op->put(PREF_FOLLOW_METALINK, V_TRUE);
} else if(string(optarg) == "false") { } else if(string(optarg) == "false") {
followMetalink = false; op->put(PREF_FOLLOW_METALINK, V_FALSE);
} else { } else {
cerr << _("follow-metalink must be either 'true' or 'false'.") << endl; cerr << _("follow-metalink must be either 'true' or 'false'.") << endl;
showUsage(); showUsage();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
break; break;
case 200: {
int limit = getRealSize(optarg);
if(limit < 0) {
cerr << _("lowest-speed-limit must be greater than or equal to 0") << endl;
showUsage();
exit(EXIT_FAILURE);
}
op->put(PREF_LOWEST_SPEED_LIMIT, Util::itos(limit));
break;
}
} }
break; break;
} }
@ -720,190 +637,58 @@ int main(int argc, char* argv[]) {
} }
// make sure logger is configured properly. // make sure logger is configured properly.
try { try {
LogFactory::getInstance(); Logger* logger = LogFactory::getInstance();
logger->info("%s %s", PACKAGE, PACKAGE_VERSION);
logger->info("Logging started.");
setSignalHander(SIGPIPE, SIG_IGN, 0);
requestInfo = 0;
#ifdef ENABLE_BITTORRENT
if(op->defined(PREF_TORRENT_FILE)) {
requestInfo = new TorrentRequestInfo(op->get(PREF_TORRENT_FILE),
op);
Strings targetFiles;
if(op->defined(PREF_TORRENT_FILE) && !args.empty()) {
targetFiles = args;
}
((TorrentRequestInfo*)requestInfo)->setTargetFiles(targetFiles);
}
else
#endif // ENABLE_BITTORRENT
#ifdef ENABLE_METALINK
if(op->defined(PREF_METALINK_FILE)) {
requestInfo = new MetalinkRequestInfo(op->get(PREF_METALINK_FILE),
op);
} else
#endif // ENABLE_METALINK
{
requestInfo = new UrlRequestInfo(args, 0, op);
}
while(requestInfo) {
RequestInfo* next = requestInfo->execute();
if(requestInfo->isFail()) {
delete requestInfo;
exit(EXIT_FAILURE);
}
if(requestInfo->getFileInfo().checkReady()) {
if(requestInfo->getFileInfo().check()) {
printf("checksum OK.\n");
} else {
// TODO
printf("checksum ERROR.\n");
exit(EXIT_FAILURE);
}
}
delete requestInfo;
requestInfo = next;
}
} catch(Exception* ex) { } catch(Exception* ex) {
cerr << ex->getMsg() << endl; cerr << ex->getMsg() << endl;
delete ex; delete ex;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
setSignalHander(SIGPIPE, SIG_IGN, 0);
if(!op->defined(PREF_TORRENT_FILE) && !op->defined(PREF_METALINK_FILE)) {
Requests requests;
int cuidCounter = 1;
for(Strings::const_iterator itr = args.begin(); itr != args.end(); itr++) {
for(int s = 1; s <= op->getAsInt(PREF_SPLIT); s++) {
createRequest(cuidCounter, *itr, op->get(PREF_REFERER), requests);
cuidCounter++;
}
}
setSignalHander(SIGINT, handler, 0);
setSignalHander(SIGTERM, handler, 0);
Requests reserved;
string downloadedFilename;
normalDownload(requests, reserved, op, downloadedFilename);
for_each(requests.begin(), requests.end(), Deleter());
for_each(reserved.begin(), reserved.end(), Deleter());
requests.clear();
}
#ifdef ENABLE_METALINK
if(op->defined(PREF_METALINK_FILE) ||
followMetalink && readyToMetalinkMode) {
string targetMetalinkFile = op->defined(PREF_METALINK_FILE) ?
op->get(PREF_METALINK_FILE) : downloadedMetalinkFile;
Xml2MetalinkProcessor proc;
Metalinker* metalinker = proc.parseFile(targetMetalinkFile);
MetalinkEntry* entry =
metalinker->queryEntry(op->get(PREF_METALINK_VERSION),
op->get(PREF_METALINK_LANGUAGE),
op->get(PREF_METALINK_OS));
if(entry == NULL) {
printf("No file matched with your preference.\n");
exit(EXIT_FAILURE);
}
entry->dropUnsupportedResource();
entry->reorderResourcesByPreference();
Requests requests;
int cuidCounter = 1;
for(MetalinkResources::const_iterator itr = entry->resources.begin();
itr != entry->resources.end(); itr++) {
MetalinkResource* resource = *itr;
for(int s = 1; s <= op->getAsInt(PREF_SPLIT); s++) {
createRequest(cuidCounter, resource->url,
op->get(PREF_REFERER), requests);
cuidCounter++;
}
}
Requests reserved;
int maxConnection =
op->getAsInt(PREF_METALINK_SERVERS)*op->getAsInt(PREF_SPLIT);
if((int)requests.size() > maxConnection) {
copy(requests.begin()+maxConnection, requests.end(),
insert_iterator<Requests>(reserved, reserved.end()));
requests.erase(requests.begin()+maxConnection, requests.end());
}
setSignalHander(SIGINT, handler, 0);
setSignalHander(SIGTERM, handler, 0);
string downloadedFilename;
bool success = normalDownload(requests, reserved, op, downloadedFilename);
for_each(requests.begin(), requests.end(), Deleter());
for_each(reserved.begin(), reserved.end(), Deleter());
requests.clear();
if(success) {
#ifdef ENABLE_MESSAGE_DIGEST
if(entry->check(downloadedFilename)) {
printf("checksum OK.\n");
} else {
printf("checksum ERROR.\n");
exit(EXIT_FAILURE);
}
#endif // ENABLE_MESSAGE_DIGEST
}
delete metalinker;
}
#endif // ENABLE_METALINK
#ifdef ENABLE_BITTORRENT
if(op->defined(PREF_TORRENT_FILE) ||
followTorrent && readyToTorrentMode) {
try {
//op->put(PREF_MAX_TRIES, "0");
setSignalHander(SIGINT, torrentHandler, SA_RESETHAND);
setSignalHander(SIGTERM, torrentHandler, SA_RESETHAND);
Request* req = new Request();
req->isTorrent = true;
req->setTrackerEvent(Request::STARTED);
te = new TorrentConsoleDownloadEngine();
te->option = op;
ByteArrayDiskWriter* byteArrayDiskWriter = new ByteArrayDiskWriter();
te->segmentMan = new SegmentMan();
te->segmentMan->diskWriter = byteArrayDiskWriter;
te->segmentMan->option = op;
te->segmentMan->splitter = new SplitSlowestSegmentSplitter();
te->segmentMan->splitter->setMinSegmentSize(op->getAsLLInt(PREF_MIN_SEGMENT_SIZE));
te->torrentMan = new TorrentMan();
te->torrentMan->setStoreDir(op->get(PREF_DIR));
te->torrentMan->option = op;
te->torrentMan->req = req;
string targetTorrentFile = op->defined(PREF_TORRENT_FILE) ?
op->get(PREF_TORRENT_FILE) : downloadedTorrentFile;
if(op->get(PREF_SHOW_FILES) == V_TRUE) {
FileEntries fileEntries =
te->torrentMan->readFileEntryFromMetaInfoFile(targetTorrentFile);
cout << _("Files:") << endl;
cout << "idx|path/length" << endl;
cout << "===+===========================================================================" << endl;
int count = 1;
for(FileEntries::const_iterator itr = fileEntries.begin();
itr != fileEntries.end(); count++, itr++) {
printf("%3d|%s\n |%s Bytes\n", count, itr->path.c_str(),
Util::llitos(itr->length, true).c_str());
cout << "---+---------------------------------------------------------------------------" << endl;
}
exit(EXIT_SUCCESS);
} else {
if(selectFileIndexes.empty()) {
Strings targetFiles;
if(op->defined(PREF_TORRENT_FILE) && !args.empty()) {
targetFiles = args;
}
te->torrentMan->setup(targetTorrentFile, targetFiles);
} else {
te->torrentMan->setup(targetTorrentFile, selectFileIndexes);
}
}
PeerListenCommand* listenCommand =
new PeerListenCommand(te->torrentMan->getNewCuid(), te);
int port;
int listenPort = op->getAsInt(PREF_LISTEN_PORT);
if(listenPort == -1) {
port = listenCommand->bindPort(6881, 6999);
} else {
port = listenCommand->bindPort(listenPort, listenPort);
}
if(port == -1) {
printf(_("Errors occurred while binding port.\n"));
exit(EXIT_FAILURE);
}
te->torrentMan->setPort(port);
te->commands.push_back(listenCommand);
te->commands.push_back(new TrackerWatcherCommand(te->torrentMan->getNewCuid(),
te,
te->torrentMan->minInterval));
te->commands.push_back(new TrackerUpdateCommand(te->torrentMan->getNewCuid(),
te));
te->commands.push_back(new TorrentAutoSaveCommand(te->torrentMan->getNewCuid(),
te,
op->getAsInt(PREF_AUTO_SAVE_INTERVAL)));
te->commands.push_back(new PeerChokeCommand(te->torrentMan->getNewCuid(),
10, te));
te->commands.push_back(new HaveEraseCommand(te->torrentMan->getNewCuid(),
te, 10));
te->run();
if(te->torrentMan->downloadComplete()) {
printDownloadCompeleteMessage();
}
delete req;
te->cleanQueue();
delete te;
} catch(Exception* ex) {
cerr << ex->getMsg() << endl;
delete ex;
exit(EXIT_FAILURE);
}
}
#endif // ENABLE_BITTORRENT
delete op; delete op;
LogFactory::release(); LogFactory::release();
#ifdef HAVE_LIBGNUTLS #ifdef HAVE_LIBGNUTLS

View File

@ -26,6 +26,8 @@
#ifdef ENABLE_SSL #ifdef ENABLE_SSL
#define MAX_MD_LENGTH (16+20)
#ifdef HAVE_LIBSSL #ifdef HAVE_LIBSSL
#include <openssl/evp.h> #include <openssl/evp.h>
#endif // HAVE_LIBSSL #endif // HAVE_LIBSSL
@ -36,73 +38,80 @@
class MessageDigestContext { class MessageDigestContext {
public: public:
enum HashAlgo { #ifdef HAVE_LIBSSL
ALGO_MD5, typedef const EVP_MD* DigestAlgo;
ALGO_SHA1 # define DIGEST_ALGO_MD5 EVP_md5()
}; # define DIGEST_ALGO_SHA1 EVP_sha1()
#endif // HAVE_LIBSSL
#ifdef HAVE_LIBGCRYPT
typedef int DigestAlgo;
# define DIGEST_ALGO_MD5 GCRY_MD_MD5
# define DIGEST_ALGO_SHA1 GCRY_MD_SHA1
#endif // HAVE_LIBGCRYPT
private:
#ifdef HAVE_LIBSSL #ifdef HAVE_LIBSSL
EVP_MD_CTX ctx; EVP_MD_CTX ctx;
const EVP_MD* algo;
#endif // HAVE_LIBSSL #endif // HAVE_LIBSSL
#ifdef HAVE_LIBGCRYPT #ifdef HAVE_LIBGCRYPT
gcry_md_hd_t ctx; gcry_md_hd_t ctx;
int algo; #endif // HAVE_LIBGCRYPT
#endif // HAVE_LIBGCRYPT DigestAlgo algo;
public:
MessageDigestContext():
algo(DIGEST_ALGO_SHA1) {}
MessageDigestContext(DigestAlgo algo):
algo(algo) {}
MessageDigestContext() {} #ifdef HAVE_LIBSSL
MessageDigestContext(HashAlgo algo) { void digestInit() {
setAlgo(algo); EVP_MD_CTX_init(&ctx);
digestReset();
} }
void digestReset() {
EVP_DigestInit_ex(&ctx, algo, 0);
}
void digestUpdate(const void* data, int length) {
EVP_DigestUpdate(&ctx, data, length);
}
void digestFinal(unsigned char* md) {
int len;
EVP_DigestFinal_ex(&ctx, md, (unsigned int*)&len);
}
void digestFree() {
EVP_MD_CTX_cleanup(&ctx);
}
int digestLength() const {
return digestLength(algo);
}
static int digestLength(DigestAlgo algo) {
return EVP_MD_size(algo);
}
#endif // HAVE_LIBSSL
void setAlgo(HashAlgo algo) {
switch(algo) {
case ALGO_MD5:
#ifdef HAVE_LIBSSL
this->algo = EVP_md5();
#endif // HAVE_LIBSSL
#ifdef HAVE_LIBGCRYPT #ifdef HAVE_LIBGCRYPT
this->algo = GCRY_MD_MD5; void digestInit() {
#endif // HAVE_LIBGCRYPT gcry_md_open(&ctx, algo, 0);
break;
case ALGO_SHA1:
#ifdef HAVE_LIBSSL
this->algo = EVP_sha1();
#endif // HAVE_LIBSSL
#ifdef HAVE_LIBGCRYPT
this->algo = GCRY_MD_SHA1;
#endif // HAVE_LIBGCRYPT
break;
default:
break;
}
} }
void digestReset() {
gcry_md_reset(ctx);
}
void digestUpdate(const void* data, int length) {
gcry_md_write(ctx, data, length);
}
void digestFinal(unsigned char* md) {
gcry_md_final(ctx);
memcpy(md, gcry_md_read(ctx, 0), gcry_md_get_algo_dlen(algo));
}
void digestFree() {
gcry_md_close(ctx);
}
int digestLength() const {
return digestLength(algo);
}
static int digestLength(DigestAlgo algo) {
return gcry_md_get_algo_dlen(algo);
}
#endif // HAVE_LIBGCRYPT
}; };
#ifdef HAVE_LIBSSL
#define digestInit(CTX) EVP_MD_CTX_init(&CTX.ctx)
#define digestReset(CTX) EVP_DigestInit_ex(&CTX.ctx, CTX.algo, NULL)
#define digestUpdate(CTX, DATA, LENGTH) EVP_DigestUpdate(&CTX.ctx, DATA, LENGTH)
#define digestFinal(CTX, HASH) \
{\
int len;\
EVP_DigestFinal_ex(&CTX.ctx, HASH, (unsigned int*)&len);\
}
#define digestFree(CTX) EVP_MD_CTX_cleanup(&CTX.ctx)
#endif // HAVE_LIBSSL
#ifdef HAVE_LIBGCRYPT
#define digestInit(CTX) gcry_md_open(&CTX.ctx, CTX.algo, 0)
#define digestReset(CTX) gcry_md_reset(CTX.ctx)
#define digestUpdate(CTX, DATA, LENGTH) gcry_md_write(CTX.ctx, DATA, LENGTH)
#define digestFinal(CTX, HASH) \
{\
gcry_md_final(CTX.ctx);\
memcpy(HASH, gcry_md_read(CTX.ctx, 0), gcry_md_get_algo_dlen(CTX.algo));\
}
#define digestFree(CTX) gcry_md_close(CTX.ctx)
#endif // HAVE_LIBGCRYPT
#endif // ENABLE_SSL #endif // ENABLE_SSL
#endif // _D_MESSAGE_DIGEST_H_ #endif // _D_MESSAGE_DIGEST_H_

View File

@ -57,6 +57,8 @@
#define PREF_DAEMON "daemon" #define PREF_DAEMON "daemon"
// value: a string // value: a string
#define PREF_REFERER "referer" #define PREF_REFERER "referer"
// value' 1*digit
#define PREF_LOWEST_SPEED_LIMIT "lowest_speed_limit"
/** /**
* FTP related preferences * FTP related preferences
@ -116,6 +118,10 @@
#define PREF_TORRENT_FILE "torrent_file" #define PREF_TORRENT_FILE "torrent_file"
// values: 1*digit // values: 1*digit
#define PREF_LISTEN_PORT "listen_port" #define PREF_LISTEN_PORT "listen_port"
// values: true | false
#define PREF_FOLLOW_TORRENT "follow_torrent"
// values: 1*digit *( (,|-) 1*digit)
#define PREF_SELECT_FILE "select_file"
/** /**
* Metalink related preferences * Metalink related preferences
@ -130,5 +136,7 @@
#define PREF_METALINK_OS "metalink_os" #define PREF_METALINK_OS "metalink_os"
// values: 1*digit // values: 1*digit
#define PREF_METALINK_SERVERS "metalink_servers" #define PREF_METALINK_SERVERS "metalink_servers"
// values: true | false
#define PREF_FOLLOW_METALINK "follow_metalink"
#endif // _D_PREFS_H_ #endif // _D_PREFS_H_

View File

@ -48,11 +48,17 @@ MetalinkEntry* createTestEntry() {
res4->type = MetalinkResource::TYPE_NOT_SUPPORTED; res4->type = MetalinkResource::TYPE_NOT_SUPPORTED;
res4->location = "ad"; res4->location = "ad";
res4->preference = 10; res4->preference = 10;
MetalinkResource* res5 = new MetalinkResource();
res5->url = "https://myhost/aria2.tar.bz2";
res5->type = MetalinkResource::TYPE_HTTPS;
res5->location = "jp";
res5->preference = 90;
entry->resources.push_back(res1); entry->resources.push_back(res1);
entry->resources.push_back(res2); entry->resources.push_back(res2);
entry->resources.push_back(res3); entry->resources.push_back(res3);
entry->resources.push_back(res4); entry->resources.push_back(res4);
entry->resources.push_back(res5);
return entry; return entry;
} }
@ -61,12 +67,16 @@ void MetalinkEntryTest::testDropUnsupportedResource() {
entry->dropUnsupportedResource(); entry->dropUnsupportedResource();
CPPUNIT_ASSERT_EQUAL(2, (int)entry->resources.size()); CPPUNIT_ASSERT_EQUAL(4, (int)entry->resources.size());
CPPUNIT_ASSERT_EQUAL((int)MetalinkResource::TYPE_FTP, CPPUNIT_ASSERT_EQUAL((int)MetalinkResource::TYPE_FTP,
entry->resources.at(0)->type); entry->resources.at(0)->type);
CPPUNIT_ASSERT_EQUAL((int)MetalinkResource::TYPE_HTTP, CPPUNIT_ASSERT_EQUAL((int)MetalinkResource::TYPE_HTTP,
entry->resources.at(1)->type); entry->resources.at(1)->type);
CPPUNIT_ASSERT_EQUAL((int)MetalinkResource::TYPE_BITTORRENT,
entry->resources.at(2)->type);
CPPUNIT_ASSERT_EQUAL((int)MetalinkResource::TYPE_HTTPS,
entry->resources.at(3)->type);
} }
void MetalinkEntryTest::testReorderResourcesByPreference() { void MetalinkEntryTest::testReorderResourcesByPreference() {
@ -75,9 +85,10 @@ void MetalinkEntryTest::testReorderResourcesByPreference() {
entry->reorderResourcesByPreference(); entry->reorderResourcesByPreference();
CPPUNIT_ASSERT_EQUAL(100, entry->resources.at(0)->preference); CPPUNIT_ASSERT_EQUAL(100, entry->resources.at(0)->preference);
CPPUNIT_ASSERT_EQUAL(60, entry->resources.at(1)->preference); CPPUNIT_ASSERT_EQUAL(90, entry->resources.at(1)->preference);
CPPUNIT_ASSERT_EQUAL(50, entry->resources.at(2)->preference); CPPUNIT_ASSERT_EQUAL(60, entry->resources.at(2)->preference);
CPPUNIT_ASSERT_EQUAL(10, entry->resources.at(3)->preference); CPPUNIT_ASSERT_EQUAL(50, entry->resources.at(3)->preference);
CPPUNIT_ASSERT_EQUAL(10, entry->resources.at(4)->preference);
} }
void MetalinkEntryTest::testCheck() { void MetalinkEntryTest::testCheck() {

View File

@ -224,12 +224,12 @@ void UtilTest::testRandomAlpha() {
void UtilTest::testFileChecksum() { void UtilTest::testFileChecksum() {
unsigned char buf[20]; unsigned char buf[20];
string filename = "4096chunk.txt"; string filename = "4096chunk.txt";
Util::fileChecksum(filename, buf, MessageDigestContext::ALGO_SHA1); Util::fileChecksum(filename, buf, DIGEST_ALGO_SHA1);
string sha1 = Util::toHex(buf, 20); string sha1 = Util::toHex(buf, 20);
CPPUNIT_ASSERT_EQUAL(string("608cabc0f2fa18c260cafd974516865c772363d5"), CPPUNIT_ASSERT_EQUAL(string("608cabc0f2fa18c260cafd974516865c772363d5"),
sha1); sha1);
Util::fileChecksum(filename, buf, MessageDigestContext::ALGO_MD5); Util::fileChecksum(filename, buf, DIGEST_ALGO_MD5);
string md5 = Util::toHex(buf, 16); string md5 = Util::toHex(buf, 16);
CPPUNIT_ASSERT_EQUAL(string("82a7348c2e03731109d0cf45a7325b88"), CPPUNIT_ASSERT_EQUAL(string("82a7348c2e03731109d0cf45a7325b88"),
md5); md5);