summaryrefslogtreecommitdiff
path: root/tests/hsts-test.c
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2018-08-29 16:45:16 +0300
committerClaudio Saavedra <csaavedra@igalia.com>2019-05-22 14:59:14 +0000
commitafb268be05071b8b74b2fa3c4b3b3e07df8548f4 (patch)
tree56027aa6a39c5df91bce1a58dc2945d84c3541dc /tests/hsts-test.c
parent08424cf79dcbfaf62c9cf11c0ef63519609157b3 (diff)
downloadlibsoup-afb268be05071b8b74b2fa3c4b3b3e07df8548f4.tar.gz
Add test for optional quotations in the STS header
Diffstat (limited to 'tests/hsts-test.c')
-rw-r--r--tests/hsts-test.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/hsts-test.c b/tests/hsts-test.c
index bc5a66bf..a372848e 100644
--- a/tests/hsts-test.c
+++ b/tests/hsts-test.c
@@ -87,6 +87,10 @@ server_callback (SoupServer *server, SoupMessage *msg,
soup_message_headers_append (msg->response_headers,
"Strict-Transport-Security",
"MAX-AGE=3600; includesubdomains");
+ } else if (strcmp (path, "/optional-quotations") == 0) {
+ soup_message_headers_append (msg->response_headers,
+ "Strict-Transport-Security",
+ "max-age=\"31536000\"");
}
}
}
@@ -324,6 +328,17 @@ do_hsts_case_insensitive_directives_test (void)
}
static void
+do_hsts_optional_quotations_test (void)
+{
+ SoupSession *session = hsts_session_new (NULL);
+
+ session_get_uri (session, "https://localhost/optional-quotations", SOUP_STATUS_OK);
+ session_get_uri (session, "http://localhost", SOUP_STATUS_OK);
+
+ soup_test_session_abort_unref (session);
+}
+
+static void
do_hsts_ip_address_test (void)
{
SoupSession *session = hsts_session_new (NULL);
@@ -391,6 +406,7 @@ main (int argc, char **argv)
g_test_add_func ("/hsts/invalid-values", do_hsts_invalid_values_test);
g_test_add_func ("/hsts/extra-values", do_hsts_extra_values_test);
g_test_add_func ("/hsts/case-insensitive-directives", do_hsts_case_insensitive_directives_test);
+ g_test_add_func ("/hsts/optional-quotations", do_hsts_optional_quotations_test);
g_test_add_func ("/hsts/ip-address", do_hsts_ip_address_test);
g_test_add_func ("/hsts/utf8-address", do_hsts_utf8_address_test);
g_test_add_func ("/hsts/session-policy", do_hsts_session_policy_test);