Allow '@' in the username part of an URL.
This commit is contained in:
parent
c884bc382c
commit
ecf9dbafe6
@ -165,7 +165,7 @@ void url::parse(const string& str)
|
|||||||
string::size_type slashPos = str.find('/', protoEnd + 3);
|
string::size_type slashPos = str.find('/', protoEnd + 3);
|
||||||
if (slashPos == string::npos) slashPos = str.length();
|
if (slashPos == string::npos) slashPos = str.length();
|
||||||
|
|
||||||
string::size_type atPos = str.find('@', protoEnd + 3);
|
string::size_type atPos = str.rfind('@', slashPos);
|
||||||
string hostPart;
|
string hostPart;
|
||||||
|
|
||||||
string username;
|
string username;
|
||||||
|
@ -38,6 +38,7 @@ VMIME_TEST_SUITE_BEGIN
|
|||||||
VMIME_TEST(testParse2)
|
VMIME_TEST(testParse2)
|
||||||
VMIME_TEST(testParse3)
|
VMIME_TEST(testParse3)
|
||||||
VMIME_TEST(testParse4)
|
VMIME_TEST(testParse4)
|
||||||
|
VMIME_TEST(testParse5)
|
||||||
VMIME_TEST(testGenerate)
|
VMIME_TEST(testGenerate)
|
||||||
VMIME_TEST(testUtilsEncode)
|
VMIME_TEST(testUtilsEncode)
|
||||||
VMIME_TEST(testUtilsDecode)
|
VMIME_TEST(testUtilsDecode)
|
||||||
@ -190,6 +191,17 @@ VMIME_TEST_SUITE_BEGIN
|
|||||||
VASSERT_EQ("4.4", "/path", u4.getPath());
|
VASSERT_EQ("4.4", "/path", u4.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// '@' symbol in the username part
|
||||||
|
void testParse5()
|
||||||
|
{
|
||||||
|
vmime::utility::url u1("", "");
|
||||||
|
|
||||||
|
VASSERT_EQ("1", true, parseHelper(u1, "imap://account@myserver.com:password@myserver.com"));
|
||||||
|
VASSERT_EQ("2", "account@myserver.com", u1.getUsername());
|
||||||
|
VASSERT_EQ("3", "password", u1.getPassword());
|
||||||
|
VASSERT_EQ("4", "myserver.com", u1.getHost());
|
||||||
|
}
|
||||||
|
|
||||||
void testGenerate()
|
void testGenerate()
|
||||||
{
|
{
|
||||||
vmime::utility::url u1("proto", "host", 12345, "path", "user", "password");
|
vmime::utility::url u1("proto", "host", 12345, "path", "user", "password");
|
||||||
|
Loading…
Reference in New Issue
Block a user