* src/main.cc:

Added ENABLE_MESSAGE_DIGEST to skip checksum checking when the 
message
	digest support is not available.
	* src/MetalinkEntry.cc
	(check): Added ENABLE_MESSAGE_DIGEST. Return true if the message 
digest
	support is not available.
pull/1/head
Tatsuhiro Tsujikawa 2006-07-04 11:44:15 +00:00
parent 31cf446f6d
commit db35fe355a
6 changed files with 32 additions and 6 deletions

View File

@ -21,10 +21,15 @@
* src/main.cc:
Added ENABLE_BITTORRENT around includes and blocks related to
BitTorrent.
Added ENABLE_MESSAGE_DIGEST to skip checksum checking when the message
digest support is not available.
* src/AbstractDiskWriter.h:
Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
* src/AbstractDiskWriter.cc:
Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
* src/MetalinkEntry.cc
(check): Added ENABLE_MESSAGE_DIGEST. Return true if the message digest
support is not available.
To add command-line options for Metalink:

21
README
View File

@ -1,4 +1,4 @@
aria2 - a simple utility for downloading files.
aria2 - The high speed download utility
1. Disclaimer
-------------
@ -22,6 +22,7 @@ aria2 is in very early development stage. Currently it has following features:
* It can run as a daemon process.
* BitTorrent protocol support with fast extension.
* Selective download in multi-file torrent
* Metalink version 3.0 support(http/ftp only).
3. How to build
---------------
@ -34,10 +35,15 @@ The executable is aria2c in src directory.
-------------
In order to enable HTTPS support, you need GNU TLS or OpenSSL.
In order to enable BitTorrent support, you need GNU TLS+libgcrypt or OpenSSL.
In order to enable Metalink support, you need libxml2. Optionally GNU TLS+
libgcrypt or OpenSSL are required for checksum checking support(MD5, SHA1).
GNU TLS has precedence over OpenSSL if both libraries are installed.
If you prefer OpenSSL, run configure with "--without-gnutls".
You can disable BitTorrent, Metalink support by providing --disable-bittorrent,
--disable-metalink respectively to configure script.
5. BitTorrrent
--------------
The filename of the downloaded file is determined as follows:
@ -72,4 +78,15 @@ Note:
* The ports aria2c uses are 6881-6999.
* The maximum number of peers is 55.
* After selective download completes, aria2 is going to download rest of the
files.
files.
6. Metalink
-----------
The current implementation only supports http/ftp downloading in Metalink.
BitTorrent and other p2p protocols are ignored.
For checksum checking, both MD5 and SHA1 are supported. If both values are
provided, then aria2 uses SHA1. If checksum checking is failed, aria2 doesn't
retry the download and just exits with non-zero return code.
The supported user preferences are version, language and os.

3
configure vendored
View File

@ -4672,8 +4672,7 @@ fi
fi
if test "x$have_libxml2" = "xyes" && test "x$enable_metalink" = "xyes" && \
test "x$enable_message_digest" = "xyes"; then
if test "x$have_libxml2" = "xyes" && test "x$enable_metalink" = "xyes"; then
cat >>confdefs.h <<\_ACEOF
#define ENABLE_METALINK 1

View File

@ -70,8 +70,7 @@ else
AM_CONDITIONAL([ENABLE_BITTORRENT], false)
fi
if test "x$have_libxml2" = "xyes" && test "x$enable_metalink" = "xyes" && \
test "x$enable_message_digest" = "xyes"; then
if test "x$have_libxml2" = "xyes" && test "x$enable_metalink" = "xyes"; then
AC_DEFINE([ENABLE_METALINK], [1], [Define to 1 if Metalink support is enabled.])
AM_CONDITIONAL([ENABLE_METALINK], true)
else

View File

@ -30,6 +30,7 @@ MetalinkEntry::~MetalinkEntry() {
}
bool MetalinkEntry::check(const string& filename) const {
#ifdef ENABLE_MESSAGE_DIGEST
unsigned char buf[20];
int digestLength;
const string* digestPtr;
@ -47,6 +48,9 @@ bool MetalinkEntry::check(const string& filename) const {
}
Util::fileChecksum(filename, buf, algo);
return *digestPtr == Util::toHex(buf, digestLength);
#else
return true;
#endif //ENABLE_MESSAGE_DIGEST
}
class PrefOrder {

View File

@ -790,12 +790,14 @@ int main(int argc, char* argv[]) {
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;