summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2011-02-02 15:38:26 -0500
committerDan Winship <danw@gnome.org>2011-02-02 15:38:26 -0500
commit2541c8a04f8c1acc52354e20dbcb503330b1bc14 (patch)
tree8dd90bfc2052d6d1302dad8abe5ca2cc85ed674a
parenta227c1b94de00320eae421c08617369c55732b9b (diff)
downloadlibsoup-2541c8a04f8c1acc52354e20dbcb503330b1bc14.tar.gz
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.
-rw-r--r--configure.ac24
-rw-r--r--libsoup/soup-session.c12
2 files changed, 29 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index 5a5621e7..0302709e 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 <gio/gio.h>],
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 fdc83ae4..dcea2241 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;
}
}