mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
fix(Net): HTTPCookie Constructor Fails to Handle Discard Attribute Properly (#4664)
This commit is contained in:
parent
42ccb0d96d
commit
db1cc9507b
@ -119,7 +119,7 @@ HTTPCookie::HTTPCookie(const NameValueCollection& nvc):
|
||||
{
|
||||
setHttpOnly(true);
|
||||
}
|
||||
else
|
||||
else if (_name.empty())
|
||||
{
|
||||
setName(name);
|
||||
setValue(value);
|
||||
|
@ -192,6 +192,22 @@ void HTTPCookieTest::testCookieExpiry(DateTime expiryTime)
|
||||
}
|
||||
|
||||
|
||||
void HTTPCookieTest::testIgnoreExtraAttributes()
|
||||
{
|
||||
NameValueCollection nvc;
|
||||
nvc.add("test", "foo");
|
||||
nvc.add("Version", "1");
|
||||
nvc.add("Path", "/test/path");
|
||||
nvc.add("Discard", "");
|
||||
nvc.add("HttpOnly", "");
|
||||
|
||||
HTTPCookie cookie(nvc);
|
||||
assert (cookie.getName() == "test");
|
||||
assert (cookie.getValue() == "foo");
|
||||
assert (cookie.getHttpOnly());
|
||||
}
|
||||
|
||||
|
||||
void HTTPCookieTest::setUp()
|
||||
{
|
||||
}
|
||||
@ -211,6 +227,7 @@ CppUnit::Test* HTTPCookieTest::suite()
|
||||
CppUnit_addTest(pSuite, HTTPCookieTest, testUnescape);
|
||||
CppUnit_addTest(pSuite, HTTPCookieTest, testExpiryFuture);
|
||||
CppUnit_addTest(pSuite, HTTPCookieTest, testExpiryPast);
|
||||
CppUnit_addTest(pSuite, HTTPCookieTest, testIgnoreExtraAttributes);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ public:
|
||||
void testExpiryFuture();
|
||||
void testExpiryPast();
|
||||
void testCookieExpiry(Poco::DateTime expiryTime);
|
||||
void testIgnoreExtraAttributes();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
Loading…
Reference in New Issue
Block a user