From b4e5ba2779e2f6230a6db69553e6e459f94efd7d Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 8 Jun 2008 12:07:17 +0000 Subject: [PATCH] 2008-06-08 Tatsuhiro Tsujikawa Fixed the bug that aria2 aborts when a path to a directory is given in command-line. * src/ProtocolDetector.cc --- ChangeLog | 6 ++++++ src/ProtocolDetector.cc | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index dc1caa30..78095848 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-06-08 Tatsuhiro Tsujikawa + + 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 Limited the number files opened in each BitTorrent download. The default 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 #include #include @@ -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];