[libsoup/hsts: 17/36] Add test for optional quotations in the STS header



commit 016888a0111644532ca096b32d4d14779a130108
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 0207823d..3562615f 100644
--- a/tests/hsts-test.c
+++ b/tests/hsts-test.c
@@ -88,6 +88,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\"");
                }
        }
 }
@@ -322,6 +326,17 @@ do_hsts_case_insensitive_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)
 {
@@ -390,6 +405,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", do_hsts_case_insensitive_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]