[libsoup/hsts: 90/101] Add a test for case-insensitivity of the headers



commit 8ee750534f921cae7c80f2dac0156ebf7c5ce34b
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Thu Aug 30 15:26:56 2018 +0300

    Add a test for case-insensitivity of the headers

 tests/hsts-test.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/tests/hsts-test.c b/tests/hsts-test.c
index 1e5f65fc..54981fae 100644
--- a/tests/hsts-test.c
+++ b/tests/hsts-test.c
@@ -86,6 +86,10 @@ server_callback  (SoupServer *server, SoupMessage *msg,
                        soup_message_headers_append (msg->response_headers,
                                                     "Strict-Transport-Security",
                                                     "max-age=3600; includeDomains; includeDomains");
+               } else if (strcmp (path, "/case-insensitive-header") == 0) {
+                       soup_message_headers_append (msg->response_headers,
+                                                    "STRICT-TRANSPORT-SECURITY",
+                                                    "max-age=3600");
                } else if (strcmp (path, "/case-insensitive-directives") == 0) {
                        soup_message_headers_append (msg->response_headers,
                                                     "Strict-Transport-Security",
@@ -331,6 +335,15 @@ do_hsts_extra_values_test (void)
        }
 }
 
+static void
+do_hsts_case_insensitive_header_test (void)
+{
+       SoupSession *session = hsts_session_new (NULL);
+       session_get_uri (session, "https://localhost/case-insensitive-header";, SOUP_STATUS_OK);
+       session_get_uri (session, "http://localhost";, SOUP_STATUS_OK);
+       soup_test_session_abort_unref (session);
+}
+
 static void
 do_hsts_case_insensitive_directives_test (void)
 {
@@ -419,6 +432,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);
+       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);
        g_test_add_func ("/hsts/ip-address", do_hsts_ip_address_test);


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