[libsoup] Don't bind to public interfaces for tests.
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] Don't bind to public interfaces for tests.
- Date: Sat, 13 Mar 2010 17:40:09 +0000 (UTC)
commit c758faac607015d8f8d4b25e3a692b7cedecc2e8
Author: Dan Winship <danw gnome org>
Date: Sat Mar 13 12:22:16 2010 -0500
Don't bind to public interfaces for tests.
based on a patch from Saleem Abdulrasool.
https://bugzilla.gnome.org/show_bug.cgi?id=609489
tests/misc-test.c | 7 ++++++-
tests/ssl-test.c | 2 +-
tests/test-utils.c | 7 ++++++-
3 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/tests/misc-test.c b/tests/misc-test.c
index fdacbb3..c3b5d2d 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 3df070a..f071e12 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 8d7e9f6..9a13a53 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]