[libsoup/nacho/invalid-percent-encoding-path: 1/2] test: add test about invalid percent encoding paths
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/nacho/invalid-percent-encoding-path: 1/2] test: add test about invalid percent encoding paths
- Date: Mon, 31 Jan 2022 11:47:48 +0000 (UTC)
commit 49004e3be3ca1200f01e161aeaa8773ed7ec1990
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date: Mon Jan 31 12:44:11 2022 +0100
test: add test about invalid percent encoding paths
tests/server-test.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
---
diff --git a/tests/server-test.c b/tests/server-test.c
index 2f9c4997..8f81c256 100644
--- a/tests/server-test.c
+++ b/tests/server-test.c
@@ -246,6 +246,28 @@ do_dot_dot_test (ServerData *sd, gconstpointer test_data)
soup_test_session_abort_unref (session);
}
+static void
+do_invalid_percent_encoding_paths_test (ServerData *sd, gconstpointer test_data)
+{
+ SoupSession *session;
+ SoupMessage *msg;
+ GUri *uri;
+
+ g_test_bug ("262");
+
+ session = soup_test_session_new (NULL);
+
+ uri = g_uri_parse_relative (sd->base_uri, "/TestString1%00%0aTestString2", SOUP_HTTP_URI_FLAGS, NULL);
+ msg = soup_message_new_from_uri ("GET", uri);
+ g_uri_unref (uri);
+
+ soup_test_session_send_message (session, msg);
+ soup_test_assert_message_status (msg, SOUP_STATUS_BAD_REQUEST);
+ g_object_unref (msg);
+
+ soup_test_session_abort_unref (session);
+}
+
static void
ipv6_server_callback (SoupServer *server,
SoupServerMessage *msg,
@@ -1304,6 +1326,8 @@ main (int argc, char **argv)
server_setup, do_star_test, server_teardown);
g_test_add ("/server/..-in-path", ServerData, NULL,
server_setup, do_dot_dot_test, server_teardown);
+ g_test_add ("/server/invalid-percent-encoding-paths", ServerData, NULL,
+ server_setup, do_invalid_percent_encoding_paths_test, server_teardown);
g_test_add ("/server/ipv6", ServerData, NULL,
NULL, do_ipv6_test, server_teardown);
g_test_add ("/server/multi/port", ServerData, NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]