From 2541c8a04f8c1acc52354e20dbcb503330b1bc14 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 2 Feb 2011 15:38:26 -0500 Subject: [PATCH] Make the glib-networking dependency more explicit Require glib-networking to be present at build time (with an error explaining that you can pass --disable-tls-check, but packagers should make sure libsoup has a runtime dependency on glib-networking). Also, if a TLS connection fails because of missing glib-networking, mention that in the reason_phrase, as a last resort. --- configure.ac | 24 ++++++++++++++++++------ libsoup/soup-session.c | 12 +++++++++++- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 5a5621e..0302709 100644 --- a/configure.ac +++ b/configure.ac @@ -218,12 +218,6 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then done fi -dnl ****************************** -dnl *** Stuff for regression tests -dnl ****************************** -AC_MSG_NOTICE([checking for programs needed for regression tests]) -MISSING_REGRESSION_TEST_PACKAGES="" - AC_MSG_CHECKING([for glib-networking (glib TLS implementation)]) save_CFLAGS="$CFLAGS" save_LIBS="$LIBS" @@ -237,6 +231,24 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([#include ], CFLAGS="$save_CFLAGS" LIBS="$save_LIBS" AC_MSG_RESULT($have_glib_networking) + +AC_ARG_ENABLE(tls-check, + AS_HELP_STRING([--disable-tls-check], [Don't error out if glib-networking is unavailable])) +if test "$enable_tls_check" != "no" -a "$have_glib_networking" = "no"; then + AC_MSG_ERROR([libsoup requires glib-networking for TLS support. + +If you are building a packge, you can pass --disable-tls-check to +allow building libsoup anyway (since glib-networking is not actually +required at compile time), but you should be sure to add a runtime +dependency on it.]) +fi + +dnl ****************************** +dnl *** Stuff for regression tests +dnl ****************************** +AC_MSG_NOTICE([checking for programs needed for regression tests]) +MISSING_REGRESSION_TEST_PACKAGES="" + if test "$have_glib_networking" = "no"; then MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES glib-networking" fi diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c index fdc83ae..dcea224 100644 --- a/libsoup/soup-session.c +++ b/libsoup/soup-session.c @@ -1461,10 +1461,20 @@ soup_session_set_item_status (SoupSession *session, g_free (msg); break; } - /* else fall through */ + soup_message_set_status (item->msg, status_code); + break; + + case SOUP_STATUS_SSL_FAILED: + if (!g_tls_backend_supports_tls (g_tls_backend_get_default ())) { + soup_message_set_status_full (item->msg, status_code, + "TLS/SSL support not available; install glib-networking"); + } else + soup_message_set_status (item->msg, status_code); + break; default: soup_message_set_status (item->msg, status_code); + break; } } -- 2.7.4