diff options
Diffstat (limited to 'tests/redirect-test.c')
-rw-r--r-- | tests/redirect-test.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/redirect-test.c b/tests/redirect-test.c index 5bb37e95..e863068c 100644 --- a/tests/redirect-test.c +++ b/tests/redirect-test.c @@ -93,6 +93,12 @@ static struct { { "GET", "/", 200 }, { NULL } } }, { { { "POST", "/307", 307 }, + { NULL } } }, + + /* Test behavior with recoverably-bad Location header + */ + { { { "GET", "/bad", 302 }, + { "GET", "/bad%20with%20spaces", 200 }, { NULL } } } }; static const int n_tests = G_N_ELEMENTS (tests); @@ -206,6 +212,19 @@ server_callback (SoupServer *server, SoupMessage *msg, char *remainder; guint status_code; + if (g_str_has_prefix (path, "/bad")) { + if (!strcmp (path, "/bad")) { + soup_message_set_status (msg, SOUP_STATUS_FOUND); + soup_message_headers_replace (msg->response_headers, + "Location", + "/bad with spaces"); + } else if (!strcmp (path, "/bad with spaces")) + soup_message_set_status (msg, SOUP_STATUS_OK); + else + soup_message_set_status (msg, SOUP_STATUS_NOT_FOUND); + return; + } + if (!strcmp (path, "/")) { if (msg->method != SOUP_METHOD_GET && msg->method != SOUP_METHOD_HEAD) { |