mirror of
https://github.com/aria2/aria2.git
synced 2026-04-02 02:38:50 +00:00
Allow subsecond value in ns cookie.txt file's expiry time field
This commit is contained in:
@@ -328,10 +328,10 @@ void CookieStorageTest::testLoad()
|
||||
c = cookies[3];
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("TAX"), c->getName());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("1000"), c->getValue());
|
||||
CPPUNIT_ASSERT((time_t)INT32_MAX <= c->getExpiryTime());
|
||||
CPPUNIT_ASSERT_EQUAL((time_t)1463304912, c->getExpiryTime());
|
||||
CPPUNIT_ASSERT(c->getPersistent());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("/"), c->getPath());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("overflow"), c->getDomain());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("something"), c->getDomain());
|
||||
CPPUNIT_ASSERT(!c->getSecure());
|
||||
}
|
||||
|
||||
|
||||
@@ -69,9 +69,9 @@ void NsCookieParserTest::testParse()
|
||||
c = cookies[3].get();
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("TAX"), c->getName());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("1000"), c->getValue());
|
||||
CPPUNIT_ASSERT((time_t)INT32_MAX <= c->getExpiryTime());
|
||||
CPPUNIT_ASSERT_EQUAL((time_t)1463304912, c->getExpiryTime());
|
||||
CPPUNIT_ASSERT(c->getPersistent());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("overflow"), c->getDomain());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("something"), c->getDomain());
|
||||
CPPUNIT_ASSERT(c->getHostOnly());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("/"), c->getPath());
|
||||
CPPUNIT_ASSERT(!c->getSecure());
|
||||
|
||||
@@ -66,6 +66,7 @@ class UtilTest2 : public CppUnit::TestFixture {
|
||||
CPPUNIT_TEST(testInPrivateAddress);
|
||||
CPPUNIT_TEST(testSecfmt);
|
||||
CPPUNIT_TEST(testTlsHostnameMatch);
|
||||
CPPUNIT_TEST(testParseDoubleNoThrow);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
private:
|
||||
@@ -115,6 +116,7 @@ public:
|
||||
void testInPrivateAddress();
|
||||
void testSecfmt();
|
||||
void testTlsHostnameMatch();
|
||||
void testParseDoubleNoThrow();
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(UtilTest2);
|
||||
@@ -978,4 +980,21 @@ void UtilTest2::testTlsHostnameMatch()
|
||||
CPPUNIT_ASSERT(!util::tlsHostnameMatch("xn--*.a.b", "xn--c.a.b"));
|
||||
}
|
||||
|
||||
void UtilTest2::testParseDoubleNoThrow()
|
||||
{
|
||||
double n;
|
||||
|
||||
CPPUNIT_ASSERT(util::parseDoubleNoThrow(n, " 123 "));
|
||||
CPPUNIT_ASSERT_EQUAL(123., n);
|
||||
|
||||
CPPUNIT_ASSERT(util::parseDoubleNoThrow(n, "3.14"));
|
||||
CPPUNIT_ASSERT_EQUAL(3.14, n);
|
||||
|
||||
CPPUNIT_ASSERT(util::parseDoubleNoThrow(n, "-3.14"));
|
||||
CPPUNIT_ASSERT_EQUAL(-3.14, n);
|
||||
|
||||
CPPUNIT_ASSERT(!util::parseDoubleNoThrow(n, ""));
|
||||
CPPUNIT_ASSERT(!util::parseDoubleNoThrow(n, "123x"));
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
@@ -5,5 +5,5 @@ expired FALSE / FALSE 1000 user me
|
||||
|
||||
192.168.0.1 TRUE /cgi-bin FALSE 0 passwd secret
|
||||
badformat
|
||||
overflow FALSE / FALSE 9223372036854775807 TAX 1000
|
||||
.example.org TRUE / FALSE 2147483647 novalue
|
||||
something FALSE / FALSE 1463304912.5 TAX 1000
|
||||
.example.org TRUE / FALSE 2147483647.123 novalue
|
||||
|
||||
Reference in New Issue
Block a user