mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-05 03:37:28 +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);
|
setHttpOnly(true);
|
||||||
}
|
}
|
||||||
else
|
else if (_name.empty())
|
||||||
{
|
{
|
||||||
setName(name);
|
setName(name);
|
||||||
setValue(value);
|
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()
|
void HTTPCookieTest::setUp()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -211,6 +227,7 @@ CppUnit::Test* HTTPCookieTest::suite()
|
|||||||
CppUnit_addTest(pSuite, HTTPCookieTest, testUnescape);
|
CppUnit_addTest(pSuite, HTTPCookieTest, testUnescape);
|
||||||
CppUnit_addTest(pSuite, HTTPCookieTest, testExpiryFuture);
|
CppUnit_addTest(pSuite, HTTPCookieTest, testExpiryFuture);
|
||||||
CppUnit_addTest(pSuite, HTTPCookieTest, testExpiryPast);
|
CppUnit_addTest(pSuite, HTTPCookieTest, testExpiryPast);
|
||||||
|
CppUnit_addTest(pSuite, HTTPCookieTest, testIgnoreExtraAttributes);
|
||||||
|
|
||||||
return pSuite;
|
return pSuite;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ public:
|
|||||||
void testExpiryFuture();
|
void testExpiryFuture();
|
||||||
void testExpiryPast();
|
void testExpiryPast();
|
||||||
void testCookieExpiry(Poco::DateTime expiryTime);
|
void testCookieExpiry(Poco::DateTime expiryTime);
|
||||||
|
void testIgnoreExtraAttributes();
|
||||||
|
|
||||||
void setUp();
|
void setUp();
|
||||||
void tearDown();
|
void tearDown();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user