[libsoup/hsts: 13/24] Add test for optional quotations in the STS header



commit 9777a96a8d27161b0894b1b7bebaf0557154e1ee
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Wed Aug 29 16:45:16 2018 +0300

    Add test for optional quotations in the STS header

 tests/hsts-test.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
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\"");
                }
        }
 }
@@ -323,6 +327,17 @@ do_hsts_case_insensitive_directives_test (void)
        soup_test_session_abort_unref (session);
 }
 
+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)
 {
@@ -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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]