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



commit a316ae711aad13562d8534d374c8206c12fa0b0e
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 0b291732..6799a7e2 100644
--- a/tests/hsts-test.c
+++ b/tests/hsts-test.c
@@ -85,6 +85,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",
@@ -332,6 +336,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)
 {
@@ -420,6 +433,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]