mirror of
https://github.com/curl/curl.git
synced 2026-07-24 18:47:18 +03:00
parent
75955c0851
commit
0afb52a0cd
16 changed files with 182 additions and 168 deletions
|
|
@ -32,7 +32,7 @@ static const size_t slots = 3;
|
|||
static void t1603_mydtor(void *p)
|
||||
{
|
||||
/* Data are statically allocated */
|
||||
(void)p;
|
||||
(void)p;
|
||||
}
|
||||
|
||||
static size_t elem_dtor_calls;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ static CURLcode test_unit1651(const char *arg)
|
|||
#if defined(USE_GNUTLS) || defined(USE_SCHANNEL)
|
||||
|
||||
/* cert captured from gdb when connecting to curl.se on October 26
|
||||
2018 */
|
||||
2018.
|
||||
!checksrc! disable CLOSEBRACE 1 */
|
||||
static unsigned char cert[] = {
|
||||
0x30, 0x82, 0x0F, 0x5B, 0x30, 0x82, 0x0E, 0x43, 0xA0, 0x03, 0x02, 0x01, 0x02,
|
||||
0x02, 0x0C, 0x08, 0x77, 0x99, 0x2C, 0x6B, 0x67, 0xE1, 0x18, 0xD6, 0x66, 0x66,
|
||||
|
|
|
|||
|
|
@ -61,32 +61,34 @@ static CURLcode test_unit1656(const char *arg)
|
|||
UNITTEST_BEGIN_SIMPLE
|
||||
|
||||
static const struct test_spec test_specs[] = {
|
||||
{ "190321134340", "1903-21-13 43:40:00", CURLE_OK },
|
||||
{ "", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "0WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "19032113434", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "19032113434WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "190321134340.", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "190321134340.1", "1903-21-13 43:40:00.1", CURLE_OK },
|
||||
{ "19032113434017.0", "1903-21-13 43:40:17", CURLE_OK },
|
||||
{ "19032113434017.01", "1903-21-13 43:40:17.01", CURLE_OK },
|
||||
{ "19032113434003.001", "1903-21-13 43:40:03.001", CURLE_OK },
|
||||
{ "19032113434003.090", "1903-21-13 43:40:03.09", CURLE_OK },
|
||||
{ "190321134340Z", "1903-21-13 43:40:00 GMT", CURLE_OK },
|
||||
{ "19032113434017.0Z", "1903-21-13 43:40:17 GMT", CURLE_OK },
|
||||
{ "19032113434017.01Z", "1903-21-13 43:40:17.01 GMT", CURLE_OK },
|
||||
{ "19032113434003.001Z", "1903-21-13 43:40:03.001 GMT", CURLE_OK },
|
||||
{ "19032113434003.090Z", "1903-21-13 43:40:03.09 GMT", CURLE_OK },
|
||||
{ "190321134340CET", "1903-21-13 43:40:00 CET", CURLE_OK },
|
||||
{ "19032113434017.0CET", "1903-21-13 43:40:17 CET", CURLE_OK },
|
||||
{ "19032113434017.01CET", "1903-21-13 43:40:17.01 CET", CURLE_OK },
|
||||
{ "190321134340+02:30", "1903-21-13 43:40:00 UTC+02:30", CURLE_OK },
|
||||
{ "19032113434017.0+02:30", "1903-21-13 43:40:17 UTC+02:30", CURLE_OK },
|
||||
{ "19032113434017.01+02:30", "1903-21-13 43:40:17.01 UTC+02:30", CURLE_OK },
|
||||
{ "190321134340-3", "1903-21-13 43:40:00 UTC-3", CURLE_OK },
|
||||
{ "19032113434017.0-04", "1903-21-13 43:40:17 UTC-04", CURLE_OK },
|
||||
{ "19032113434017.01-01:10", "1903-21-13 43:40:17.01 UTC-01:10", CURLE_OK },
|
||||
{ "190321134340", "1903-21-13 43:40:00", CURLE_OK },
|
||||
{ "", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "0WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "19032113434", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "19032113434WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "190321134340.", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "190321134340.1", "1903-21-13 43:40:00.1", CURLE_OK },
|
||||
{ "19032113434017.0", "1903-21-13 43:40:17", CURLE_OK },
|
||||
{ "19032113434017.01", "1903-21-13 43:40:17.01", CURLE_OK },
|
||||
{ "19032113434003.001", "1903-21-13 43:40:03.001", CURLE_OK },
|
||||
{ "19032113434003.090", "1903-21-13 43:40:03.09", CURLE_OK },
|
||||
{ "190321134340Z", "1903-21-13 43:40:00 GMT", CURLE_OK },
|
||||
{ "19032113434017.0Z", "1903-21-13 43:40:17 GMT", CURLE_OK },
|
||||
{ "19032113434017.01Z", "1903-21-13 43:40:17.01 GMT", CURLE_OK },
|
||||
{ "19032113434003.001Z", "1903-21-13 43:40:03.001 GMT", CURLE_OK },
|
||||
{ "19032113434003.090Z", "1903-21-13 43:40:03.09 GMT", CURLE_OK },
|
||||
{ "190321134340CET", "1903-21-13 43:40:00 CET", CURLE_OK },
|
||||
{ "19032113434017.0CET", "1903-21-13 43:40:17 CET", CURLE_OK },
|
||||
{ "19032113434017.01CET", "1903-21-13 43:40:17.01 CET", CURLE_OK },
|
||||
{ "190321134340+02:30", "1903-21-13 43:40:00 UTC+02:30", CURLE_OK },
|
||||
{ "19032113434017.0+02:30", "1903-21-13 43:40:17 UTC+02:30", CURLE_OK },
|
||||
{ "19032113434017.01+02:30", "1903-21-13 43:40:17.01 UTC+02:30",
|
||||
CURLE_OK },
|
||||
{ "190321134340-3", "1903-21-13 43:40:00 UTC-3", CURLE_OK },
|
||||
{ "19032113434017.0-04", "1903-21-13 43:40:17 UTC-04", CURLE_OK },
|
||||
{ "19032113434017.01-01:10", "1903-21-13 43:40:17.01 UTC-01:10",
|
||||
CURLE_OK },
|
||||
};
|
||||
|
||||
size_t i;
|
||||
|
|
|
|||
|
|
@ -58,56 +58,56 @@ static CURLcode test_unit1660(const char *arg)
|
|||
};
|
||||
|
||||
static const struct testit headers[] = {
|
||||
/* two entries read from disk cache, verify first */
|
||||
{ "-", "readfrom.example", NULL, CURLE_OK},
|
||||
{ "-", "old.example", NULL, CURLE_OK},
|
||||
/* delete the remaining one read from disk */
|
||||
{ "readfrom.example", NULL, "max-age=\"0\"", CURLE_OK},
|
||||
/* two entries read from disk cache, verify first */
|
||||
{ "-", "readfrom.example", NULL, CURLE_OK},
|
||||
{ "-", "old.example", NULL, CURLE_OK},
|
||||
/* delete the remaining one read from disk */
|
||||
{ "readfrom.example", NULL, "max-age=\"0\"", CURLE_OK},
|
||||
|
||||
{ "example.com", NULL, "max-age=\"31536000\"\r\n", CURLE_OK },
|
||||
{ "example.com", NULL, "max-age=\"21536000\"\r\n", CURLE_OK },
|
||||
{ "example.com", NULL, "max-age=\"21536000\"; \r\n", CURLE_OK },
|
||||
{ "example.com", NULL, "max-age=\"21536000\"; includeSubDomains\r\n",
|
||||
CURLE_OK },
|
||||
{ "example.org", NULL, "max-age=\"31536000\"\r\n", CURLE_OK },
|
||||
{ "this.example", NULL, "max=\"31536\";", CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "this.example", NULL, "max-age=\"31536", CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "this.example", NULL, "max-age=31536\"", CURLE_OK },
|
||||
/* max-age=0 removes the entry */
|
||||
{ "this.example", NULL, "max-age=0", CURLE_OK },
|
||||
{ "another.example", NULL, "includeSubDomains; ",
|
||||
CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "example.com", NULL, "max-age=\"31536000\"\r\n", CURLE_OK },
|
||||
{ "example.com", NULL, "max-age=\"21536000\"\r\n", CURLE_OK },
|
||||
{ "example.com", NULL, "max-age=\"21536000\"; \r\n", CURLE_OK },
|
||||
{ "example.com", NULL, "max-age=\"21536000\"; includeSubDomains\r\n",
|
||||
CURLE_OK },
|
||||
{ "example.org", NULL, "max-age=\"31536000\"\r\n", CURLE_OK },
|
||||
{ "this.example", NULL, "max=\"31536\";", CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "this.example", NULL, "max-age=\"31536", CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "this.example", NULL, "max-age=31536\"", CURLE_OK },
|
||||
/* max-age=0 removes the entry */
|
||||
{ "this.example", NULL, "max-age=0", CURLE_OK },
|
||||
{ "another.example", NULL, "includeSubDomains; ",
|
||||
CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
|
||||
/* Two max-age is illegal */
|
||||
{ "example.com", NULL,
|
||||
"max-age=\"21536000\"; includeSubDomains; max-age=\"3\";",
|
||||
CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
/* Two includeSubDomains is illegal */
|
||||
{ "2.example.com", NULL,
|
||||
"max-age=\"21536000\"; includeSubDomains; includeSubDomains;",
|
||||
CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
/* use an unknown directive "include" that should be ignored */
|
||||
{ "3.example.com", NULL, "max-age=\"21536000\"; include; includeSubDomains;",
|
||||
CURLE_OK },
|
||||
/* remove the "3.example.com" one, should still match the example.com */
|
||||
{ "3.example.com", NULL, "max-age=\"0\"; includeSubDomains;",
|
||||
CURLE_OK },
|
||||
{ "-", "foo.example.com", NULL, CURLE_OK},
|
||||
{ "-", "foo.xample.com", NULL, CURLE_OK},
|
||||
/* Two max-age is illegal */
|
||||
{ "example.com", NULL,
|
||||
"max-age=\"21536000\"; includeSubDomains; max-age=\"3\";",
|
||||
CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
/* Two includeSubDomains is illegal */
|
||||
{ "2.example.com", NULL,
|
||||
"max-age=\"21536000\"; includeSubDomains; includeSubDomains;",
|
||||
CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
/* use an unknown directive "include" that should be ignored */
|
||||
{ "3.example.com", NULL,
|
||||
"max-age=\"21536000\"; include; includeSubDomains;", CURLE_OK },
|
||||
/* remove the "3.example.com" one, should still match the example.com */
|
||||
{ "3.example.com", NULL, "max-age=\"0\"; includeSubDomains;",
|
||||
CURLE_OK },
|
||||
{ "-", "foo.example.com", NULL, CURLE_OK},
|
||||
{ "-", "foo.xample.com", NULL, CURLE_OK},
|
||||
|
||||
/* should not match */
|
||||
{ "example.net", "forexample.net", "max-age=\"31536000\"\r\n", CURLE_OK },
|
||||
/* should not match */
|
||||
{ "example.net", "forexample.net", "max-age=\"31536000\"\r\n", CURLE_OK },
|
||||
|
||||
/* should not match either, since forexample.net is not in the example.net
|
||||
domain */
|
||||
{ "example.net", "forexample.net",
|
||||
"max-age=\"31536000\"; includeSubDomains\r\n", CURLE_OK },
|
||||
/* remove example.net again */
|
||||
{ "example.net", NULL, "max-age=\"0\"; includeSubDomains\r\n", CURLE_OK },
|
||||
/* should not match either, since forexample.net is not in the example.net
|
||||
domain */
|
||||
{ "example.net", "forexample.net",
|
||||
"max-age=\"31536000\"; includeSubDomains\r\n", CURLE_OK },
|
||||
/* remove example.net again */
|
||||
{ "example.net", NULL, "max-age=\"0\"; includeSubDomains\r\n", CURLE_OK },
|
||||
|
||||
/* make this live for 7 seconds */
|
||||
{ "expire.example", NULL, "max-age=\"7\"\r\n", CURLE_OK },
|
||||
{ NULL, NULL, NULL, CURLE_OK }
|
||||
/* make this live for 7 seconds */
|
||||
{ "expire.example", NULL, "max-age=\"7\"\r\n", CURLE_OK },
|
||||
{ NULL, NULL, NULL, CURLE_OK }
|
||||
};
|
||||
|
||||
CURLcode result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue