summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2010-03-13 12:22:16 -0500
committerDan Winship <danw@gnome.org>2010-03-13 12:32:47 -0500
commitc758faac607015d8f8d4b25e3a692b7cedecc2e8 (patch)
tree2338bc18f4d9845f1e945a70904df60aa5e074f5 /tests
parentd08ed91a7da4bd25180d6ddf19500f2a7b729c6d (diff)
downloadlibsoup-c758faac607015d8f8d4b25e3a692b7cedecc2e8.tar.gz
libsoup-c758faac607015d8f8d4b25e3a692b7cedecc2e8.tar.bz2
libsoup-c758faac607015d8f8d4b25e3a692b7cedecc2e8.zip
Don't bind to public interfaces for tests.
based on a patch from Saleem Abdulrasool. https://bugzilla.gnome.org/show_bug.cgi?id=609489
Diffstat (limited to 'tests')
-rw-r--r--tests/misc-test.c7
-rw-r--r--tests/ssl-test.c2
-rw-r--r--tests/test-utils.c7
3 files changed, 13 insertions, 3 deletions
diff --git a/tests/misc-test.c b/tests/misc-test.c
index fdacbb38..c3b5d2d9 100644
--- a/tests/misc-test.c
+++ b/tests/misc-test.c
@@ -181,6 +181,7 @@ static void
do_callback_unref_test (void)
{
SoupServer *bad_server;
+ SoupAddress *addr;
SoupSession *session;
SoupMessage *one, *two;
GMainLoop *loop;
@@ -189,7 +190,11 @@ do_callback_unref_test (void)
debug_printf (1, "\nCallback unref handling\n");
/* Get a guaranteed-bad URI */
- bad_server = soup_server_new (NULL, NULL);
+ addr = soup_address_new ("127.0.0.1", SOUP_ADDRESS_ANY_PORT);
+ soup_address_resolve_sync (addr, NULL);
+ bad_server = soup_server_new (SOUP_SERVER_INTERFACE, addr,
+ NULL);
+
bad_uri = g_strdup_printf ("http://127.0.0.1:%u/",
soup_server_get_port (bad_server));
g_object_unref (bad_server);
diff --git a/tests/ssl-test.c b/tests/ssl-test.c
index 3df070a5..f071e12b 100644
--- a/tests/ssl-test.c
+++ b/tests/ssl-test.c
@@ -266,7 +266,7 @@ main (int argc, char **argv)
memset (&sin, 0, sizeof (sin));
sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = INADDR_ANY;
+ sin.sin_addr.s_addr = ntohl (INADDR_LOOPBACK);
if (bind (listener, (struct sockaddr *) &sin, sizeof (sin)) == -1) {
SOCKET_PRINT_ERROR ("binding listening socket");
diff --git a/tests/test-utils.c b/tests/test-utils.c
index 8d7e9f62..9a13a53c 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -270,6 +270,7 @@ test_server_new (gboolean in_own_thread, gboolean ssl)
{
GMainContext *async_context;
const char *ssl_cert_file, *ssl_key_file;
+ SoupAddress *addr;
if (test_server)
test_server_shutdown ();
@@ -282,7 +283,11 @@ test_server_new (gboolean in_own_thread, gboolean ssl)
} else
ssl_cert_file = ssl_key_file = NULL;
- test_server = soup_server_new (SOUP_SERVER_ASYNC_CONTEXT, async_context,
+ addr = soup_address_new ("127.0.0.1", SOUP_ADDRESS_ANY_PORT);
+ soup_address_resolve_sync (addr, NULL);
+
+ test_server = soup_server_new (SOUP_SERVER_INTERFACE, addr,
+ SOUP_SERVER_ASYNC_CONTEXT, async_context,
SOUP_SERVER_SSL_CERT_FILE, ssl_cert_file,
SOUP_SERVER_SSL_KEY_FILE, ssl_key_file,
NULL);