瀏覽代碼

2008-05-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Added COLON_C(".") and used it in Request::parseUrl()
	* src/A2STR.cc
	* src/A2STR.h
	* src/Request.cc (parseUrl)
Tatsuhiro Tsujikawa 17 年之前
父節點
當前提交
30a378aa57
共有 4 個文件被更改,包括 14 次插入2 次删除
  1. 7 0
      ChangeLog
  2. 2 0
      src/A2STR.cc
  3. 2 0
      src/A2STR.h
  4. 3 2
      src/Request.cc

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2008-05-14  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Added COLON_C(".") and used it in Request::parseUrl()
+	* src/A2STR.cc
+	* src/A2STR.h
+	* src/Request.cc (parseUrl)
+
 2008-05-14  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Changed the type of padName from `const std::string&' to `const char*'.

+ 2 - 0
src/A2STR.cc

@@ -48,4 +48,6 @@ const std::string A2STR::SLASH_C("/");
 
 const std::string A2STR::DOT_C(".");
 
+const std::string A2STR::COLON_C(":");
+
 } // namespace aria2

+ 2 - 0
src/A2STR.h

@@ -54,6 +54,8 @@ public:
   static const std::string SLASH_C;
 
   static const std::string DOT_C;
+
+  static const std::string COLON_C;
 };
 } // namespace aria2
 

+ 3 - 2
src/Request.cc

@@ -125,7 +125,8 @@ bool Request::parseUrl(const std::string& url) {
   std::string::size_type atmarkp =  hostPart.find_last_of("@");
   if(atmarkp != std::string::npos) {
     std::string authPart = hostPart.substr(0, atmarkp);
-    std::pair<std::string, std::string> userPass = Util::split(authPart, ":");
+    std::pair<std::string, std::string> userPass =
+      Util::split(authPart, A2STR::COLON_C);
     _username = Util::urldecode(userPass.first);
     _password = Util::urldecode(userPass.second);
     hostPart.erase(0, atmarkp+1);
@@ -146,7 +147,7 @@ bool Request::parseUrl(const std::string& url) {
   // find directory and file part
   std::string::size_type direp = tempUrl.find_last_of("/");
   if(direp == std::string::npos || direp <= hep) {
-    dir = "/";
+    dir = A2STR::SLASH_C;
     direp = hep;
   } else {
     std::string rawDir = tempUrl.substr(hep, direp-hep);