summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-09-08 14:35:30 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-09-08 14:35:30 +0000
commitbf9fd473bb18531ad01059d9ff7341a23add9f1e (patch)
treec3afd535814098f0a96e32caafa663ccd9c67ede /test
parentf5b3a820ef7390c82f2f240aebb8b40ee7a63b7d (diff)
2010-09-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Allow '@' in username and password embedded in URI. It should be percent-encoded but many people use their mail address as an username and forget about PE. * src/Request.cc * test/RequestTest.cc
Diffstat (limited to 'test')
-rw-r--r--test/RequestTest.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/test/RequestTest.cc b/test/RequestTest.cc
index 9e96af60..016e1e01 100644
--- a/test/RequestTest.cc
+++ b/test/RequestTest.cc
@@ -471,33 +471,32 @@ void RequestTest::testSetUri_zeroUsername()
void RequestTest::testSetUri_username()
{
Request req;
- CPPUNIT_ASSERT(req.setUri("ftp://aria2user@localhost/download/aria2-1.0.0.tar.bz2"));
+ CPPUNIT_ASSERT(req.setUri("ftp://aria2@user@localhost/download/aria2-1.0.0.tar.bz2"));
CPPUNIT_ASSERT_EQUAL(std::string("ftp"), req.getProtocol());
CPPUNIT_ASSERT_EQUAL((uint16_t)21, req.getPort());
CPPUNIT_ASSERT_EQUAL(std::string("localhost"), req.getHost());
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("aria2user"), req.getUsername());
+ CPPUNIT_ASSERT_EQUAL(std::string("aria2@user"), req.getUsername());
CPPUNIT_ASSERT_EQUAL(std::string(""), req.getPassword());
}
void RequestTest::testSetUri_usernamePassword()
{
Request req;
- CPPUNIT_ASSERT(req.setUri("ftp://aria2user%40:aria2pass%40@localhost/download/aria2-1.0.0.tar.bz2"));
+ CPPUNIT_ASSERT(req.setUri("ftp://aria2@user%40:aria2@pass%40@localhost/download/aria2-1.0.0.tar.bz2"));
CPPUNIT_ASSERT_EQUAL(std::string("ftp"), req.getProtocol());
CPPUNIT_ASSERT_EQUAL((uint16_t)21, req.getPort());
CPPUNIT_ASSERT_EQUAL(std::string("localhost"), req.getHost());
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("aria2user@"), req.getUsername());
- CPPUNIT_ASSERT_EQUAL(std::string("aria2pass@"), req.getPassword());
+ CPPUNIT_ASSERT_EQUAL(std::string("aria2@user@"), req.getUsername());
+ CPPUNIT_ASSERT_EQUAL(std::string("aria2@pass@"), req.getPassword());
// make sure that after new uri is set, username and password are updated.
CPPUNIT_ASSERT(req.setUri("ftp://localhost/download/aria2-1.0.0.tar.bz2"));
CPPUNIT_ASSERT_EQUAL(std::string(""), req.getUsername());
CPPUNIT_ASSERT_EQUAL(std::string(""), req.getPassword());
-
}
void RequestTest::testSetUri_supportsPersistentConnection()