diff options
| author | Gustavo Noronha Silva <gns@gnome.org> | 2009-06-22 15:07:44 -0300 |
|---|---|---|
| committer | Gustavo Noronha Silva <gns@gnome.org> | 2009-06-22 15:07:44 -0300 |
| commit | 49a7fdb3785b16bd3015e3e2fa4f3fd5916a347a (patch) | |
| tree | a2961d848e2d056878bf5bfbc4db6dbcd246a02e | |
| parent | 780e6618527232770cbbb779285d281c4d7c5d5a (diff) | |
| download | libsoup-49a7fdb3785b16bd3015e3e2fa4f3fd5916a347a.tar.gz | |
Test that only the last Content-Type header is used
The content type sniffing spec says that only the last Content-Type
header should be used.
| -rw-r--r-- | tests/sniffing-test.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/sniffing-test.c b/tests/sniffing-test.c index 048ba424..14a976f1 100644 --- a/tests/sniffing-test.c +++ b/tests/sniffing-test.c @@ -125,6 +125,33 @@ server_callback (SoupServer *server, SoupMessage *msg, g_strfreev (components); } + + if (g_str_has_prefix (path, "/multiple_headers/")) { + char *base_name = g_path_get_basename (path); + char *file_name = g_strdup_printf ("resources/%s", base_name); + + g_file_get_contents (file_name, + &contents, &length, + &error); + + g_free (base_name); + g_free (file_name); + + if (error) { + g_error ("%s", error->message); + g_error_free (error); + exit (1); + } + + soup_message_set_response (msg, "text/xml", + SOUP_MEMORY_TAKE, + contents, + length); + + soup_message_headers_append (msg->response_headers, + "Content-Type", "text/plain"); + } + } static gboolean @@ -365,6 +392,10 @@ main (int argc, char **argv) test_sniffing ("/type/image_png/home.gif", "image/gif"); + /* The spec tells us to only use the last Content-Type header */ + + test_sniffing ("/multiple_headers/home.gif", "image/gif"); + soup_uri_free (base_uri); test_cleanup (); |
