[libsoup/hsts: 33/36] Uncomment the duplicate STS header test



commit f0e32a232346c3e1538cbeb3bd16d4df36616801
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Mon Sep 24 18:03:17 2018 +0300

    Uncomment the duplicate STS header test
    
    Since we can use the strict header parsing method we can discard
    headers with duplicate parameters.

 libsoup/soup-hsts-policy.c | 5 ++++-
 tests/hsts-test.c          | 4 +---
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/libsoup/soup-hsts-policy.c b/libsoup/soup-hsts-policy.c
index a3a52174..5395a3b5 100644
--- a/libsoup/soup-hsts-policy.c
+++ b/libsoup/soup-hsts-policy.c
@@ -271,7 +271,10 @@ soup_hsts_policy_new_from_response (SoupMessage *msg)
 
                uri = soup_message_get_uri (msg);
 
-               params = soup_header_parse_semi_param_list (value);
+               params = soup_header_parse_semi_param_list_strict (value);
+
+               if (!params)
+                       return NULL;
 
                max_age_str = g_hash_table_lookup (params, "max-age");
 
diff --git a/tests/hsts-test.c b/tests/hsts-test.c
index 0e958bd0..85a80c9d 100644
--- a/tests/hsts-test.c
+++ b/tests/hsts-test.c
@@ -466,9 +466,7 @@ 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/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]