[libsoup/hsts: 94/101] Add test for duplicated directives
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/hsts: 94/101] Add test for duplicated directives
- Date: Thu, 20 Sep 2018 14:27:21 +0000 (UTC)
commit fe81f84e279ba8a85dc1951bbe8395b4f8bb542e
Author: Claudio Saavedra <csaavedra igalia com>
Date: Fri Sep 14 10:34:34 2018 +0300
Add test for duplicated directives
This test is commented out because the implementation will
not ignore headers with duplicated parameters.
tests/hsts-test.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/tests/hsts-test.c b/tests/hsts-test.c
index a7afae1a..6e12d833 100644
--- a/tests/hsts-test.c
+++ b/tests/hsts-test.c
@@ -82,7 +82,7 @@ server_callback (SoupServer *server, SoupMessage *msg,
soup_message_headers_append (msg->response_headers,
"Strict-Transport-Security",
" max-age=3600; includeDomains; foo");
- } else if (strcmp (path, "/extra-values-2") == 0) {
+ } else if (strcmp (path, "/duplicated-directives") == 0) {
soup_message_headers_append (msg->response_headers,
"Strict-Transport-Security",
"max-age=3600; includeDomains; includeDomains");
@@ -337,6 +337,15 @@ do_hsts_extra_values_test (void)
}
}
+static void
+do_hsts_duplicated_directives_test (void)
+{
+ SoupSession *session = hsts_session_new (NULL);
+ session_get_uri (session, "https://localhost/duplicated-directives", SOUP_STATUS_OK);
+ session_get_uri (session, "http://localhost", SOUP_STATUS_MOVED_PERMANENTLY);
+ soup_test_session_abort_unref (session);
+}
+
static void
do_hsts_case_insensitive_header_test (void)
{
@@ -434,6 +443,9 @@ main (int argc, char **argv)
g_test_add_func ("/hsts/missing-values", do_hsts_missing_values_test);
g_test_add_func ("/hsts/invalid-values", do_hsts_invalid_values_test);
g_test_add_func ("/hsts/extra-values", do_hsts_extra_values_test);
+ /* This test is skipped because soup_header_parse_semi_param_list() does not
+ take into account duplicated directives/parameters. */
+ /* g_test_add_func ("/hsts/duplicated-directives", do_hsts_duplicated_directives_test); */
g_test_add_func ("/hsts/case-insensitive-header", do_hsts_case_insensitive_header_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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]