From a1591e15bf2c4a690e79698cdd078f6ed01e48d3 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Sat, 15 Mar 2014 14:19:45 -0400 Subject: tests: use g_test_bug() to annotate test cases --- tests/auth-test.c | 8 ++ tests/cache-test.c | 4 + tests/chunk-test.c | 4 +- tests/coding-test.c | 28 ++++++ tests/connection-test.c | 8 ++ tests/cookies-test.c | 2 + tests/date.c | 228 ++++++++++++++++++++++++++++-------------------- tests/forms-test.c | 2 + tests/header-parsing.c | 164 +++++++++++++++++----------------- tests/misc-test.c | 30 ++++++- tests/no-ssl-test.c | 6 +- tests/ntlm-test.c | 2 + tests/proxy-test.c | 21 +++-- tests/redirect-test.c | 77 ++++++++-------- tests/requester-test.c | 12 +++ tests/server-test.c | 8 ++ tests/session-test.c | 4 + tests/sniffing-test.c | 4 + tests/socket-test.c | 2 + tests/ssl-test.c | 8 ++ tests/streaming-test.c | 2 + tests/test-utils.c | 1 + tests/tld-test.c | 3 + tests/uri-parsing.c | 148 ++++++++++++++++--------------- tests/xmlrpc-test.c | 2 + 25 files changed, 485 insertions(+), 293 deletions(-) diff --git a/tests/auth-test.c b/tests/auth-test.c index cb9f07fb..8ed5cead 100644 --- a/tests/auth-test.c +++ b/tests/auth-test.c @@ -292,6 +292,8 @@ do_pipelined_auth_test (void) char *uri; int i; + g_test_bug ("271540"); + SOUP_TEST_SKIP_IF_NO_APACHE; session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL); @@ -632,6 +634,7 @@ do_async_auth_bad_password_test (void) /* Test that giving the wrong password doesn't cause multiple * authenticate signals the second time. */ + g_test_bug ("522601"); SOUP_TEST_SKIP_IF_NO_APACHE; @@ -684,6 +687,7 @@ do_async_auth_no_password_test (void) /* Test that giving no password doesn't cause multiple * authenticate signals the second time. */ + g_test_bug ("583462"); SOUP_TEST_SKIP_IF_NO_APACHE; @@ -852,6 +856,8 @@ do_select_auth_test (void) SoupAuthDomain *basic_auth_domain, *digest_auth_domain; SoupURI *uri; + g_test_bug ("562339"); + /* It doesn't seem to be possible to configure Apache to serve * multiple auth types for a single URL. So we have to use * SoupServer here. We know that SoupServer handles the server @@ -1117,6 +1123,8 @@ do_disappearing_auth_test (void) SoupSession *session; int counter; + g_test_bug ("https://bugzilla.redhat.com/show_bug.cgi?id=916224"); + server = soup_test_server_new (FALSE); soup_server_add_handler (server, NULL, server_callback, NULL, NULL); diff --git a/tests/cache-test.c b/tests/cache-test.c index c499a776..3478f377 100644 --- a/tests/cache-test.c +++ b/tests/cache-test.c @@ -437,6 +437,8 @@ do_cancel_test (gconstpointer data) char *body1, *body2; guint flags; + g_test_bug ("692310"); + cache_dir = g_dir_make_tmp ("cache-test-XXXXXX", NULL); debug_printf (2, " Caching to %s\n", cache_dir); cache = soup_cache_new (cache_dir, SOUP_CACHE_SINGLE_USER); @@ -522,6 +524,8 @@ do_refcounting_test (gconstpointer data) guint flags; GMainLoop *loop; + g_test_bug ("682527"); + cache_dir = g_dir_make_tmp ("cache-test-XXXXXX", NULL); debug_printf (2, " Caching to %s\n", cache_dir); cache = soup_cache_new (cache_dir, SOUP_CACHE_SINGLE_USER); diff --git a/tests/chunk-test.c b/tests/chunk-test.c index 7f4fe886..864f8620 100644 --- a/tests/chunk-test.c +++ b/tests/chunk-test.c @@ -282,7 +282,7 @@ do_response_test (void) } /* Make sure TEMPORARY buffers are handled properly with non-accumulating - * message bodies. Part of https://bugs.webkit.org/show_bug.cgi?id=18343 + * message bodies. */ static void @@ -314,6 +314,8 @@ do_temporary_test (void) char *client_md5; const char *server_md5; + g_test_bug ("https://bugs.webkit.org/show_bug.cgi?id=18343"); + msg = soup_message_new_from_uri ("PUT", base_uri); soup_message_body_append (msg->request_body, SOUP_MEMORY_TEMPORARY, "one\r\n", 5); diff --git a/tests/coding-test.c b/tests/coding-test.c index d400ca71..0445f632 100644 --- a/tests/coding-test.c +++ b/tests/coding-test.c @@ -238,6 +238,9 @@ do_coding_test_gzip (CodingTestData *data, gconstpointer test_data) static void do_coding_test_gzip_with_junk (CodingTestData *data, gconstpointer test_data) { + g_test_bug ("606352"); + g_test_bug ("676477"); + soup_message_headers_append (data->msg->request_headers, "X-Test-Options", "trailing-junk"); @@ -248,6 +251,8 @@ do_coding_test_gzip_with_junk (CodingTestData *data, gconstpointer test_data) static void do_coding_test_gzip_bad_server (CodingTestData *data, gconstpointer test_data) { + g_test_bug ("613361"); + soup_message_headers_append (data->msg->request_headers, "X-Test-Options", "force-encode"); @@ -273,6 +278,9 @@ do_coding_test_deflate (CodingTestData *data, gconstpointer test_data) static void do_coding_test_deflate_with_junk (CodingTestData *data, gconstpointer test_data) { + g_test_bug ("606352"); + g_test_bug ("676477"); + soup_message_headers_append (data->msg->request_headers, "X-Test-Options", "prefer-deflate-zlib, trailing-junk"); soup_session_send_message (data->session, data->msg); @@ -283,6 +291,8 @@ do_coding_test_deflate_with_junk (CodingTestData *data, gconstpointer test_data) static void do_coding_test_deflate_bad_server (CodingTestData *data, gconstpointer test_data) { + g_test_bug ("613361"); + soup_message_headers_append (data->msg->request_headers, "X-Test-Options", "force-encode, prefer-deflate-zlib"); soup_session_send_message (data->session, data->msg); @@ -303,6 +313,8 @@ do_coding_test_deflate_raw (CodingTestData *data, gconstpointer test_data) static void do_coding_test_deflate_raw_bad_server (CodingTestData *data, gconstpointer test_data) { + g_test_bug ("613361"); + soup_message_headers_append (data->msg->request_headers, "X-Test-Options", "force-encode, prefer-deflate-raw"); soup_session_send_message (data->session, data->msg); @@ -379,6 +391,9 @@ do_coding_req_test_gzip (CodingTestData *data, gconstpointer test_data) static void do_coding_req_test_gzip_with_junk (CodingTestData *data, gconstpointer test_data) { + g_test_bug ("606352"); + g_test_bug ("676477"); + soup_message_headers_append (data->msg->request_headers, "X-Test-Options", "trailing-junk"); @@ -388,6 +403,8 @@ do_coding_req_test_gzip_with_junk (CodingTestData *data, gconstpointer test_data static void do_coding_req_test_gzip_bad_server (CodingTestData *data, gconstpointer test_data) { + g_test_bug ("613361"); + soup_message_headers_append (data->msg->request_headers, "X-Test-Options", "force-encode"); do_single_coding_req_test (data, "gzip", "text/plain", EXPECT_NOT_DECODED); @@ -404,6 +421,9 @@ do_coding_req_test_deflate (CodingTestData *data, gconstpointer test_data) static void do_coding_req_test_deflate_with_junk (CodingTestData *data, gconstpointer test_data) { + g_test_bug ("606352"); + g_test_bug ("676477"); + soup_message_headers_append (data->msg->request_headers, "X-Test-Options", "prefer-deflate-zlib, trailing-junk"); do_single_coding_req_test (data, "deflate", "text/plain", EXPECT_DECODED); @@ -412,6 +432,8 @@ do_coding_req_test_deflate_with_junk (CodingTestData *data, gconstpointer test_d static void do_coding_req_test_deflate_bad_server (CodingTestData *data, gconstpointer test_data) { + g_test_bug ("613361"); + soup_message_headers_append (data->msg->request_headers, "X-Test-Options", "force-encode, prefer-deflate-zlib"); do_single_coding_req_test (data, "deflate", "text/plain", EXPECT_NOT_DECODED); @@ -428,6 +450,8 @@ do_coding_req_test_deflate_raw (CodingTestData *data, gconstpointer test_data) static void do_coding_req_test_deflate_raw_bad_server (CodingTestData *data, gconstpointer test_data) { + g_test_bug ("613361"); + soup_message_headers_append (data->msg->request_headers, "X-Test-Options", "force-encode, prefer-deflate-raw"); do_single_coding_req_test (data, "deflate", "text/plain", EXPECT_NOT_DECODED); @@ -436,6 +460,8 @@ do_coding_req_test_deflate_raw_bad_server (CodingTestData *data, gconstpointer t static void do_coding_msg_empty_test (CodingTestData *data, gconstpointer test_data) { + g_test_bug ("697527"); + soup_message_headers_append (data->msg->request_headers, "X-Test-Options", "empty"); soup_session_send_message (data->session, data->msg); @@ -446,6 +472,8 @@ do_coding_msg_empty_test (CodingTestData *data, gconstpointer test_data) static void do_coding_req_empty_test (CodingTestData *data, gconstpointer test_data) { + g_test_bug ("697527"); + soup_message_headers_append (data->msg->request_headers, "X-Test-Options", "empty"); do_single_coding_req_test (data, "gzip", "text/plain", EXPECT_NOT_DECODED); diff --git a/tests/connection-test.c b/tests/connection-test.c index a72d2f0a..8f8c74be 100644 --- a/tests/connection-test.c +++ b/tests/connection-test.c @@ -166,6 +166,8 @@ do_content_length_framing_test (void) SoupURI *request_uri; goffset declared_length; + g_test_bug ("611481"); + session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL); debug_printf (1, " Content-Length larger than message body length\n"); @@ -351,6 +353,8 @@ do_persistent_connection_timeout_test (void) { SoupSession *session; + g_test_bug ("631525"); + debug_printf (1, " Async session, message API\n"); session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL); do_timeout_test_for_session (session); @@ -471,6 +475,8 @@ do_max_conns_test (void) { SoupSession *session; + g_test_bug ("634422"); + debug_printf (1, " Async session\n"); session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, SOUP_SESSION_MAX_CONNS, MAX_CONNS, @@ -548,6 +554,8 @@ do_non_persistent_connection_test (void) { SoupSession *session; + g_test_bug ("578990"); + debug_printf (1, " Async session\n"); session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL); do_non_persistent_test_for_session (session); diff --git a/tests/cookies-test.c b/tests/cookies-test.c index 2c986b5f..12529d81 100644 --- a/tests/cookies-test.c +++ b/tests/cookies-test.c @@ -105,6 +105,8 @@ do_cookies_parsing_test (void) SoupCookie *cookie; gboolean got1, got2, got3; + g_test_bug ("678753"); + session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL); soup_session_add_feature_by_type (session, SOUP_TYPE_COOKIE_JAR); jar = SOUP_COOKIE_JAR (soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR)); diff --git a/tests/date.c b/tests/date.c index 6b0ff9bb..e51fa57f 100644 --- a/tests/date.c +++ b/tests/date.c @@ -24,18 +24,40 @@ make_date (const char *strdate) return date; } +static SoupDate * +check_correct_date (const char *strdate) +{ + SoupDate *date; + + date = make_date (strdate); + if (!date) { + g_assert_nonnull (date); + return NULL; + } + + g_assert_cmpint (date->year, ==, 2004); + g_assert_cmpint (date->month, ==, 11); + g_assert_cmpint (date->day, ==, 6); + g_assert_cmpint (date->hour, ==, 8); + g_assert_cmpint (date->minute, ==, 9); + g_assert_cmpint (date->second, ==, 7); + + return date; +} + typedef struct { SoupDateFormat format; const char *date; + const char *bugref; } GoodDate; static const GoodDate good_dates[] = { - { SOUP_DATE_HTTP, "Sat, 06 Nov 2004 08:09:07 GMT" }, - { SOUP_DATE_COOKIE, "Sat, 06-Nov-2004 08:09:07 GMT" }, - { SOUP_DATE_RFC2822, "Sat, 6 Nov 2004 08:09:07 -0430" }, - { SOUP_DATE_ISO8601_COMPACT, "20041106T080907" }, - { SOUP_DATE_ISO8601_FULL, "2004-11-06T08:09:07" }, - { SOUP_DATE_ISO8601_XMLRPC, "20041106T08:09:07" } + { SOUP_DATE_HTTP, "Sat, 06 Nov 2004 08:09:07 GMT", NULL }, + { SOUP_DATE_COOKIE, "Sat, 06-Nov-2004 08:09:07 GMT", NULL }, + { SOUP_DATE_RFC2822, "Sat, 6 Nov 2004 08:09:07 -0430", "579055" }, + { SOUP_DATE_ISO8601_COMPACT, "20041106T080907", NULL }, + { SOUP_DATE_ISO8601_FULL, "2004-11-06T08:09:07", NULL }, + { SOUP_DATE_ISO8601_XMLRPC, "20041106T08:09:07", NULL } }; static void @@ -45,9 +67,13 @@ check_good (gconstpointer data) SoupDate *date; char *strdate2; - check_ok (good->date); + if (good->bugref) + g_test_bug (good->bugref); + + date = check_correct_date (good->date); + if (!date) + return; - date = make_date (good->date); strdate2 = soup_date_to_string (date, good->format); soup_date_free (date); @@ -57,82 +83,82 @@ check_good (gconstpointer data) g_free (strdate2); } -static const char *ok_dates[] = { +typedef struct { + const char *date; + const char *bugref; +} OkDate; + +static const OkDate ok_dates[] = { /* rfc1123-date, and broken variants */ - "Sat, 06 Nov 2004 08:09:07 GMT", - "Sat, 6 Nov 2004 08:09:07 GMT", - "Sat, 6 Nov 2004 08:09:07 GMT", - "Sat, 06 Nov 2004 08:09:07", - "06 Nov 2004 08:09:07 GMT", - "SAT, 06 NOV 2004 08:09:07 +1000", + { "Sat, 06 Nov 2004 08:09:07 GMT", NULL }, + { "Sat, 6 Nov 2004 08:09:07 GMT", NULL }, + { "Sat, 6 Nov 2004 08:09:07 GMT", NULL }, + { "Sat, 06 Nov 2004 08:09:07", NULL }, + { "06 Nov 2004 08:09:07 GMT", NULL }, + { "SAT, 06 NOV 2004 08:09:07 +1000", "644048" }, /* rfc850-date, and broken variants */ - "Saturday, 06-Nov-04 08:09:07 GMT", - "Saturday, 6-Nov-04 08:09:07 GMT", - "Saturday, 6-Nov-04 08:09:07 GMT", - "Saturday, 06-Nov-104 08:09:07 GMT", - "Saturday, 06-Nov-04 08:09:07", - "06-Nov-04 08:09:07 GMT", + { "Saturday, 06-Nov-04 08:09:07 GMT", NULL }, + { "Saturday, 6-Nov-04 08:09:07 GMT", NULL }, + { "Saturday, 6-Nov-04 08:09:07 GMT", NULL }, + { "Saturday, 06-Nov-104 08:09:07 GMT", NULL }, + { "Saturday, 06-Nov-04 08:09:07", NULL }, + { "06-Nov-04 08:09:07 GMT", NULL }, /* asctime-date, and broken variants */ - "Sat Nov 6 08:09:07 2004", - "Sat Nov 06 08:09:07 2004", - "Sat Nov 6 08:09:07 2004", - "Sat Nov 6 08:09:07 2004 GMT", + { "Sat Nov 6 08:09:07 2004", NULL }, + { "Sat Nov 06 08:09:07 2004", NULL }, + { "Sat Nov 6 08:09:07 2004", NULL }, + { "Sat Nov 6 08:09:07 2004 GMT", NULL }, /* ISO 8601 */ - "2004-11-06T08:09:07Z", - "20041106T08:09:07Z", - "20041106T08:09:07+00:00", - "20041106T080907+00:00", + { "2004-11-06T08:09:07Z", NULL }, + { "20041106T08:09:07Z", NULL }, + { "20041106T08:09:07+00:00", NULL }, + { "20041106T080907+00:00", NULL }, /* Netscape cookie spec date, and broken variants */ - "Sat, 06-Nov-2004 08:09:07 GMT", - "Sat, 6-Nov-2004 08:09:07 GMT", - "Sat, 6-Nov-2004 08:09:07 GMT", - "Sat, 06-Nov-2004 08:09:07", + { "Sat, 06-Nov-2004 08:09:07 GMT", NULL }, + { "Sat, 6-Nov-2004 08:09:07 GMT", NULL }, + { "Sat, 6-Nov-2004 08:09:07 GMT", NULL }, + { "Sat, 06-Nov-2004 08:09:07", NULL }, /* Original version of Netscape cookie spec, and broken variants */ - "Sat, 06-Nov-04 08:09:07 GMT", - "Sat, 6-Nov-04 08:09:07 GMT", - "Sat, 6-Nov-04 08:09:07 GMT", - "Sat, 06-Nov-104 08:09:07 GMT", - "Sat, 06-Nov-04 08:09:07", + { "Sat, 06-Nov-04 08:09:07 GMT", NULL }, + { "Sat, 6-Nov-04 08:09:07 GMT", NULL }, + { "Sat, 6-Nov-04 08:09:07 GMT", NULL }, + { "Sat, 06-Nov-104 08:09:07 GMT", NULL }, + { "Sat, 06-Nov-04 08:09:07", NULL }, /* Netscape cookie spec example syntax, and broken variants */ - "Saturday, 06-Nov-04 08:09:07 GMT", - "Saturday, 6-Nov-04 08:09:07 GMT", - "Saturday, 6-Nov-04 08:09:07 GMT", - "Saturday, 06-Nov-104 08:09:07 GMT", - "Saturday, 06-Nov-2004 08:09:07 GMT", - "Saturday, 6-Nov-2004 08:09:07 GMT", - "Saturday, 6-Nov-2004 08:09:07 GMT", - "Saturday, 06-Nov-04 08:09:07", + { "Saturday, 06-Nov-04 08:09:07 GMT", NULL }, + { "Saturday, 6-Nov-04 08:09:07 GMT", NULL }, + { "Saturday, 6-Nov-04 08:09:07 GMT", NULL }, + { "Saturday, 06-Nov-104 08:09:07 GMT", NULL }, + { "Saturday, 06-Nov-2004 08:09:07 GMT", NULL }, + { "Saturday, 6-Nov-2004 08:09:07 GMT", NULL }, + { "Saturday, 6-Nov-2004 08:09:07 GMT", NULL }, + { "Saturday, 06-Nov-04 08:09:07", NULL }, /* Miscellaneous broken formats seen on the web */ - "Sat 06-Nov-2004 08:9:07", - "Saturday, 06-Nov-04 8:9:07 GMT", - "Sat, 06 Nov 2004 08:09:7 GMT" + { "Sat 06-Nov-2004 08:9:07", NULL }, + { "Saturday, 06-Nov-04 8:9:07 GMT", NULL }, + { "Sat, 06 Nov 2004 08:09:7 GMT", NULL } }; static void check_ok (gconstpointer data) { - const char *strdate = data; + OkDate *ok = (OkDate *)data; SoupDate *date; - date = make_date (strdate); - if (!date) { - g_assert_true (date != NULL); - return; - } + if (ok->bugref) + g_test_bug (ok->bugref); - g_assert_cmpint (date->year, ==, 2004); - g_assert_cmpint (date->month, ==, 11); - g_assert_cmpint (date->day, ==, 6); - g_assert_cmpint (date->hour, ==, 8); - g_assert_cmpint (date->minute, ==, 9); - g_assert_cmpint (date->second, ==, 7); + date = check_correct_date (ok->date); + if (!date) + return; + soup_date_free (date); } #define TIME_T 1099728547L @@ -153,52 +179,60 @@ check_ok_time_t (void) g_assert_cmpint (date->second, ==, 7); } -static const char *bad_dates[] = { +typedef struct { + const char *date; + const char *bugref; +} BadDate; + +static const BadDate bad_dates[] = { /* broken rfc1123-date */ - ", 06 Nov 2004 08:09:07 GMT", - "Sat, Nov 2004 08:09:07 GMT", - "Sat, 06 2004 08:09:07 GMT", - "Sat, 06 Nov 08:09:07 GMT", - "Sat, 06 Nov 2004 :09:07 GMT", - "Sat, 06 Nov 2004 09:07 GMT", - "Sat, 06 Nov 2004 08::07 GMT", - "Sat, 06 Nov 2004 08:09: GMT", + { ", 06 Nov 2004 08:09:07 GMT", NULL }, + { "Sat, Nov 2004 08:09:07 GMT", NULL }, + { "Sat, 06 2004 08:09:07 GMT", NULL }, + { "Sat, 06 Nov 08:09:07 GMT", NULL }, + { "Sat, 06 Nov 2004 :09:07 GMT", NULL }, + { "Sat, 06 Nov 2004 09:07 GMT", NULL }, + { "Sat, 06 Nov 2004 08::07 GMT", NULL }, + { "Sat, 06 Nov 2004 08:09: GMT", NULL }, /* broken rfc850-date */ - ", 06-Nov-04 08:09:07 GMT", - "Saturday, -Nov-04 08:09:07 GMT", - "Saturday, Nov-04 08:09:07 GMT", - "Saturday, 06-04 08:09:07 GMT", - "Saturday, 06--04 08:09:07 GMT", - "Saturday, 06-Nov- 08:09:07 GMT", - "Saturday, 06-Nov 08:09:07 GMT", - "Saturday, 06-Nov-04 :09:07 GMT", - "Saturday, 06-Nov-04 09:07 GMT", - "Saturday, 06-Nov-04 08::07 GMT", - "Saturday, 06-Nov-04 08:09: GMT", + { ", 06-Nov-04 08:09:07 GMT", NULL }, + { "Saturday, -Nov-04 08:09:07 GMT", NULL }, + { "Saturday, Nov-04 08:09:07 GMT", NULL }, + { "Saturday, 06-04 08:09:07 GMT", NULL }, + { "Saturday, 06--04 08:09:07 GMT", NULL }, + { "Saturday, 06-Nov- 08:09:07 GMT", NULL }, + { "Saturday, 06-Nov 08:09:07 GMT", NULL }, + { "Saturday, 06-Nov-04 :09:07 GMT", NULL }, + { "Saturday, 06-Nov-04 09:07 GMT", NULL }, + { "Saturday, 06-Nov-04 08::07 GMT", NULL }, + { "Saturday, 06-Nov-04 08:09: GMT", NULL }, /* broken asctime-date */ - "Nov 6 08:09:07 2004", - "Sat 6 08:09:07 2004", - "Sat Nov 08:09:07 2004", - "Sat Nov 6 :09:07 2004", - "Sat Nov 6 09:07 2004", - "Sat Nov 6 08::07 2004", - "Sat Nov 6 08:09: 2004", - "Sat Nov 6 08:09:07", - "Sat Nov 6 08:09:07 GMT 2004" + { "Nov 6 08:09:07 2004", NULL }, + { "Sat 6 08:09:07 2004", NULL }, + { "Sat Nov 08:09:07 2004", NULL }, + { "Sat Nov 6 :09:07 2004", NULL }, + { "Sat Nov 6 09:07 2004", NULL }, + { "Sat Nov 6 08::07 2004", NULL }, + { "Sat Nov 6 08:09: 2004", NULL }, + { "Sat Nov 6 08:09:07", NULL }, + { "Sat Nov 6 08:09:07 GMT 2004", NULL } }; static void check_bad (gconstpointer data) { - const char *strdate = data; + BadDate *bad = (BadDate *)data; SoupDate *date; - date = make_date (strdate); + if (bad->bugref) + g_test_bug (bad->bugref); + + date = make_date (bad->date); soup_test_assert (date == NULL, "date parsing succeeded for '%s': %d %d %d - %d %d %d", - strdate, + bad->date, date->year, date->month, date->day, date->hour, date->minute, date->second); g_clear_pointer (&date, soup_date_free); @@ -356,15 +390,15 @@ main (int argc, char **argv) } for (i = 0; i < G_N_ELEMENTS (ok_dates); i++) { - path = g_strdup_printf ("/date/ok/%s", ok_dates[i]); - g_test_add_data_func (path, ok_dates[i], check_ok); + path = g_strdup_printf ("/date/ok/%s", ok_dates[i].date); + g_test_add_data_func (path, &ok_dates[i], check_ok); g_free (path); } g_test_add_func ("/date/ok/" TIME_T_STRING, check_ok_time_t); for (i = 0; i < G_N_ELEMENTS (bad_dates); i++) { - path = g_strdup_printf ("/date/bad/%s", bad_dates[i]); - g_test_add_data_func (path, bad_dates[i], check_bad); + path = g_strdup_printf ("/date/bad/%s", bad_dates[i].date); + g_test_add_data_func (path, &bad_dates[i], check_bad); g_free (path); } diff --git a/tests/forms-test.c b/tests/forms-test.c index 1d89743b..3915b019 100644 --- a/tests/forms-test.c +++ b/tests/forms-test.c @@ -188,6 +188,8 @@ do_md5_test_libsoup (gconstpointer data) SoupMessage *msg; SoupSession *session; + g_test_bug ("601640"); + md5 = get_md5_data (&contents, &length); if (!md5) return; diff --git a/tests/header-parsing.c b/tests/header-parsing.c index b5f6bf2f..fdc7885d 100644 --- a/tests/header-parsing.c +++ b/tests/header-parsing.c @@ -8,6 +8,7 @@ typedef struct { static struct RequestTest { const char *description; + const char *bugref; const char *request; int length; guint status; @@ -19,14 +20,14 @@ static struct RequestTest { /*** VALID REQUESTS ***/ /**********************/ - { "HTTP 1.0 request with no headers", + { "HTTP 1.0 request with no headers", NULL, "GET / HTTP/1.0\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_0, { { NULL } } }, - { "Req w/ 1 header", + { "Req w/ 1 header", NULL, "GET / HTTP/1.1\r\nHost: example.com\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -35,7 +36,7 @@ static struct RequestTest { } }, - { "Req w/ 1 header, no leading whitespace", + { "Req w/ 1 header, no leading whitespace", NULL, "GET / HTTP/1.1\r\nHost:example.com\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -44,7 +45,7 @@ static struct RequestTest { } }, - { "Req w/ 1 header including trailing whitespace", + { "Req w/ 1 header including trailing whitespace", NULL, "GET / HTTP/1.1\r\nHost: example.com \r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -53,7 +54,7 @@ static struct RequestTest { } }, - { "Req w/ 1 header, wrapped", + { "Req w/ 1 header, wrapped", NULL, "GET / HTTP/1.1\r\nFoo: bar\r\n baz\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -62,7 +63,7 @@ static struct RequestTest { } }, - { "Req w/ 1 header, wrapped with additional whitespace", + { "Req w/ 1 header, wrapped with additional whitespace", NULL, "GET / HTTP/1.1\r\nFoo: bar \r\n baz\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -71,7 +72,7 @@ static struct RequestTest { } }, - { "Req w/ 1 header, wrapped with tab", + { "Req w/ 1 header, wrapped with tab", NULL, "GET / HTTP/1.1\r\nFoo: bar\r\n\tbaz\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -80,7 +81,7 @@ static struct RequestTest { } }, - { "Req w/ 1 header, wrapped before value", + { "Req w/ 1 header, wrapped before value", NULL, "GET / HTTP/1.1\r\nFoo:\r\n bar baz\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -89,7 +90,7 @@ static struct RequestTest { } }, - { "Req w/ 1 header with empty value", + { "Req w/ 1 header with empty value", NULL, "GET / HTTP/1.1\r\nHost:\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -98,7 +99,7 @@ static struct RequestTest { } }, - { "Req w/ 2 headers", + { "Req w/ 2 headers", NULL, "GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -108,7 +109,7 @@ static struct RequestTest { } }, - { "Req w/ 3 headers", + { "Req w/ 3 headers", NULL, "GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\nBlah: blah\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -119,7 +120,7 @@ static struct RequestTest { } }, - { "Req w/ 3 headers, 1st wrapped", + { "Req w/ 3 headers, 1st wrapped", NULL, "GET / HTTP/1.1\r\nFoo: bar\r\n baz\r\nConnection: close\r\nBlah: blah\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -130,7 +131,7 @@ static struct RequestTest { } }, - { "Req w/ 3 headers, 2nd wrapped", + { "Req w/ 3 headers, 2nd wrapped", NULL, "GET / HTTP/1.1\r\nConnection: close\r\nBlah: blah\r\nFoo: bar\r\n baz\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -141,7 +142,7 @@ static struct RequestTest { } }, - { "Req w/ 3 headers, 3rd wrapped", + { "Req w/ 3 headers, 3rd wrapped", NULL, "GET / HTTP/1.1\r\nConnection: close\r\nBlah: blah\r\nFoo: bar\r\n baz\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -152,7 +153,7 @@ static struct RequestTest { } }, - { "Req w/ same header multiple times", + { "Req w/ same header multiple times", NULL, "GET / HTTP/1.1\r\nFoo: bar\r\nFoo: baz\r\nFoo: quux\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -161,7 +162,7 @@ static struct RequestTest { } }, - { "Connection header on HTTP/1.0 message", + { "Connection header on HTTP/1.0 message", NULL, "GET / HTTP/1.0\r\nFoo: bar\r\nConnection: Bar, Quux\r\nBar: baz\r\nQuux: foo\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_0, @@ -171,14 +172,14 @@ static struct RequestTest { } }, - { "GET with full URI", + { "GET with full URI", "667637", "GET http://example.com HTTP/1.1\r\n", -1, SOUP_STATUS_OK, "GET", "http://example.com", SOUP_HTTP_1_1, { { NULL } } }, - { "GET with full URI in upper-case", + { "GET with full URI in upper-case", "667637", "GET HTTP://example.com HTTP/1.1\r\n", -1, SOUP_STATUS_OK, "GET", "HTTP://example.com", SOUP_HTTP_1_1, @@ -188,7 +189,7 @@ static struct RequestTest { /* It's better for this to be passed through: this means a SoupServer * could implement ftp-over-http proxying, for instance */ - { "GET with full URI of unrecognised scheme", + { "GET with full URI of unrecognised scheme", "667637", "GET AbOuT: HTTP/1.1\r\n", -1, SOUP_STATUS_OK, "GET", "AbOuT:", SOUP_HTTP_1_1, @@ -201,7 +202,7 @@ static struct RequestTest { /* RFC 2616 section 4.1 says we SHOULD accept this */ - { "Spurious leading CRLF", + { "Spurious leading CRLF", NULL, "\r\nGET / HTTP/1.1\r\nHost: example.com\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -212,7 +213,7 @@ static struct RequestTest { /* RFC 2616 section 3.1 says we MUST accept this */ - { "HTTP/01.01 request", + { "HTTP/01.01 request", NULL, "GET / HTTP/01.01\r\nHost: example.com\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -223,7 +224,7 @@ static struct RequestTest { /* RFC 2616 section 19.3 says we SHOULD accept these */ - { "LF instead of CRLF after header", + { "LF instead of CRLF after header", NULL, "GET / HTTP/1.1\r\nHost: example.com\nConnection: close\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -233,7 +234,7 @@ static struct RequestTest { } }, - { "LF instead of CRLF after Request-Line", + { "LF instead of CRLF after Request-Line", NULL, "GET / HTTP/1.1\nHost: example.com\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -242,7 +243,7 @@ static struct RequestTest { } }, - { "Mixed CRLF/LF", + { "Mixed CRLF/LF", "666316", "GET / HTTP/1.1\r\na: b\r\nc: d\ne: f\r\ng: h\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -254,7 +255,7 @@ static struct RequestTest { } }, - { "Req w/ incorrect whitespace in Request-Line", + { "Req w/ incorrect whitespace in Request-Line", NULL, "GET /\tHTTP/1.1\r\nHost: example.com\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -263,7 +264,7 @@ static struct RequestTest { } }, - { "Req w/ incorrect whitespace after Request-Line", + { "Req w/ incorrect whitespace after Request-Line", "475169", "GET / HTTP/1.1 \r\nHost: example.com\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -274,10 +275,9 @@ static struct RequestTest { /* If the request/status line is parseable, then we * just ignore any invalid-looking headers after that. - * (qv bug 579318). */ - { "Req w/ mangled header", + { "Req w/ mangled header", "579318", "GET / HTTP/1.1\r\nHost: example.com\r\nFoo one\r\nBar: two\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -287,7 +287,7 @@ static struct RequestTest { } }, - { "First header line is continuation", + { "First header line is continuation", "666316", "GET / HTTP/1.1\r\n b\r\nHost: example.com\r\nc: d\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -297,7 +297,7 @@ static struct RequestTest { } }, - { "Zero-length header name", + { "Zero-length header name", "666316", "GET / HTTP/1.1\r\na: b\r\n: example.com\r\nc: d\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -307,7 +307,7 @@ static struct RequestTest { } }, - { "CR in header name", + { "CR in header name", "666316", "GET / HTTP/1.1\r\na: b\r\na\rb: cd\r\nx\r: y\r\n\rz: w\r\nc: d\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -317,7 +317,7 @@ static struct RequestTest { } }, - { "CR in header value", + { "CR in header value", "666316", "GET / HTTP/1.1\r\na: b\r\nHost: example\rcom\r\np: \rq\r\ns: t\r\r\nc: d\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -330,7 +330,7 @@ static struct RequestTest { } }, - { "Tab in header name", + { "Tab in header name", "666316", "GET / HTTP/1.1\r\na: b\r\na\tb: cd\r\nx\t: y\r\np: q\r\n\tz: w\r\nc: d\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -345,7 +345,7 @@ static struct RequestTest { } }, - { "Tab in header value", + { "Tab in header value", "666316", "GET / HTTP/1.1\r\na: b\r\nab: c\td\r\nx: \ty\r\nz: w\t\r\nc: d\r\n", -1, SOUP_STATUS_OK, "GET", "/", SOUP_HTTP_1_1, @@ -362,84 +362,84 @@ static struct RequestTest { /*** INVALID REQUESTS ***/ /************************/ - { "HTTP 0.9 request; not supported", + { "HTTP 0.9 request; not supported", NULL, "GET /\r\n", -1, SOUP_STATUS_BAD_REQUEST, NULL, NULL, -1, { { NULL } } }, - { "HTTP 1.2 request (no such thing)", + { "HTTP 1.2 request (no such thing)", NULL, "GET / HTTP/1.2\r\n", -1, SOUP_STATUS_HTTP_VERSION_NOT_SUPPORTED, NULL, NULL, -1, { { NULL } } }, - { "HTTP 2000 request (no such thing)", + { "HTTP 2000 request (no such thing)", NULL, "GET / HTTP/2000.0\r\n", -1, SOUP_STATUS_HTTP_VERSION_NOT_SUPPORTED, NULL, NULL, -1, { { NULL } } }, - { "Non-HTTP request", + { "Non-HTTP request", NULL, "GET / SOUP/1.1\r\nHost: example.com\r\n", -1, SOUP_STATUS_BAD_REQUEST, NULL, NULL, -1, { { NULL } } }, - { "Junk after Request-Line", + { "Junk after Request-Line", NULL, "GET / HTTP/1.1 blah\r\nHost: example.com\r\n", -1, SOUP_STATUS_BAD_REQUEST, NULL, NULL, -1, { { NULL } } }, - { "NUL in Method", + { "NUL in Method", NULL, "G\x00T / HTTP/1.1\r\nHost: example.com\r\n", 37, SOUP_STATUS_BAD_REQUEST, NULL, NULL, -1, { { NULL } } }, - { "NUL at beginning of Method", + { "NUL at beginning of Method", "666316", "\x00 / HTTP/1.1\r\nHost: example.com\r\n", 35, SOUP_STATUS_BAD_REQUEST, NULL, NULL, -1, { { NULL } } }, - { "NUL in Path", + { "NUL in Path", NULL, "GET /\x00 HTTP/1.1\r\nHost: example.com\r\n", 38, SOUP_STATUS_BAD_REQUEST, NULL, NULL, -1, { { NULL } } }, - { "NUL in header name", + { "NUL in header name", "666316", "GET / HTTP/1.1\r\n\x00: silly\r\n", 37, SOUP_STATUS_BAD_REQUEST, NULL, NULL, -1, { { NULL } } }, - { "NUL in header value", + { "NUL in header value", NULL, "GET / HTTP/1.1\r\nHost: example\x00com\r\n", 37, SOUP_STATUS_BAD_REQUEST, NULL, NULL, -1, { { NULL } } }, - { "No terminating CRLF", + { "No terminating CRLF", NULL, "GET / HTTP/1.1\r\nHost: example.com", -1, SOUP_STATUS_BAD_REQUEST, NULL, NULL, -1, { { NULL } } }, - { "Unrecognized expectation", + { "Unrecognized expectation", NULL, "GET / HTTP/1.1\r\nHost: example.com\r\nExpect: the-impossible\r\n", -1, SOUP_STATUS_EXPECTATION_FAILED, NULL, NULL, -1, @@ -450,6 +450,7 @@ static const int num_reqtests = G_N_ELEMENTS (reqtests); static struct ResponseTest { const char *description; + const char *bugref; const char *response; int length; SoupHTTPVersion version; @@ -461,25 +462,25 @@ static struct ResponseTest { /*** VALID RESPONSES ***/ /***********************/ - { "HTTP 1.0 response w/ no headers", + { "HTTP 1.0 response w/ no headers", NULL, "HTTP/1.0 200 ok\r\n", -1, SOUP_HTTP_1_0, SOUP_STATUS_OK, "ok", { { NULL } } }, - { "HTTP 1.1 response w/ no headers", + { "HTTP 1.1 response w/ no headers", NULL, "HTTP/1.1 200 ok\r\n", -1, SOUP_HTTP_1_1, SOUP_STATUS_OK, "ok", { { NULL } } }, - { "Response w/ multi-word Reason-Phrase", + { "Response w/ multi-word Reason-Phrase", NULL, "HTTP/1.1 400 bad request\r\n", -1, SOUP_HTTP_1_1, SOUP_STATUS_BAD_REQUEST, "bad request", { { NULL } } }, - { "Response w/ 1 header", + { "Response w/ 1 header", NULL, "HTTP/1.1 200 ok\r\nFoo: bar\r\n", -1, SOUP_HTTP_1_1, SOUP_STATUS_OK, "ok", { { "Foo", "bar" }, @@ -487,7 +488,7 @@ static struct ResponseTest { } }, - { "Response w/ 2 headers", + { "Response w/ 2 headers", NULL, "HTTP/1.1 200 ok\r\nFoo: bar\r\nBaz: quux\r\n", -1, SOUP_HTTP_1_1, SOUP_STATUS_OK, "ok", { { "Foo", "bar" }, @@ -496,7 +497,7 @@ static struct ResponseTest { } }, - { "Response w/ same header multiple times", + { "Response w/ same header multiple times", NULL, "HTTP/1.1 200 ok\r\nFoo: bar\r\nFoo: baz\r\nFoo: quux\r\n", -1, SOUP_HTTP_1_1, SOUP_STATUS_OK, "ok", { { "Foo", "bar, baz, quux" }, @@ -504,7 +505,7 @@ static struct ResponseTest { } }, - { "Response w/ no reason phrase", + { "Response w/ no reason phrase", NULL, "HTTP/1.1 200 \r\nFoo: bar\r\n", -1, SOUP_HTTP_1_1, SOUP_STATUS_OK, "", { { "Foo", "bar" }, @@ -512,7 +513,7 @@ static struct ResponseTest { } }, - { "Connection header on HTTP/1.0 message", + { "Connection header on HTTP/1.0 message", NULL, "HTTP/1.0 200 ok\r\nFoo: bar\r\nConnection: Bar\r\nBar: quux\r\n", -1, SOUP_HTTP_1_0, SOUP_STATUS_OK, "ok", { { "Foo", "bar" }, @@ -523,7 +524,7 @@ static struct ResponseTest { /* Tests from Cockpit */ - { "Response w/ 3 headers, check case-insensitivity", + { "Response w/ 3 headers, check case-insensitivity", "722341", "HTTP/1.0 200 ok\r\nHeader1: value3\r\nHeader2: field\r\nHead3: Another \r\n", -1, SOUP_HTTP_1_0, SOUP_STATUS_OK, "ok", { { "header1", "value3" }, @@ -540,7 +541,7 @@ static struct ResponseTest { /* RFC 2616 section 3.1 says we MUST accept this */ - { "HTTP/01.01 response", + { "HTTP/01.01 response", NULL, "HTTP/01.01 200 ok\r\nFoo: bar\r\n", -1, SOUP_HTTP_1_1, SOUP_STATUS_OK, "ok", { { "Foo", "bar" }, @@ -550,7 +551,7 @@ static struct ResponseTest { /* RFC 2616 section 19.3 says we SHOULD accept these */ - { "Response w/ LF instead of CRLF after Status-Line", + { "Response w/ LF instead of CRLF after Status-Line", NULL, "HTTP/1.1 200 ok\nFoo: bar\r\n", -1, SOUP_HTTP_1_1, SOUP_STATUS_OK, "ok", { { "Foo", "bar" }, @@ -558,7 +559,7 @@ static struct ResponseTest { } }, - { "Response w/ incorrect spacing in Status-Line", + { "Response w/ incorrect spacing in Status-Line", NULL, "HTTP/1.1 200\tok\r\nFoo: bar\r\n", -1, SOUP_HTTP_1_1, SOUP_STATUS_OK, "ok", { { "Foo", "bar" }, @@ -566,7 +567,7 @@ static struct ResponseTest { } }, - { "Response w/ no reason phrase or preceding SP", + { "Response w/ no reason phrase or preceding SP", NULL, "HTTP/1.1 200\r\nFoo: bar\r\n", -1, SOUP_HTTP_1_1, SOUP_STATUS_OK, "", { { "Foo", "bar" }, @@ -574,7 +575,7 @@ static struct ResponseTest { } }, - { "Response w/ no whitespace after status code", + { "Response w/ no whitespace after status code", NULL, "HTTP/1.1 200ok\r\nFoo: bar\r\n", -1, SOUP_HTTP_1_1, SOUP_STATUS_OK, "ok", { { "Foo", "bar" }, @@ -583,7 +584,7 @@ static struct ResponseTest { }, /* Shoutcast support */ - { "Shoutcast server not-quite-HTTP", + { "Shoutcast server not-quite-HTTP", "502325", "ICY 200 OK\r\nFoo: bar\r\n", -1, SOUP_HTTP_1_0, SOUP_STATUS_OK, "OK", { { "Foo", "bar" }, @@ -591,8 +592,7 @@ static struct ResponseTest { } }, - /* qv bug 579318, do_bad_header_tests() below */ - { "Response w/ mangled header", + { "Response w/ mangled header", "579318", "HTTP/1.1 200 ok\r\nFoo: one\r\nBar two:2\r\nBaz: three\r\n", -1, SOUP_HTTP_1_1, SOUP_STATUS_OK, "ok", { { "Foo", "one" }, @@ -601,8 +601,7 @@ static struct ResponseTest { } }, - /* qv bug 602863 */ - { "HTTP 1.1 response with leading line break", + { "HTTP 1.1 response with leading line break", "602863", "\nHTTP/1.1 200 ok\r\nFoo: bar\r\n", -1, SOUP_HTTP_1_1, SOUP_STATUS_OK, "ok", { { "Foo", "bar" }, @@ -613,79 +612,79 @@ static struct ResponseTest { /*** INVALID RESPONSES ***/ /*************************/ - { "Invalid HTTP version", + { "Invalid HTTP version", NULL, "HTTP/1.2 200 OK\r\nFoo: bar\r\n", -1, -1, 0, NULL, { { NULL } } }, - { "Non-HTTP response", + { "Non-HTTP response", NULL, "SOUP/1.1 200 OK\r\nFoo: bar\r\n", -1, -1, 0, NULL, { { NULL } } }, - { "Non-numeric status code", + { "Non-numeric status code", NULL, "HTTP/1.1 XXX OK\r\nFoo: bar\r\n", -1, -1, 0, NULL, { { NULL } } }, - { "No status code", + { "No status code", NULL, "HTTP/1.1 OK\r\nFoo: bar\r\n", -1, -1, 0, NULL, { { NULL } } }, - { "One-digit status code", + { "One-digit status code", NULL, "HTTP/1.1 2 OK\r\nFoo: bar\r\n", -1, -1, 0, NULL, { { NULL } } }, - { "Two-digit status code", + { "Two-digit status code", NULL, "HTTP/1.1 20 OK\r\nFoo: bar\r\n", -1, -1, 0, NULL, { { NULL } } }, - { "Four-digit status code", + { "Four-digit status code", NULL, "HTTP/1.1 2000 OK\r\nFoo: bar\r\n", -1, -1, 0, NULL, { { NULL } } }, - { "Status code < 100", + { "Status code < 100", NULL, "HTTP/1.1 001 OK\r\nFoo: bar\r\n", -1, -1, 0, NULL, { { NULL } } }, - { "Status code > 599", + { "Status code > 599", NULL, "HTTP/1.1 600 OK\r\nFoo: bar\r\n", -1, -1, 0, NULL, { { NULL } } }, - { "NUL at start", + { "NUL at start", "666316", "\x00HTTP/1.1 200 OK\r\nFoo: bar\r\n", 28, -1, 0, NULL, { { NULL } } }, - { "NUL in Reason Phrase", + { "NUL in Reason Phrase", NULL, "HTTP/1.1 200 O\x00K\r\nFoo: bar\r\n", 28, -1, 0, NULL, { { NULL } } }, - { "NUL in header name", + { "NUL in header name", NULL, "HTTP/1.1 200 OK\r\nF\x00oo: bar\r\n", 28, -1, 0, NULL, { { NULL } } }, - { "NUL in header value", + { "NUL in header value", NULL, "HTTP/1.1 200 OK\r\nFoo: b\x00ar\r\n", 28, -1, 0, NULL, { { NULL } } @@ -939,7 +938,8 @@ do_content_disposition_tests (void) soup_message_headers_free (hdrs); - /* Ensure that soup-multipart always quotes filename (bug 641280) */ + /* Ensure that soup-multipart always quotes filename */ + g_test_bug ("641280"); multipart = soup_multipart_new (SOUP_FORM_MIME_TYPE_MULTIPART); buffer = soup_buffer_new (SOUP_MEMORY_STATIC, "foo", 3); soup_multipart_append_form_file (multipart, "test", "token", @@ -974,6 +974,8 @@ do_content_type_tests (void) GHashTable *params; const char *header, *mime_type; + g_test_bug ("576760"); + hdrs = soup_message_headers_new (SOUP_MESSAGE_HEADERS_MULTIPART); params = g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_insert (params, CONTENT_TYPE_TEST_ATTRIBUTE, @@ -997,6 +999,8 @@ do_content_type_tests (void) if (params) g_hash_table_destroy (params); + g_test_bug ("577630"); + soup_message_headers_clear (hdrs); soup_message_headers_append (hdrs, "Content-Type", CONTENT_TYPE_BAD_HEADER); @@ -1024,6 +1028,8 @@ do_append_param_tests (void) GString *params; int i; + g_test_bug ("577728"); + params = g_string_new (NULL); for (i = 0; i < G_N_ELEMENTS (test_params); i++) { if (i > 0) diff --git a/tests/misc-test.c b/tests/misc-test.c index 1f6e7773..00559a03 100644 --- a/tests/misc-test.c +++ b/tests/misc-test.c @@ -91,7 +91,6 @@ server_callback (SoupServer *server, SoupMessage *msg, /* Host header handling: client must be able to override the default * value, server must be able to recognize different Host values. - * #539803. */ static void do_host_test (void) @@ -99,6 +98,8 @@ do_host_test (void) SoupSession *session; SoupMessage *one, *two; + g_test_bug ("539803"); + session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL); one = soup_message_new_from_uri ("GET", base_uri); @@ -121,7 +122,7 @@ do_host_test (void) /* Dropping the application's ref on the session from a callback * should not cause the session to be freed at an incorrect time. - * (This test will crash if it fails.) #533473 + * (This test will crash if it fails.) */ static void cu_one_completed (SoupSession *session, SoupMessage *msg, gpointer loop) @@ -156,6 +157,8 @@ do_callback_unref_test (void) GMainLoop *loop; char *bad_uri; + g_test_bug ("533473"); + /* Get a guaranteed-bad URI */ addr = soup_address_new ("127.0.0.1", SOUP_ADDRESS_ANY_PORT); soup_address_resolve_sync (addr, NULL); @@ -301,7 +304,6 @@ do_callback_unref_req_test (void) /* SoupSession should clean up all signal handlers on a message after * it is finished, allowing the message to be reused if desired. - * #559054 */ static void ensure_no_signal_handlers (SoupMessage *msg, guint *signal_ids, guint n_signal_ids) @@ -337,6 +339,8 @@ do_msg_reuse_test (void) SoupURI *uri; guint *signal_ids, n_signal_ids; + g_test_bug ("559054"); + signal_ids = g_signal_list_ids (SOUP_TYPE_MESSAGE, &n_signal_ids); session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL); @@ -375,7 +379,7 @@ do_msg_reuse_test (void) g_free (signal_ids); } -/* Handle unexpectedly-early aborts. #596074, #618641 */ +/* Handle unexpectedly-early aborts. */ static void ea_msg_completed_one (SoupSession *session, SoupMessage *msg, gpointer loop) { @@ -427,6 +431,9 @@ do_early_abort_test (void) GMainContext *context; GMainLoop *loop; + g_test_bug ("596074"); + g_test_bug ("618641"); + session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL); msg = soup_message_new_from_uri ("GET", base_uri); @@ -457,6 +464,8 @@ do_early_abort_test (void) soup_test_session_abort_unref (session); + g_test_bug ("668098"); + session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL); msg = soup_message_new_from_uri ("GET", base_uri); @@ -608,6 +617,8 @@ do_accept_language_test (void) { const char *orig_language; + g_test_bug ("602547"); + orig_language = g_getenv ("LANGUAGE"); do_one_accept_language_test ("C", "en"); do_one_accept_language_test ("fr_FR", "fr-fr, fr;q=0.9"); @@ -691,6 +702,9 @@ do_cancel_while_reading_test (void) { SoupSession *session; + g_test_bug ("637741"); + g_test_bug ("676038"); + debug_printf (1, " Async session\n"); session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL); do_cancel_while_reading_test_for_session (session); @@ -730,6 +744,8 @@ do_cancel_while_reading_immediate_req_test (void) SoupSession *session; guint flags; + g_test_bug ("692310"); + flags = SOUP_TEST_REQUEST_CANCEL_CANCELLABLE | SOUP_TEST_REQUEST_CANCEL_IMMEDIATE; debug_printf (1, " Async session\n"); @@ -774,6 +790,8 @@ do_cancel_while_reading_preemptive_req_test (void) SoupSession *session; guint flags; + g_test_bug ("637039"); + flags = SOUP_TEST_REQUEST_CANCEL_CANCELLABLE | SOUP_TEST_REQUEST_CANCEL_PREEMPTIVE; debug_printf (1, " Async session\n"); @@ -852,6 +870,8 @@ do_idle_on_dispose_test (void) SoupMessage *msg; GMainContext *async_context; + g_test_bug ("667364"); + async_context = g_main_context_new (); session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, SOUP_SESSION_ASYNC_CONTEXT, async_context, @@ -880,6 +900,8 @@ do_pause_abort_test (void) SoupMessage *msg; gpointer ptr; + g_test_bug ("673905"); + session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL); msg = soup_message_new_from_uri ("GET", base_uri); diff --git a/tests/no-ssl-test.c b/tests/no-ssl-test.c index 0062c8c0..82532c74 100644 --- a/tests/no-ssl-test.c +++ b/tests/no-ssl-test.c @@ -28,6 +28,8 @@ do_ssl_tests (gconstpointer uri) { SoupSession *session; + g_test_bug ("700518"); + debug_printf (1, " plain\n"); session = soup_test_session_new (SOUP_TYPE_SESSION, NULL); do_ssl_test_for_session (session, uri); @@ -52,6 +54,8 @@ do_session_property_tests (void) char *ca_file; SoupSession *session; + g_test_bug ("700518"); + session = soup_session_async_new (); g_object_get (G_OBJECT (session), @@ -101,7 +105,7 @@ do_session_property_tests (void) static void server_handler (SoupServer *server, - SoupMessage *msg, + SoupMessage *msg, const char *path, GHashTable *query, SoupClientContext *client, diff --git a/tests/ntlm-test.c b/tests/ntlm-test.c index 7aa532ed..24a0f2e4 100644 --- a/tests/ntlm-test.c +++ b/tests/ntlm-test.c @@ -540,6 +540,8 @@ do_retrying_test (gconstpointer data) SoupURI *uri; gboolean retried = FALSE; + g_test_bug ("693222"); + g_setenv ("SOUP_NTLM_AUTH_DEBUG", "", TRUE); debug_printf (1, " /alice\n"); diff --git a/tests/proxy-test.c b/tests/proxy-test.c index 599ff4e8..4b6679b3 100644 --- a/tests/proxy-test.c +++ b/tests/proxy-test.c @@ -6,15 +6,16 @@ typedef struct { const char *explanation; const char *url; const guint final_status; + const char *bugref; } SoupProxyTest; static SoupProxyTest tests[] = { - { "GET -> 200", "", SOUP_STATUS_OK }, - { "GET -> 404", "/not-found", SOUP_STATUS_NOT_FOUND }, - { "GET -> 401 -> 200", "/Basic/realm1/", SOUP_STATUS_OK }, - { "GET -> 401 -> 401", "/Basic/realm2/", SOUP_STATUS_UNAUTHORIZED }, - { "GET -> 403", "http://no-such-hostname.xx/", SOUP_STATUS_FORBIDDEN }, - { "GET -> 200 (unproxied)", "http://localhost:47524/", SOUP_STATUS_OK }, + { "GET -> 200", "", SOUP_STATUS_OK, NULL }, + { "GET -> 404", "/not-found", SOUP_STATUS_NOT_FOUND, NULL }, + { "GET -> 401 -> 200", "/Basic/realm1/", SOUP_STATUS_OK, NULL }, + { "GET -> 401 -> 401", "/Basic/realm2/", SOUP_STATUS_UNAUTHORIZED, NULL }, + { "GET -> 403", "http://no-such-hostname.xx/", SOUP_STATUS_FORBIDDEN, "577532" }, + { "GET -> 200 (unproxied)", "http://localhost:47524/", SOUP_STATUS_OK, "700472" }, }; static const int ntests = sizeof (tests) / sizeof (tests[0]); @@ -101,6 +102,7 @@ test_url (const char *url, int proxy, guint expected, g_signal_connect (session, "authenticate", G_CALLBACK (authenticate), NULL); if (close) { + /* FIXME g_test_bug ("611663") */ g_signal_connect (session, "request-started", G_CALLBACK (set_close_on_connect), NULL); } @@ -131,6 +133,7 @@ test_url_new_api (const char *url, int proxy, guint expected, GError *error = NULL; gboolean noproxy = !!strstr (url, "localhost"); + /* FIXME g_test_skip() FIXME g_test_bug ("675865") */ if (!tls_available && g_str_has_prefix (url, "https:")) return; @@ -151,6 +154,7 @@ test_url_new_api (const char *url, int proxy, guint expected, g_signal_connect (session, "authenticate", G_CALLBACK (authenticate), NULL); if (close) { + /* FIXME g_test_bug ("611663") */ g_signal_connect (session, "request-started", G_CALLBACK (set_close_on_connect), NULL); } @@ -183,6 +187,9 @@ do_proxy_test (SoupProxyTest *test, gboolean sync) { char *http_url, *https_url; + if (test->bugref) + g_test_bug (test->bugref); + if (!strncmp (test->url, "http", 4)) { SoupURI *uri; guint port; @@ -286,6 +293,8 @@ do_proxy_redirect_test (void) SoupURI *proxy_uri, *req_uri, *new_uri; SoupMessage *msg; + g_test_bug ("631368"); + SOUP_TEST_SKIP_IF_NO_APACHE; SOUP_TEST_SKIP_IF_NO_TLS; diff --git a/tests/redirect-test.c b/tests/redirect-test.c index c9079cf6..ad8dabaa 100644 --- a/tests/redirect-test.c +++ b/tests/redirect-test.c @@ -19,7 +19,7 @@ typedef struct { typedef struct { TestRequest requests[3]; guint final_status; - guint request_api_final_status; + const char *bugref; } TestCase; static TestCase tests[] = { @@ -27,95 +27,95 @@ static TestCase tests[] = { { { { "GET", "/301", 301 }, { "GET", "/", 200 }, - { NULL } }, 200 }, + { NULL } }, 200, NULL }, { { { "GET", "/302", 302 }, { "GET", "/", 200 }, - { NULL } }, 200 }, + { NULL } }, 200, NULL }, { { { "GET", "/303", 303 }, { "GET", "/", 200 }, - { NULL } }, 200 }, + { NULL } }, 200, NULL }, { { { "GET", "/307", 307 }, { "GET", "/", 200 }, - { NULL } }, 200 }, + { NULL } }, 200, NULL }, { { { "HEAD", "/301", 301 }, { "HEAD", "/", 200 }, - { NULL } }, 200 }, + { NULL } }, 200, "551190" }, { { { "HEAD", "/302", 302 }, { "HEAD", "/", 200 }, - { NULL } }, 200 }, + { NULL } }, 200, "551190" }, /* 303 is a nonsensical response to HEAD, but some sites do * it anyway. :-/ */ { { { "HEAD", "/303", 303 }, { "HEAD", "/", 200 }, - { NULL } }, 200 }, + { NULL } }, 200, "600830" }, { { { "HEAD", "/307", 307 }, { "HEAD", "/", 200 }, - { NULL } }, 200 }, + { NULL } }, 200, "551190" }, /* A non-redirecty response to a GET or HEAD should not */ { { { "GET", "/300", 300 }, - { NULL } }, 300 }, + { NULL } }, 300, NULL }, { { { "GET", "/304", 304 }, - { NULL } }, 304 }, + { NULL } }, 304, NULL }, { { { "GET", "/305", 305 }, - { NULL } }, 305 }, + { NULL } }, 305, NULL }, { { { "GET", "/306", 306 }, - { NULL } }, 306 }, + { NULL } }, 306, NULL }, { { { "GET", "/308", 308 }, - { NULL } }, 308 }, + { NULL } }, 308, NULL }, { { { "HEAD", "/300", 300 }, - { NULL } }, 300 }, + { NULL } }, 300, "551190" }, { { { "HEAD", "/304", 304 }, - { NULL } }, 304 }, + { NULL } }, 304, "551190" }, { { { "HEAD", "/305", 305 }, - { NULL } }, 305 }, + { NULL } }, 305, "551190" }, { { { "HEAD", "/306", 306 }, - { NULL } }, 306 }, + { NULL } }, 306, "551190" }, { { { "HEAD", "/308", 308 }, - { NULL } }, 308 }, + { NULL } }, 308, "551190" }, /* Test double-redirect */ { { { "GET", "/301/302", 301 }, { "GET", "/302", 302 }, - { "GET", "/", 200 } }, 200 }, + { "GET", "/", 200 } }, 200, NULL }, { { { "HEAD", "/301/302", 301 }, { "HEAD", "/302", 302 }, - { "HEAD", "/", 200 } }, 200 }, + { "HEAD", "/", 200 } }, 200, "551190" }, /* POST should only automatically redirect on 301, 302 and 303 */ { { { "POST", "/301", 301 }, { "GET", "/", 200 }, - { NULL } }, 200 }, + { NULL } }, 200, "586692" }, { { { "POST", "/302", 302 }, { "GET", "/", 200 }, - { NULL } }, 200 }, + { NULL } }, 200, NULL }, { { { "POST", "/303", 303 }, { "GET", "/", 200 }, - { NULL } }, 200 }, + { NULL } }, 200, NULL }, { { { "POST", "/307", 307 }, - { NULL } }, 307 }, + { NULL } }, 307, NULL }, /* Test behavior with recoverably-bad Location header */ { { { "GET", "/bad", 302 }, { "GET", "/bad%20with%20spaces", 200 }, - { NULL } }, 200 }, + { NULL } }, 200, "566530" }, /* Test behavior with irrecoverably-bad Location header */ { { { "GET", "/bad-no-host", 302 }, - { NULL } }, SOUP_STATUS_MALFORMED, 302 }, + { NULL } }, SOUP_STATUS_MALFORMED, "528882" }, /* Test infinite redirection */ { { { "GET", "/bad-recursive", 302, TRUE }, - { NULL } }, SOUP_STATUS_TOO_MANY_REDIRECTS }, + { NULL } }, SOUP_STATUS_TOO_MANY_REDIRECTS, "604383" }, /* Test redirection to a different server */ { { { "GET", "/server2", 302 }, { "GET", "/on-server2", 200 }, - { NULL } }, 200 }, + { NULL } }, 200, NULL }, }; static const int n_tests = G_N_ELEMENTS (tests); @@ -163,6 +163,9 @@ do_message_api_test (SoupSession *session, TestCase *test) SoupMessage *msg; TestRequest *treq; + if (test->bugref) + g_test_bug (test->bugref); + uri = soup_uri_new_with_base (base_uri, test->requests[0].path); msg = soup_message_new_from_uri (test->requests[0].method, uri); soup_uri_free (uri); @@ -196,11 +199,9 @@ do_request_api_test (SoupSession *session, TestCase *test) TestRequest *treq; GInputStream *stream; GError *error = NULL; - guint final_status; - final_status = test->request_api_final_status; - if (!final_status) - final_status = test->final_status; + if (test->bugref) + g_test_bug (test->bugref); uri = soup_uri_new_with_base (base_uri, test->requests[0].path); reqh = soup_session_request_http_uri (session, @@ -229,8 +230,9 @@ do_request_api_test (SoupSession *session, TestCase *test) stream = soup_test_request_send (SOUP_REQUEST (reqh), NULL, 0, &error); - if (SOUP_STATUS_IS_TRANSPORT_ERROR (final_status)) { - g_assert_error (error, SOUP_HTTP_ERROR, final_status); + if (SOUP_STATUS_IS_TRANSPORT_ERROR (test->final_status) && + test->final_status != SOUP_STATUS_MALFORMED) { + g_assert_error (error, SOUP_HTTP_ERROR, test->final_status); g_clear_error (&error); g_assert_null (stream); @@ -258,7 +260,10 @@ do_request_api_test (SoupSession *session, TestCase *test) g_clear_error (&error); g_object_unref (stream); - g_assert_cmpint (msg->status_code, ==, final_status); + if (test->final_status == SOUP_STATUS_MALFORMED) + g_assert_cmpint (msg->status_code, ==, test->requests[0].status_code); + else + g_assert_cmpint (msg->status_code, ==, test->final_status); g_object_unref (msg); g_object_unref (reqh); diff --git a/tests/requester-test.c b/tests/requester-test.c index 52c3eac2..39b30bd5 100644 --- a/tests/requester-test.c +++ b/tests/requester-test.c @@ -336,6 +336,8 @@ do_simple_plain_test (gconstpointer uri) { SoupSession *session; + g_test_bug ("653707"); + session = soup_test_session_new (SOUP_TYPE_SESSION, NULL); do_test_for_thread_and_context (session, uri); soup_test_session_abort_unref (session); @@ -346,6 +348,8 @@ do_simple_async_test (gconstpointer uri) { SoupSession *session; + g_test_bug ("653707"); + session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, SOUP_SESSION_USE_THREAD_CONTEXT, TRUE, NULL); @@ -359,6 +363,8 @@ do_test_with_context_and_type (const char *uri, gboolean plain_session) GMainContext *async_context; SoupSession *session; + g_test_bug ("653707"); + async_context = g_main_context_new (); g_main_context_push_thread_default (async_context); @@ -750,6 +756,9 @@ do_async_close_test (gconstpointer uri) SoupSession *session; SoupURI *slow_uri; + g_test_bug ("695652"); + g_test_bug ("711260"); + slow_uri = soup_uri_new (uri); soup_uri_set_path (slow_uri, "/slow"); @@ -768,6 +777,9 @@ do_sync_close_test (gconstpointer uri) SoupSession *session; SoupURI *slow_uri; + g_test_bug ("695652"); + g_test_bug ("711260"); + slow_uri = soup_uri_new (uri); soup_uri_set_path (slow_uri, "/slow"); diff --git a/tests/server-test.c b/tests/server-test.c index 1648c4f6..0c980908 100644 --- a/tests/server-test.c +++ b/tests/server-test.c @@ -65,6 +65,8 @@ do_star_test (void) SoupURI *star_uri; const char *handled_by; + g_test_bug ("590751"); + session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL); star_uri = soup_uri_copy (base_uri); soup_uri_set_path (star_uri, "*"); @@ -175,6 +177,8 @@ do_server_aliases_test (void) char *https_bad[] = { "http", "dav", "fred", NULL }; int i; + g_test_bug ("703694"); + for (i = 0; http_good[i]; i++) do_one_server_aliases_test (base_uri, http_good[i], TRUE); for (i = 0; http_bad[i]; i++) @@ -195,6 +199,8 @@ do_dot_dot_test (void) SoupMessage *msg; SoupURI *uri; + g_test_bug ("667635"); + session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL); uri = soup_uri_new_with_base (base_uri, "/..%2ftest"); @@ -237,6 +243,8 @@ do_ipv6_test (void) SoupSession *session; SoupMessage *msg; + g_test_bug ("666399"); + ipv6_addr = soup_address_new ("::1", SOUP_ADDRESS_ANY_PORT); soup_address_resolve_sync (ipv6_addr, NULL); ipv6_server = soup_server_new (SOUP_SERVER_INTERFACE, ipv6_addr, diff --git a/tests/session-test.c b/tests/session-test.c index b652ee5c..15072058 100644 --- a/tests/session-test.c +++ b/tests/session-test.c @@ -202,6 +202,8 @@ do_priority_tests (gconstpointer data) SOUP_MESSAGE_PRIORITY_HIGH, SOUP_MESSAGE_PRIORITY_NORMAL }; + g_test_bug ("696277"); + session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL); g_object_set (session, "max-conns", 1, NULL); @@ -261,6 +263,8 @@ do_property_tests (void) GTlsDatabase *tlsdb, *default_tlsdb; SoupURI *uri; + g_test_bug ("708696"); + default_proxy_resolver = g_proxy_resolver_get_default (); default_tlsdb = g_tls_backend_get_default_database (g_tls_backend_get_default ()); diff --git a/tests/sniffing-test.c b/tests/sniffing-test.c index 59f874f4..32fad9fc 100644 --- a/tests/sniffing-test.c +++ b/tests/sniffing-test.c @@ -302,6 +302,7 @@ do_signals_tests (gconstpointer data) do_signals_test (should_content_sniff, TRUE, FALSE, TRUE, FALSE); + /* FIXME g_test_bug ("587907") */ do_signals_test (should_content_sniff, TRUE, TRUE, FALSE, TRUE); do_signals_test (should_content_sniff, @@ -397,6 +398,8 @@ test_disabled (gconstpointer data) const char *sniffed_content_type; GError *error = NULL; + g_test_bug ("574773"); + uri = soup_uri_new_with_base (base_uri, path); msg = soup_message_new_from_uri ("GET", uri); @@ -522,6 +525,7 @@ main (int argc, char **argv) g_test_add_data_func ("/sniffing/type/unknown-binary", "unknown/text_binary.txt => application/octet-stream", do_sniffing_test); + /* FIXME g_test_bug ("715126") */ g_test_add_data_func ("/sniffing/type/unknown-leading-space", "unknown/leading_space.html => text/html", do_sniffing_test); diff --git a/tests/socket-test.c b/tests/socket-test.c index 4fb0d35c..5bcc3b0c 100644 --- a/tests/socket-test.c +++ b/tests/socket-test.c @@ -18,6 +18,8 @@ do_unconnected_socket_test (void) guint res; struct sockaddr_in in_localhost; + g_test_bug ("673083"); + in_localhost.sin_family = AF_INET; in_localhost.sin_port = 0; in_localhost.sin_addr.s_addr = htonl (INADDR_LOOPBACK); diff --git a/tests/ssl-test.c b/tests/ssl-test.c index b042d120..e6bbb615 100644 --- a/tests/ssl-test.c +++ b/tests/ssl-test.c @@ -20,6 +20,8 @@ do_properties_test_for_session (SoupSession *session, const char *uri) g_assert_cmpuint (flags, ==, G_TLS_CERTIFICATE_UNKNOWN_CA); } else soup_test_assert (FALSE, "Response not https"); + + g_test_bug ("665182"); g_assert_false (soup_message_get_flags (msg) & SOUP_MESSAGE_CERTIFICATE_TRUSTED); g_object_unref (msg); @@ -110,7 +112,11 @@ do_strictness_test (gconstpointer data) msg = soup_message_new ("GET", uri); soup_session_send_message (session, msg); soup_test_assert_message_status (msg, test->expected_status); + + g_test_bug ("690176"); g_assert_true (soup_message_get_https_status (msg, NULL, &flags)); + + g_test_bug ("665182"); if (test->with_ca_list && SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) g_assert_true (soup_message_get_flags (msg) & SOUP_MESSAGE_CERTIFICATE_TRUSTED); else @@ -141,6 +147,8 @@ do_session_property_tests (void) char *ca_file; SoupSession *session; + g_test_bug ("673678"); + SOUP_TEST_SKIP_IF_NO_TLS; session = soup_session_async_new (); diff --git a/tests/streaming-test.c b/tests/streaming-test.c index f15e1890..8d8c02ef 100644 --- a/tests/streaming-test.c +++ b/tests/streaming-test.c @@ -126,6 +126,8 @@ do_eof_test (gconstpointer data) SoupURI *base_uri = (SoupURI *)data; SoupSession *session; + g_test_bug ("572153"); + session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL); do_request (session, base_uri, "eof"); soup_test_session_abort_unref (session); diff --git a/tests/test-utils.c b/tests/test-utils.c index 69a9426b..bc160aea 100644 --- a/tests/test-utils.c +++ b/tests/test-utils.c @@ -76,6 +76,7 @@ test_init (int argc, char **argv, GOptionEntry *entries) g_test_init (&argc, &argv, NULL); g_test_set_nonfatal_assertions (); + g_test_bug_base ("https://bugzilla.gnome.org/"); opts = g_option_context_new (NULL); g_option_context_add_main_entries (opts, debug_entry, NULL); diff --git a/tests/tld-test.c b/tests/tld-test.c index 2e7f8a21..4fad8625 100644 --- a/tests/tld-test.c +++ b/tests/tld-test.c @@ -157,6 +157,9 @@ do_non_inet_tests (void) { int i; + g_test_bug ("679230"); + g_test_bug ("681085"); + for (i = 0; i < G_N_ELEMENTS (non_inet_tld_tests); i++) { gboolean is_public; const char *base_domain; diff --git a/tests/uri-parsing.c b/tests/uri-parsing.c index e67253e3..d56b655f 100644 --- a/tests/uri-parsing.c +++ b/tests/uri-parsing.c @@ -3,154 +3,154 @@ #include "test-utils.h" static struct { - const char *uri_string, *result; + const char *uri_string, *result, *bugref; const SoupURI bits; } abs_tests[] = { - { "foo:", "foo:", + { "foo:", "foo:", NULL, { "foo", NULL, NULL, NULL, 0, "", NULL, NULL } }, - { "file:/dev/null", "file:/dev/null", + { "file:/dev/null", "file:/dev/null", NULL, { "file", NULL, NULL, NULL, 0, "/dev/null", NULL, NULL } }, - { "file:///dev/null", "file:///dev/null", + { "file:///dev/null", "file:///dev/null", NULL, { "file", NULL, NULL, "", 0, "/dev/null", NULL, NULL } }, - { "ftp://user@host/path", "ftp://user@host/path", + { "ftp://user@host/path", "ftp://user@host/path", NULL, { "ftp", "user", NULL, "host", 21, "/path", NULL, NULL } }, - { "ftp://user@host:9999/path", "ftp://user@host:9999/path", + { "ftp://user@host:9999/path", "ftp://user@host:9999/path", NULL, { "ftp", "user", NULL, "host", 9999, "/path", NULL, NULL } }, - { "ftp://user:password@host/path", "ftp://user@host/path", + { "ftp://user:password@host/path", "ftp://user@host/path", NULL, { "ftp", "user", "password", "host", 21, "/path", NULL, NULL } }, - { "ftp://user:password@host:9999/path", "ftp://user@host:9999/path", + { "ftp://user:password@host:9999/path", "ftp://user@host:9999/path", NULL, { "ftp", "user", "password", "host", 9999, "/path", NULL, NULL } }, - { "ftp://user:password@host", "ftp://user@host", + { "ftp://user:password@host", "ftp://user@host", NULL, { "ftp", "user", "password", "host", 21, "", NULL, NULL } }, - { "http://us%65r@host", "http://user@host/", + { "http://us%65r@host", "http://user@host/", NULL, { "http", "user", NULL, "host", 80, "/", NULL, NULL } }, - { "http://us%40r@host", "http://us%40r@host/", + { "http://us%40r@host", "http://us%40r@host/", NULL, { "http", "us\x40r", NULL, "host", 80, "/", NULL, NULL } }, - { "http://us%3ar@host", "http://us%3Ar@host/", + { "http://us%3ar@host", "http://us%3Ar@host/", NULL, { "http", "us\x3ar", NULL, "host", 80, "/", NULL, NULL } }, - { "http://us%2fr@host", "http://us%2Fr@host/", + { "http://us%2fr@host", "http://us%2Fr@host/", NULL, { "http", "us\x2fr", NULL, "host", 80, "/", NULL, NULL } }, - { "http://us%3fr@host", "http://us%3Fr@host/", + { "http://us%3fr@host", "http://us%3Fr@host/", NULL, { "http", "us\x3fr", NULL, "host", 80, "/", NULL, NULL } }, - { "http://host?query", "http://host/?query", + { "http://host?query", "http://host/?query", NULL, { "http", NULL, NULL, "host", 80, "/", "query", NULL } }, { "http://host/path?query=http%3A%2F%2Fhost%2Fpath%3Fchildparam%3Dchildvalue¶m=value", - "http://host/path?query=http%3A%2F%2Fhost%2Fpath%3Fchildparam%3Dchildvalue¶m=value", + "http://host/path?query=http%3A%2F%2Fhost%2Fpath%3Fchildparam%3Dchildvalue¶m=value", NULL, { "http", NULL, NULL, "host", 80, "/path", "query=http%3A%2F%2Fhost%2Fpath%3Fchildparam%3Dchildvalue¶m=value", NULL } }, { "http://control-chars/%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%7F", - "http://control-chars/%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%7F", + "http://control-chars/%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%7F", NULL, { "http", NULL, NULL, "control-chars", 80, "/%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%7F", NULL, NULL } }, { "http://space/%20", - "http://space/%20", + "http://space/%20", NULL, { "http", NULL, NULL, "space", 80, "/%20", NULL, NULL } }, { "http://delims/%3C%3E%23%25%22", - "http://delims/%3C%3E%23%25%22", + "http://delims/%3C%3E%23%25%22", NULL, { "http", NULL, NULL, "delims", 80, "/%3C%3E%23%25%22", NULL, NULL } }, { "http://unwise-chars/%7B%7D%7C%5C%5E%5B%5D%60", - "http://unwise-chars/%7B%7D%7C%5C%5E%5B%5D%60", + "http://unwise-chars/%7B%7D%7C%5C%5E%5B%5D%60", NULL, { "http", NULL, NULL, "unwise-chars", 80, "/%7B%7D%7C%5C%5E%5B%5D%60", NULL, NULL } }, /* From RFC 2732 */ { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html", - "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]/index.html", + "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]/index.html", NULL, { "http", NULL, NULL, "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210", 80, "/index.html", NULL, NULL } }, { "http://[1080:0:0:0:8:800:200C:417A]/index.html", - "http://[1080:0:0:0:8:800:200C:417A]/index.html", + "http://[1080:0:0:0:8:800:200C:417A]/index.html", NULL, { "http", NULL, NULL, "1080:0:0:0:8:800:200C:417A", 80, "/index.html", NULL, NULL } }, { "http://[3ffe:2a00:100:7031::1]", - "http://[3ffe:2a00:100:7031::1]/", + "http://[3ffe:2a00:100:7031::1]/", NULL, { "http", NULL, NULL, "3ffe:2a00:100:7031::1", 80, "/", NULL, NULL } }, { "http://[1080::8:800:200C:417A]/foo", - "http://[1080::8:800:200C:417A]/foo", + "http://[1080::8:800:200C:417A]/foo", NULL, { "http", NULL, NULL, "1080::8:800:200C:417A", 80, "/foo", NULL, NULL } }, { "http://[::192.9.5.5]/ipng", - "http://[::192.9.5.5]/ipng", + "http://[::192.9.5.5]/ipng", NULL, { "http", NULL, NULL, "::192.9.5.5", 80, "/ipng", NULL, NULL } }, { "http://[::FFFF:129.144.52.38]:80/index.html", - "http://[::FFFF:129.144.52.38]/index.html", + "http://[::FFFF:129.144.52.38]/index.html", NULL, { "http", NULL, NULL, "::FFFF:129.144.52.38", 80, "/index.html", NULL, NULL } }, { "http://[2010:836B:4179::836B:4179]", - "http://[2010:836B:4179::836B:4179]/", + "http://[2010:836B:4179::836B:4179]/", NULL, { "http", NULL, NULL, "2010:836B:4179::836B:4179", 80, "/", NULL, NULL } }, /* Try to recover certain kinds of invalid URIs */ { "http://host/path with spaces", - "http://host/path%20with%20spaces", + "http://host/path%20with%20spaces", "566530", { "http", NULL, NULL, "host", 80, "/path%20with%20spaces", NULL, NULL } }, - { " http://host/path", "http://host/path", + { " http://host/path", "http://host/path", "594405", { "http", NULL, NULL, "host", 80, "/path", NULL, NULL } }, - { "http://host/path ", "http://host/path", + { "http://host/path ", "http://host/path", "594405", { "http", NULL, NULL, "host", 80, "/path", NULL, NULL } }, - { "http://host ", "http://host/", + { "http://host ", "http://host/", "594405", { "http", NULL, NULL, "host", 80, "/", NULL, NULL } }, - { "http://host:999 ", "http://host:999/", + { "http://host:999 ", "http://host:999/", "594405", { "http", NULL, NULL, "host", 999, "/", NULL, NULL } }, - { "http://host/pa\nth", "http://host/path", + { "http://host/pa\nth", "http://host/path", "594405", { "http", NULL, NULL, "host", 80, "/path", NULL, NULL } }, - { "http:\r\n//host/path", "http://host/path", + { "http:\r\n//host/path", "http://host/path", "594405", { "http", NULL, NULL, "host", 80, "/path", NULL, NULL } }, - { "http://\thost/path", "http://host/path", + { "http://\thost/path", "http://host/path", "594405", { "http", NULL, NULL, "host", 80, "/path", NULL, NULL } }, - /* Bug 594405; 0-length is different from not-present */ - { "http://host/path?", "http://host/path?", + /* 0-length is different from not-present */ + { "http://host/path?", "http://host/path?", "594405", { "http", NULL, NULL, "host", 80, "/path", "", NULL } }, - { "http://host/path#", "http://host/path#", + { "http://host/path#", "http://host/path#", "594405", { "http", NULL, NULL, "host", 80, "/path", NULL, "" } }, - /* Bug 590524; ignore badly-%-encoding */ - { "http://host/path%", "http://host/path%", + /* ignore bad %-encoding */ + { "http://host/path%", "http://host/path%", "590524", { "http", NULL, NULL, "host", 80, "/path%", NULL, NULL } }, - { "http://h%ost/path", "http://h%25ost/path", + { "http://h%ost/path", "http://h%25ost/path", "590524", { "http", NULL, NULL, "h%ost", 80, "/path", NULL, NULL } }, - { "http://host/path%%", "http://host/path%%", + { "http://host/path%%", "http://host/path%%", "590524", { "http", NULL, NULL, "host", 80, "/path%%", NULL, NULL } }, - { "http://host/path%%%", "http://host/path%%%", + { "http://host/path%%%", "http://host/path%%%", "590524", { "http", NULL, NULL, "host", 80, "/path%%%", NULL, NULL } }, - { "http://host/path%/x/", "http://host/path%/x/", + { "http://host/path%/x/", "http://host/path%/x/", "590524", { "http", NULL, NULL, "host", 80, "/path%/x/", NULL, NULL } }, - { "http://host/path%0x/", "http://host/path%0x/", + { "http://host/path%0x/", "http://host/path%0x/", "590524", { "http", NULL, NULL, "host", 80, "/path%0x/", NULL, NULL } }, - { "http://host/path%ax", "http://host/path%ax", + { "http://host/path%ax", "http://host/path%ax", "590524", { "http", NULL, NULL, "host", 80, "/path%ax", NULL, NULL } }, - /* Bug 662806; %-encode non-ASCII characters */ - { "http://host/p\xc3\xa4th/", "http://host/p%C3%A4th/", + /* %-encode non-ASCII characters */ + { "http://host/p\xc3\xa4th/", "http://host/p%C3%A4th/", "662806", { "http", NULL, NULL, "host", 80, "/p%C3%A4th/", NULL, NULL } }, - { "HTTP:////////////////", "http:////////////////", + { "HTTP:////////////////", "http:////////////////", "667637", { "http", NULL, NULL, "", 80, "//////////////", NULL, NULL } }, - { "http://@host", "http://@host/", + { "http://@host", "http://@host/", NULL, { "http", "", NULL, "host", 80, "/", NULL, NULL } }, - { "http://:@host", "http://@host/", + { "http://:@host", "http://@host/", NULL, { "http", "", "", "host", 80, "/", NULL, NULL } }, - { "http://host/keep%00nuls", "http://host/keep%00nuls", + { "http://host/keep%00nuls", "http://host/keep%00nuls", NULL, { "http", NULL, NULL, "host", 80, "/keep%00nuls", NULL, NULL } }, - /* Bug 703776; scheme parsing */ - { "foo0://host/path", "foo0://host/path", + /* scheme parsing */ + { "foo0://host/path", "foo0://host/path", "703776", { "foo0", NULL, NULL, "host", 0, "/path", NULL, NULL } }, - { "f0.o://host/path", "f0.o://host/path", + { "f0.o://host/path", "f0.o://host/path", "703776", { "f0.o", NULL, NULL, "host", 0, "/path", NULL, NULL } }, - { "http++://host/path", "http++://host/path", + { "http++://host/path", "http++://host/path", "703776", { "http++", NULL, NULL, "host", 0, "/path", NULL, NULL } }, - { "http-ish://host/path", "http-ish://host/path", + { "http-ish://host/path", "http-ish://host/path", "703776", { "http-ish", NULL, NULL, "host", 0, "/path", NULL, NULL } }, - { "99http://host/path", NULL, + { "99http://host/path", NULL, "703776", { NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL } }, - { ".http://host/path", NULL, + { ".http://host/path", NULL, "703776", { NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL } }, - { "+http://host/path", NULL, + { "+http://host/path", NULL, "703776", { NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL } }, /* IPv6 scope ID parsing (both correct and incorrect) */ - { "http://[fe80::dead:beef%em1]/", "http://[fe80::dead:beef%25em1]/", + { "http://[fe80::dead:beef%em1]/", "http://[fe80::dead:beef%25em1]/", NULL, { "http", NULL, NULL, "fe80::dead:beef%em1", 80, "/", NULL, NULL } }, - { "http://[fe80::dead:beef%25em1]/", "http://[fe80::dead:beef%25em1]/", + { "http://[fe80::dead:beef%25em1]/", "http://[fe80::dead:beef%25em1]/", NULL, { "http", NULL, NULL, "fe80::dead:beef%em1", 80, "/", NULL, NULL } }, - { "http://[fe80::dead:beef%10]/", "http://[fe80::dead:beef%2510]/", + { "http://[fe80::dead:beef%10]/", "http://[fe80::dead:beef%2510]/", NULL, { "http", NULL, NULL, "fe80::dead:beef%10", 80, "/", NULL, NULL } } }; static int num_abs_tests = G_N_ELEMENTS(abs_tests); @@ -255,14 +255,14 @@ static struct { static int num_rel_tests = G_N_ELEMENTS(rel_tests); static struct { - const char *one, *two; + const char *one, *two, *bugref; } eq_tests[] = { - { "example://a/b/c/%7Bfoo%7D", "eXAMPLE://a/./b/../b/%63/%7Bfoo%7D" }, - { "http://example.com", "http://example.com/" }, + { "example://a/b/c/%7Bfoo%7D", "eXAMPLE://a/./b/../b/%63/%7Bfoo%7D", "628728" }, + { "http://example.com", "http://example.com/", NULL }, /* From RFC 2616 */ - { "http://abc.com:80/~smith/home.html", "http://abc.com:80/~smith/home.html" }, - { "http://abc.com:80/~smith/home.html", "http://ABC.com/%7Esmith/home.html" }, - { "http://abc.com:80/~smith/home.html", "http://ABC.com:/%7esmith/home.html" }, + { "http://abc.com:80/~smith/home.html", "http://abc.com:80/~smith/home.html", NULL }, + { "http://abc.com:80/~smith/home.html", "http://ABC.com/%7Esmith/home.html", NULL }, + { "http://abc.com:80/~smith/home.html", "http://ABC.com:/%7esmith/home.html", NULL }, }; static int num_eq_tests = G_N_ELEMENTS(eq_tests); @@ -313,6 +313,8 @@ do_absolute_uri_tests (void) int i; for (i = 0; i < num_abs_tests; i++) { + if (abs_tests[i].bugref) + g_test_bug (abs_tests[i].bugref); do_uri (NULL, NULL, abs_tests[i].uri_string, abs_tests[i].result, &abs_tests[i].bits); } @@ -349,6 +351,9 @@ do_equality_tests (void) int i; for (i = 0; i < num_eq_tests; i++) { + if (eq_tests[i].bugref) + g_test_bug (eq_tests[i].bugref); + uri1 = soup_uri_new (eq_tests[i].one); uri2 = soup_uri_new (eq_tests[i].two); @@ -366,6 +371,9 @@ do_soup_uri_null_tests (void) SoupURI *uri, *uri2; char *uri_string; + g_test_bug ("667637"); + g_test_bug ("670431"); + uri = soup_uri_new (NULL); g_assert_false (SOUP_URI_IS_VALID (uri)); g_assert_false (SOUP_URI_VALID_FOR_HTTP (uri)); @@ -464,6 +472,8 @@ do_normalization_tests (void) char *normalized; int i; + g_test_bug ("680018"); + for (i = 0; i < num_normalization_tests; i++) { if (normalization_tests[i].unescape_extra) { debug_printf (1, "<%s> unescaping <%s> => <%s>\n", diff --git a/tests/xmlrpc-test.c b/tests/xmlrpc-test.c index 3f26edd4..f6b20b8f 100644 --- a/tests/xmlrpc-test.c +++ b/tests/xmlrpc-test.c @@ -393,6 +393,8 @@ test_ping (gconstpointer include_params) char *out; gboolean ret; + g_test_bug ("671661"); + SOUP_TEST_SKIP_IF_NO_XMLRPC_SERVER; debug_printf (2, "ping (void (%s) -> string)\n", -- cgit v1.2.1