2009-03-27 Dan Winship <danw@gnome.org>
+ Bug 576583 – Tests fail if "localhost" resolves to ::1
+
+ * tests/*.c: Use "127.0.0.1" in URIs rather than "localhost",
+ since the default SoupServer config only listen on IPv4 (qv bug
+ 522519), and tests/httpd.conf.in only configures apache to listen
+ on IPv4, and we don't handle multiple IP addresses (qv bug 526321)
+ but the machine might be configured to return "::1" rather than
+ "127.0.0.1" first for "localhost". Patch from Andreas Rottmann.
+
+2009-03-27 Dan Winship <danw@gnome.org>
+
* libsoup/soup-cookie.c (soup_cookie_new): Fix docs to not claim
that the cookie domain can be %NULL. Add some g_return_if_fail()s.
soup_server_add_handler (server, NULL,
server_callback, NULL, NULL);
- uri = soup_uri_new ("http://localhost/");
+ uri = soup_uri_new ("http://127.0.0.1/");
soup_uri_set_port (uri, soup_server_get_port (server));
basic_auth_domain = soup_auth_domain_basic_new (
test_init (argc, argv, NULL);
apache_init ();
- base_uri = "http://localhost:47524/";
+ base_uri = "http://127.0.0.1:47524/";
session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
g_signal_connect (session, "authenticate",
loop = g_main_loop_new (NULL, TRUE);
- base_uri = soup_uri_new ("http://localhost");
+ base_uri = soup_uri_new ("http://127.0.0.1");
soup_uri_set_port (base_uri, port);
do_chunk_tests (base_uri);
soup_uri_free (base_uri);
server = soup_test_server_new (TRUE);
soup_server_add_handler (server, NULL, server_callback, NULL, NULL);
- base_uri = g_strdup_printf ("http://localhost:%u/",
+ base_uri = g_strdup_printf ("http://127.0.0.1:%u/",
soup_server_get_port (server));
do_test1 ();
expect_continue ? "" : "no ",
auth ? "with" : "without");
- uri = g_strdup_printf ("http://%slocalhost:%d/%s",
+ uri = g_strdup_printf ("http://%s127.0.0.1:%d/%s",
auth ? "user:pass@" : "",
port, path);
msg = soup_message_new ("POST", uri);
loop = g_main_loop_new (NULL, TRUE);
if (run_tests) {
- uri_str = g_strdup_printf ("http://localhost:%u/hello", port);
+ uri_str = g_strdup_printf ("http://127.0.0.1:%u/hello", port);
do_hello_tests (uri_str);
g_free (uri_str);
- uri_str = g_strdup_printf ("http://localhost:%u/md5", port);
+ uri_str = g_strdup_printf ("http://127.0.0.1:%u/md5", port);
do_md5_tests (uri_str);
g_free (uri_str);
} else {
/* Get a guaranteed-bad URI */
bad_server = soup_server_new (NULL, NULL);
- bad_uri = g_strdup_printf ("http://localhost:%u/",
+ bad_uri = g_strdup_printf ("http://127.0.0.1:%u/",
soup_server_get_port (bad_server));
g_object_unref (bad_server);
server = soup_test_server_new (TRUE);
soup_server_add_handler (server, NULL, server_callback, NULL, NULL);
- base_uri = soup_uri_new ("http://localhost/");
+ base_uri = soup_uri_new ("http://127.0.0.1/");
soup_uri_set_port (base_uri, soup_server_get_port (server));
auth_domain = soup_auth_domain_basic_new (
loop = g_main_loop_new (NULL, TRUE);
- uri = soup_uri_new ("http://localhost/");
+ uri = soup_uri_new ("http://127.0.0.1/");
soup_uri_set_port (uri, soup_server_get_port (server));
do_ntlm_tests (uri);
soup_uri_free (uri);
test_init (argc, argv, NULL);
apache_init ();
- base_uri = "http://localhost:47524/";
+ base_uri = "http://127.0.0.1:47524/";
get_correct_response (base_uri);
debug_printf (1, "\nFully async, fast requests\n");
session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
debug_printf (1, "1. Testing against apache\n");
- do_range_test (session, "http://localhost:47524/", FALSE);
+ do_range_test (session, "http://127.0.0.1:47524/", FALSE);
debug_printf (1, "\n2. Testing against SoupServer\n");
server = soup_test_server_new (FALSE);
soup_server_add_handler (server, NULL, server_handler, NULL, NULL);
- base_uri = g_strdup_printf ("http://localhost:%u/",
+ base_uri = g_strdup_printf ("http://127.0.0.1:%u/",
soup_server_get_port (server));
do_range_test (session, base_uri, TRUE);
g_free (base_uri);
loop = g_main_loop_new (NULL, TRUE);
if (run_tests) {
- base_uri = soup_uri_new ("http://localhost");
+ base_uri = soup_uri_new ("http://127.0.0.1");
soup_uri_set_port (base_uri, port);
do_redirect_tests (base_uri);
soup_uri_free (base_uri);
loop = g_main_loop_new (NULL, TRUE);
if (run_tests) {
- uri = soup_uri_new ("http://localhost");
+ uri = soup_uri_new ("http://127.0.0.1");
soup_uri_set_port (uri, soup_server_get_port (server));
do_auth_tests (uri);
soup_uri_free (uri);
loop = g_main_loop_new (NULL, TRUE);
- base_uri = soup_uri_new ("http://localhost");
+ base_uri = soup_uri_new ("http://127.0.0.1");
soup_uri_set_port (base_uri, port);
do_tests (base_uri);
soup_uri_free (base_uri);
loop = g_main_loop_new (NULL, TRUE);
if (run_tests) {
- uri = soup_uri_new ("http://localhost/xmlrpc-server.php");
+ uri = soup_uri_new ("http://127.0.0.1/xmlrpc-server.php");
soup_uri_set_port (uri, soup_server_get_port (server));
do_xmlrpc_tests (uri);
soup_uri_free (uri);
#include "test-utils.h"
static SoupSession *session;
-static const char *default_uri = "http://localhost:47524/xmlrpc-server.php";
+static const char *default_uri = "http://127.0.0.1:47524/xmlrpc-server.php";
static const char *uri = NULL;
static gboolean server_test = FALSE;