From e3b0153e85247f546387aa50e7e7b96f6ac902a2 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 14 Aug 2006 11:38:28 +0000 Subject: [PATCH] 2006-08-14 Tatsuhiro Tsujikawa * src/main.cc (main): Added a message to inform users that aria2 is starting to verify checksum. * src/RequestInfo.cc (printDownloadAbortMessage): Added a message to inform users that transfer can be resumed. 2006-08-12 Tatsuhiro Tsujikawa To handle the case where some BitTorrent tracker requires all letters except for [A-Za-z0-9] is URL encoded. * src/Util.h (torrentUrlencode): New function. * src/Util.cc (ctype.h): Included. (torrentUrlencode): New function. * src/TrackerWatcherCommand.cc (execute): Use Util::torrentUrlencode() instead of Util::urlencode(). --- ChangeLog | 22 ++++++++++++++++++++++ TODO | 1 + src/RequestInfo.h | 4 +++- src/TrackerWatcherCommand.cc | 2 +- src/Util.cc | 16 ++++++++++++++++ src/Util.h | 2 ++ src/main.cc | 7 +++++-- 7 files changed, 50 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a2552b3..abdb656b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2006-08-14 Tatsuhiro Tsujikawa + + * src/main.cc + (main): Added a message to inform users that aria2 is starting to + verify checksum. + * src/RequestInfo.cc + (printDownloadAbortMessage): Added a message to inform users that + transfer can be resumed. + +2006-08-12 Tatsuhiro Tsujikawa + + To handle the case where some BitTorrent tracker requires all letters + except for [A-Za-z0-9] is URL encoded. + + * src/Util.h + (torrentUrlencode): New function. + * src/Util.cc + (ctype.h): Included. + (torrentUrlencode): New function. + * src/TrackerWatcherCommand.cc + (execute): Use Util::torrentUrlencode() instead of Util::urlencode(). + 2006-08-11 Tatsuhiro Tsujikawa To add asynchronous DNS support(libares): diff --git a/TODO b/TODO index 971bbd2a..e88d5c55 100644 --- a/TODO +++ b/TODO @@ -12,3 +12,4 @@ * Query resource by location * List available os, version, etc for metalink * ipv6(RFC2428 for ftp) +* default prefix in libares.m4 must be the value of --prefex, not /usr/local \ No newline at end of file diff --git a/src/RequestInfo.h b/src/RequestInfo.h index b8a6bdf0..09aec739 100644 --- a/src/RequestInfo.h +++ b/src/RequestInfo.h @@ -89,7 +89,9 @@ protected: } void printDownloadAbortMessage() { - printf(_("\nThe download was not complete because of errors. Check the log.\n")); + printf(_("\nThe download was not complete because of errors." + " Check the log.\n" + "aria2 will resume download if the transfer is restarted.")); } public: RequestInfo(const Option* op): diff --git a/src/TrackerWatcherCommand.cc b/src/TrackerWatcherCommand.cc index e890f924..1c334ac3 100644 --- a/src/TrackerWatcherCommand.cc +++ b/src/TrackerWatcherCommand.cc @@ -81,7 +81,7 @@ bool TrackerWatcherCommand::execute() { break; } string url = e->torrentMan->announce+"?"+ - "info_hash="+Util::urlencode(e->torrentMan->getInfoHash(), 20)+"&"+ + "info_hash="+Util::torrentUrlencode(e->torrentMan->getInfoHash(), 20)+"&"+ "peer_id="+e->torrentMan->peerId+"&"+ "port="+Util::itos(e->torrentMan->getPort())+"&"+ "uploaded="+Util::llitos(e->torrentMan->getSessionUploadLength())+"&"+ diff --git a/src/Util.cc b/src/Util.cc index 1b34a182..330ca0fa 100644 --- a/src/Util.cc +++ b/src/Util.cc @@ -23,6 +23,7 @@ #include "DlAbortEx.h" #include "File.h" #include "message.h" +#include #include #include #include @@ -188,6 +189,21 @@ string Util::urlencode(const unsigned char* target, int len) { return dest; } +string Util::torrentUrlencode(const unsigned char* target, int len) { + string dest; + for(int i = 0; i < len; i++) { + if(isalpha(target[i]) || isdigit(target[i])) { + dest += target[i]; + } else { + char temp[4]; + sprintf(temp, "%%%02x", target[i]); + temp[sizeof(temp)-1] = '\0'; + dest.append(temp); + } + } + return dest; +} + string Util::toHex(const unsigned char* src, int len) { char* temp = new char[len*2+1]; for(int i = 0; i < len; i++) { diff --git a/src/Util.h b/src/Util.h index f92152a8..c5d331a6 100644 --- a/src/Util.h +++ b/src/Util.h @@ -64,6 +64,8 @@ public: static string urlencode(const unsigned char* target, int len); + static string torrentUrlencode(const unsigned char* target, int len); + static string toHex(const unsigned char* src, int len); static FILE* openFile(const string& filename, const string& mode); diff --git a/src/main.cc b/src/main.cc index 62813108..64aa5d39 100644 --- a/src/main.cc +++ b/src/main.cc @@ -673,11 +673,14 @@ int main(int argc, char* argv[]) { exit(EXIT_FAILURE); } if(requestInfo->getFileInfo().checkReady()) { + cout << _("Now verifying checksum.\n" + "This may take some time depending on your PC environment" + " and the size of file.") << endl; if(requestInfo->getFileInfo().check()) { - printf("checksum OK.\n"); + cout << _("checksum OK.") << endl; } else { // TODO - printf("checksum ERROR.\n"); + cout << _("checksum ERROR.") << endl; exit(EXIT_FAILURE); } }