mirror of https://github.com/aria2/aria2
2008-09-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Now colon is required for username and password in FTP URL, like: ftp://username:password@host. If colon is not there, aria2 don't parse it as a username. For example, aria2 don't retrieve username from ftp://username@host. This fix was made in order to login FTP server via non-transparent ftp proxy. * src/Request.cc * test/RequestTest.ccpull/1/head
parent
92d702fa53
commit
789e1926cb
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2008-09-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
|
Now colon is required for username and password in FTP URL, like:
|
||||||
|
ftp://username:password@host.
|
||||||
|
If colon is not there, aria2 don't parse it as a username. For example,
|
||||||
|
aria2 don't retrieve username from ftp://username@host.
|
||||||
|
This fix was made in order to login FTP server via non-transparent ftp
|
||||||
|
proxy.
|
||||||
|
* src/Request.cc
|
||||||
|
* test/RequestTest.cc
|
||||||
|
|
||||||
2008-09-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
2008-09-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
Use netrc for HTTP.
|
Use netrc for HTTP.
|
||||||
|
|
|
@ -136,10 +136,12 @@ bool Request::parseUrl(const std::string& url) {
|
||||||
std::string::size_type atmarkp = hostPart.find_last_of("@");
|
std::string::size_type atmarkp = hostPart.find_last_of("@");
|
||||||
if(atmarkp != std::string::npos) {
|
if(atmarkp != std::string::npos) {
|
||||||
std::string authPart = hostPart.substr(0, atmarkp);
|
std::string authPart = hostPart.substr(0, atmarkp);
|
||||||
std::pair<std::string, std::string> userPass =
|
if(authPart.find(":") != std::string::npos) {
|
||||||
Util::split(authPart, A2STR::COLON_C);
|
std::pair<std::string, std::string> userPass =
|
||||||
_username = Util::urldecode(userPass.first);
|
Util::split(authPart, A2STR::COLON_C);
|
||||||
_password = Util::urldecode(userPass.second);
|
_username = Util::urldecode(userPass.first);
|
||||||
|
_password = Util::urldecode(userPass.second);
|
||||||
|
}
|
||||||
hostPart.erase(0, atmarkp+1);
|
hostPart.erase(0, atmarkp+1);
|
||||||
}
|
}
|
||||||
std::pair<std::string, std::string> hostAndPort;
|
std::pair<std::string, std::string> hostAndPort;
|
||||||
|
|
|
@ -402,7 +402,8 @@ void RequestTest::testSetUrl_username()
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("localhost"), req.getHost());
|
CPPUNIT_ASSERT_EQUAL(std::string("localhost"), req.getHost());
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("/download"), req.getDir());
|
CPPUNIT_ASSERT_EQUAL(std::string("/download"), req.getDir());
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("aria2-1.0.0.tar.bz2"), req.getFile());
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2-1.0.0.tar.bz2"), req.getFile());
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("aria2user"), req.getUsername());
|
// No ":" is foundin 'aria2user', so username and password is left blank.
|
||||||
|
CPPUNIT_ASSERT_EQUAL(std::string(""), req.getUsername());
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string(""), req.getPassword());
|
CPPUNIT_ASSERT_EQUAL(std::string(""), req.getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue