summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-06-08 12:07:17 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-06-08 12:07:17 +0000
commitb4e5ba2779e2f6230a6db69553e6e459f94efd7d (patch)
tree0a2dae37e2b9414439d1929f9a93199eb9e85ce9
parent2ad5df249ea835e14981ca84643b1bd23d037253 (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--ChangeLog6
-rw-r--r--src/ProtocolDetector.cc7
2 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index dc1caa30..78095848 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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];