diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-06-08 12:07:17 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-06-08 12:07:17 +0000 |
| commit | b4e5ba2779e2f6230a6db69553e6e459f94efd7d (patch) | |
| tree | 0a2dae37e2b9414439d1929f9a93199eb9e85ce9 | |
| parent | 2ad5df249ea835e14981ca84643b1bd23d037253 (diff) | |
2008-06-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed the bug that aria2 aborts when a path to a directory is
given
in command-line.
* src/ProtocolDetector.cc
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | src/ProtocolDetector.cc | 7 |
2 files changed, 13 insertions, 0 deletions
@@ -1,5 +1,11 @@ 2008-06-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> + Fixed the bug that aria2 aborts when a path to a directory is given + in command-line. + * src/ProtocolDetector.cc + +2008-06-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> + Limited the number files opened in each BitTorrent download. The default value is 100. The option to change this value will be added. * src/MultiDiskAdaptor.cc diff --git a/src/ProtocolDetector.cc b/src/ProtocolDetector.cc index 9a01736f..ee743c65 100644 --- a/src/ProtocolDetector.cc +++ b/src/ProtocolDetector.cc @@ -34,6 +34,7 @@ /* copyright --> */ #include "ProtocolDetector.h" #include "Request.h" +#include "File.h" #include <cstring> #include <fstream> #include <iomanip> @@ -51,6 +52,9 @@ bool ProtocolDetector::isStreamProtocol(const std::string& uri) const bool ProtocolDetector::guessTorrentFile(const std::string& uri) const { + if(!File(uri).isFile()) { + return false; + } std::ifstream in(uri.c_str()); if(in) { char head; @@ -63,6 +67,9 @@ bool ProtocolDetector::guessTorrentFile(const std::string& uri) const bool ProtocolDetector::guessMetalinkFile(const std::string& uri) const { + if(!File(uri).isFile()) { + return false; + } std::ifstream in(uri.c_str()); if(in) { char head[6]; |
