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)
pull/1/head
Tatsuhiro Tsujikawa 2008-05-14 13:25:42 +00:00
parent 309ad8c5ef
commit 30a378aa57
4 changed files with 14 additions and 2 deletions

View File

@ -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*'.

View File

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

View File

@ -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

View File

@ -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);