summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2017-03-15 12:14:53 +0000
committerPhilip Withnall <withnall@endlessm.com>2017-03-15 12:14:53 +0000
commit25225e375ec64a0e4b822c4db8bace07deea78d4 (patch)
treeec9e825cce822e5abae82b4a349754106eb7aef6
parent192bcf3ec7752aaf03f19a1f801a9d66cf306a69 (diff)
downloadlibgdata-25225e375ec64a0e4b822c4db8bace07deea78d4.tar.gz
build: Bump libsoup dependency for streams test to 2.55.90
Previously the streams test depended on new API added in libsoup 2.47.3. It still depends on that API, but it’s become apparent that there was a bug in libsoup which rendered soup_server_set_ssl_cert_file() useless until libsoup 2.55.90. Bump the dependency (for the test code only) to 2.55.90. Thanks to Mart Raudsepp for their help in debugging. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://bugzilla.gnome.org/show_bug.cgi?id=780081
-rw-r--r--configure.ac11
-rw-r--r--gdata/tests/streams.c42
2 files changed, 27 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac
index 5cfb45fc..42314712 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,11 +93,12 @@ GDATA_CFLAGS="$GDATA_CFLAGS -DJSON_VERSION_MIN_REQUIRED=$JSON_GLIB_MIN_REQUIRED
AC_SUBST(GDATA_CFLAGS)
AC_SUBST(GDATA_LIBS)
-# libsoup 2.47.3 is needed for the new SoupServer API.
-PKG_CHECK_MODULES([LIBSOUP], [libsoup-2.4 >= 2.47.3],
- [have_libsoup_2_47_3=yes], [have_libsoup_2_47_3=no])
-AS_IF([test "x$have_libsoup_2_47_3" = "xyes"], [
- AC_DEFINE([HAVE_LIBSOUP_2_47_3], [1],
+# libsoup 2.47.3 is needed for the new SoupServer API; but it contained a bug in
+# soup_server_set_ssl_cert_file() which was only fixed in 2.55.90.
+PKG_CHECK_MODULES([LIBSOUP], [libsoup-2.4 >= 2.55.90],
+ [have_libsoup_2_55_90=yes], [have_libsoup_2_55_90=no])
+AS_IF([test "x$have_libsoup_2_55_90" = "xyes"], [
+ AC_DEFINE([HAVE_LIBSOUP_2_55_90], [1],
[Define if the new SoupServer API is available])
])
diff --git a/gdata/tests/streams.c b/gdata/tests/streams.c
index 1de8e50e..7158754f 100644
--- a/gdata/tests/streams.c
+++ b/gdata/tests/streams.c
@@ -30,7 +30,7 @@
#include "gdata.h"
#include "common.h"
-#ifdef HAVE_LIBSOUP_2_47_3
+#ifdef HAVE_LIBSOUP_2_55_90
static gpointer
run_server_thread (GMainLoop *loop)
{
@@ -40,7 +40,7 @@ run_server_thread (GMainLoop *loop)
return NULL;
}
-#else /* if !HAVE_LIBSOUP_2_47_3 */
+#else /* if !HAVE_LIBSOUP_2_55_90 */
static gpointer
run_server_thread (SoupServer *server)
{
@@ -48,7 +48,7 @@ run_server_thread (SoupServer *server)
return NULL;
}
-#endif /* !HAVE_LIBSOUP_2_47_3 */
+#endif /* !HAVE_LIBSOUP_2_55_90 */
static GThread *
run_server (SoupServer *server, GMainLoop *loop)
@@ -58,16 +58,16 @@ run_server (SoupServer *server, GMainLoop *loop)
GError *error = NULL;
guint16 port;
-#ifdef HAVE_LIBSOUP_2_47_3
+#ifdef HAVE_LIBSOUP_2_55_90
thread = g_thread_try_new ("server-thread", (GThreadFunc) run_server_thread, loop, &error);
-#else /* if !HAVE_LIBSOUP_2_47_3 */
+#else /* if !HAVE_LIBSOUP_2_55_90 */
thread = g_thread_try_new ("server-thread", (GThreadFunc) run_server_thread, server, &error);
-#endif /* !HAVE_LIBSOUP_2_47_3 */
+#endif /* !HAVE_LIBSOUP_2_55_90 */
g_assert_no_error (error);
g_assert (thread != NULL);
/* Set the port so that libgdata doesn't override it. */
-#ifdef HAVE_LIBSOUP_2_47_3
+#ifdef HAVE_LIBSOUP_2_55_90
{
GSList *uris; /* owned */
@@ -77,9 +77,9 @@ run_server (SoupServer *server, GMainLoop *loop)
g_slist_free_full (uris, (GDestroyNotify) soup_uri_free);
}
-#else /* if !HAVE_LIBSOUP_2_47_3 */
+#else /* if !HAVE_LIBSOUP_2_55_90 */
port = soup_server_get_port (server);
-#endif /* !HAVE_LIBSOUP_2_47_3 */
+#endif /* !HAVE_LIBSOUP_2_55_90 */
port_string = g_strdup_printf ("%u", port);
g_setenv ("LIBGDATA_HTTPS_PORT", port_string, TRUE);
@@ -88,7 +88,7 @@ run_server (SoupServer *server, GMainLoop *loop)
return thread;
}
-#ifdef HAVE_LIBSOUP_2_47_3
+#ifdef HAVE_LIBSOUP_2_55_90
static gboolean
quit_server_cb (GMainLoop *loop)
{
@@ -103,7 +103,7 @@ stop_server (SoupServer *server, GMainLoop *loop)
soup_add_completion (g_main_loop_get_context (loop),
(GSourceFunc) quit_server_cb, loop);
}
-#else /* if !HAVE_LIBSOUP_2_47_3 */
+#else /* if !HAVE_LIBSOUP_2_55_90 */
static gboolean
quit_server_cb (SoupServer *server)
{
@@ -118,7 +118,7 @@ stop_server (SoupServer *server, GMainLoop *loop)
soup_add_completion (g_main_loop_get_context (loop),
(GSourceFunc) quit_server_cb, server);
}
-#endif /* !HAVE_LIBSOUP_2_47_3 */
+#endif /* !HAVE_LIBSOUP_2_55_90 */
static gchar *
get_test_string (guint start_num, guint end_num)
@@ -160,23 +160,23 @@ create_server (SoupServerCallback callback, gpointer user_data, GMainLoop **main
{
GMainContext *context;
SoupServer *server;
-#ifdef HAVE_LIBSOUP_2_47_3
+#ifdef HAVE_LIBSOUP_2_55_90
gchar *cert_path = NULL, *key_path = NULL;
GError *error = NULL;
-#else /* if !HAVE_LIBSOUP_2_47_3 */
+#else /* if !HAVE_LIBSOUP_2_55_90 */
union {
struct sockaddr_in in;
struct sockaddr norm;
} sock;
SoupAddress *addr;
-#endif /* HAVE_LIBSOUP_2_47_3 */
+#endif /* HAVE_LIBSOUP_2_55_90 */
/* Create the server */
g_assert (main_loop != NULL);
context = g_main_context_new ();
*main_loop = g_main_loop_new (context, FALSE);
-#ifdef HAVE_LIBSOUP_2_47_3
+#ifdef HAVE_LIBSOUP_2_55_90
server = soup_server_new (NULL, NULL);
cert_path = g_test_build_filename (G_TEST_DIST, "cert.pem", NULL);
@@ -197,7 +197,7 @@ create_server (SoupServerCallback callback, gpointer user_data, GMainLoop **main
g_assert_no_error (error);
g_main_context_pop_thread_default (context);
-#else /* if !HAVE_LIBSOUP_2_47_3 */
+#else /* if !HAVE_LIBSOUP_2_55_90 */
memset (&sock, 0, sizeof (sock));
sock.in.sin_family = AF_INET;
sock.in.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
@@ -213,7 +213,7 @@ create_server (SoupServerCallback callback, gpointer user_data, GMainLoop **main
soup_server_add_handler (server, NULL, callback, user_data, NULL);
g_object_unref (addr);
-#endif /* !HAVE_LIBSOUP_2_47_3 */
+#endif /* !HAVE_LIBSOUP_2_55_90 */
g_assert (server != NULL);
g_main_context_unref (context);
@@ -224,7 +224,7 @@ create_server (SoupServerCallback callback, gpointer user_data, GMainLoop **main
static gchar *
build_server_uri (SoupServer *server)
{
-#ifdef HAVE_LIBSOUP_2_47_3
+#ifdef HAVE_LIBSOUP_2_55_90
GSList *uris; /* owned */
GSList *l; /* unowned */
gchar *retval = NULL; /* owned */
@@ -242,11 +242,11 @@ build_server_uri (SoupServer *server)
g_assert (retval != NULL);
return retval;
-#else /* if !HAVE_LIBSOUP_2_47_3 */
+#else /* if !HAVE_LIBSOUP_2_55_90 */
return g_strdup_printf ("https://%s:%u/",
soup_address_get_physical (soup_socket_get_local_address (soup_server_get_listener (server))),
soup_server_get_port (server));
-#endif /* !HAVE_LIBSOUP_2_47_3 */
+#endif /* !HAVE_LIBSOUP_2_55_90 */
}
static void