[evolution-kolab] libekolab(util): dropped LibSoup dependency
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] libekolab(util): dropped LibSoup dependency
- Date: Mon, 6 Aug 2012 16:36:26 +0000 (UTC)
commit 969c90d57cb7a42bb71b905e9e7d2e15b59dd497
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Mon Aug 6 17:41:34 2012 +0200
libekolab(util): dropped LibSoup dependency
* removed LibSoup HTTP code, which had been commented
for quite some time now (in favor of LibCurl, which
can make use of NSS, which provides the security
infrastructure we need)
* also dropped LibSoup library checks from autotools
configure.ac | 1 -
src/libekolab/Makefile.am | 2 -
src/libekolabutil/Makefile.am | 2 -
src/libekolabutil/kolab-util-http.c | 181 +----------------------------------
4 files changed, 1 insertions(+), 185 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 485ac3b..8d4a63c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,7 +73,6 @@ PKG_CHECK_MODULES(EDS, libedata-book-1.2 libedata-cal-1.2 libedataserver-1.2 lib
PKG_CHECK_MODULES(SQLITE, sqlite3)
PKG_CHECK_MODULES(CAMEL, camel-1.2)
PKG_CHECK_MODULES(GTK, gtk+-3.0)
-PKG_CHECK_MODULES(SOUP, libsoup-2.4 libsoup-gnome-2.4)
PKG_CHECK_MODULES(CURL, libcurl)
PKG_CHECK_MODULES(ICAL, libical)
PKG_CHECK_MODULES(GMIME, gmime-2.4,,[PKG_CHECK_MODULES(GMIME, gmime-2.6)]) dnl TODO make tests optional
diff --git a/src/libekolab/Makefile.am b/src/libekolab/Makefile.am
index 6c01ee8..0e3345f 100644
--- a/src/libekolab/Makefile.am
+++ b/src/libekolab/Makefile.am
@@ -7,7 +7,6 @@ noinst_LTLIBRARIES = \
AM_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(CAMEL_CFLAGS) \
- $(SOUP_CFLAGS) \
$(EDS_CFLAGS) \
$(CURL_CFLAGS) \
$(SQLITE_CFLAGS) \
@@ -91,7 +90,6 @@ libekolab_la_CPPFLAGS = \
libekolab_la_LIBADD = \
$(GLIB_LIBS) \
$(CAMEL_LIBS) \
- $(SOUP_LIBS) \
$(EDS_LIBS) \
$(CURL_LIBS) \
$(EVOLUTION_LIBS) \
diff --git a/src/libekolabutil/Makefile.am b/src/libekolabutil/Makefile.am
index 0183767..ec321ef 100644
--- a/src/libekolabutil/Makefile.am
+++ b/src/libekolabutil/Makefile.am
@@ -9,7 +9,6 @@ AM_CPPFLAGS = \
$(NSS_CFLAGS) \
$(GLIB_CFLAGS) \
$(CAMEL_CFLAGS) \
- $(SOUP_CFLAGS) \
$(EDS_CFLAGS) \
$(EVOLUTION_CFLAGS) \
$(CURL_CFLAGS) \
@@ -49,7 +48,6 @@ libekolabutil_la_LIBADD = \
$(EVOLUTION_LIBS) \
$(GLIB_LIBS) \
$(CURL_LIBS) \
- $(SOUP_LIBS) \
$(KOLAB_LIB_EKOLABCONV) \
$(ICAL_LIBS) \
$(SQLITE_LIBS) \
diff --git a/src/libekolabutil/kolab-util-http.c b/src/libekolabutil/kolab-util-http.c
index 4e1bac9..df39968 100644
--- a/src/libekolabutil/kolab-util-http.c
+++ b/src/libekolabutil/kolab-util-http.c
@@ -56,7 +56,6 @@
#include <glib/gi18n-lib.h>
/* HTTP lib specifics */
-#include <libsoup/soup-gnome.h>
#include <curl/curl.h>
#include "camel-kolab-stream.h"
@@ -84,16 +83,6 @@ kolab_util_http_error_quark (void)
return g_quark_from_static_string ("kolab-util-http-error-quark");
}
-/* TODO change this to conditional compilation once
- * things have settled.
- * We keep this for now to make sure all variants
- * compile cleanly
- */
-typedef enum {
- KOLAB_UTIL_HTTP_LIB_SOUP = 0,
- KOLAB_UTIL_HTTP_LIB_CURL
-} KolabUtilHttpLib;
-
/*----------------------------------------------------------------------------*/
/* TODO get rid of these globals if possible */
@@ -134,99 +123,6 @@ kolab_util_http_job_free (KolabUtilHttpJob *job)
}
/*----------------------------------------------------------------------------*/
-/* LibSoup */
-#if 0
-static void
-kolab_util_http_soup_authenticate (SoupSession *session,
- SoupMessage *msg,
- SoupAuth *auth,
- gboolean retrying,
- gpointer data)
-{
- KolabUtilHttpJob *job;
-
- (void)session;
- (void)msg;
-
- /* no second auth attempt */
- if (retrying)
- return;
-
- job = (KolabUtilHttpJob*) data;
- g_assert( job != NULL);
- soup_auth_authenticate (auth,
- job->url->user,
- job->url->passwd);
-}
-
-static gssize
-kolab_util_http_soup_get (const KolabUtilHttpJob *job, GError **error)
-{
- g_error ("%s: not implemented.", __func__);
- SoupMessage *msg = NULL;
- CamelStream *mem = NULL;
- guint status = 0;
- gssize nbytes = -1;
- gchar *url_string = NULL;
-
- static gulong kolab_soup_auth_handler_id = 0; /* TODO is 0 an invalid id? */
-
- g_return_val_if_fail (error == NULL || *error == NULL, -1);
-
- /* connect the "authenticate" signal handler,
- * disconnect a previously connected one.
- * TODO: check whether we need to disconnect-connect
- * a handler here (KolabUtilHttpJob* may point to
- * an address different from the one we were
- * called upon last time)
- */
- if (g_signal_handler_is_connected (kolab_soup_session,
- kolab_soup_auth_handler_id))
- g_signal_handler_disconnect (kolab_soup_session,
- kolab_soup_auth_handler_id);
- kolab_soup_auth_handler_id = g_signal_connect (kolab_soup_session,
- "authenticate",
- G_CALLBACK (kolab_util_http_soup_authenticate),
- (gpointer)job);
-
- /* issue HTTP GET */
- url_string = camel_url_to_string (job->url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_AUTH);
- msg = soup_message_new (SOUP_METHOD_GET, url_string);
- g_free (url_string);
- /* soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT); */
- status = soup_session_send_message (kolab_soup_session, msg);
-
- /* copy msg contents into buffer */
- if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
- mem = camel_kolab_stream_new_memstream (job->buffer);
- nbytes = camel_stream_write (mem,
- (gchar*)msg->response_body->data,
- (gsize)msg->response_body->length);
- camel_kolab_stream_free (mem);
- g_debug ("%s: %d bytes received", __func__, nbytes);
- }
- else {
- KolabUtilHttpError error_code;
- if (status > 500)
- error_code = KOLAB_UTIL_HTTP_ERROR_SERVER_ERROR;
- else if (status > 400)
- error_code = KOLAB_UTIL_HTTP_ERROR_CLIENT_ERROR;
- else /* if (status > 100) */
- /* 1xx informational and 2xx is considered success, then why are we here? */
- error_code = KOLAB_UTIL_HTTP_ERROR_UNKNOWN_ERROR;
-
- g_set_error (error,
- KOLAB_UTIL_HTTP_ERROR,
- error_code,
- _("Libsoup failed with status %u"),
- status);
- }
-
- return nbytes;
-}
-#endif
-
-/*----------------------------------------------------------------------------*/
/* LibCurl */
static size_t
@@ -441,11 +337,6 @@ kolab_util_http_init (void)
if (http_is_initialized == TRUE)
return;
-#if 0
- /* libsoup */
- kolab_soup_session = (SoupSession*)soup_session_sync_new ();
- g_assert (kolab_soup_session != NULL);
-#endif
/* libcurl */
@@ -483,11 +374,6 @@ kolab_util_http_shutdown (void)
/* libcurl */
curl_easy_cleanup (kolab_curl_handle);
curl_global_cleanup ();
-
-#if 0
- /* libsoup */
- g_object_unref (kolab_soup_session);
-#endif
}
/*----------------------------------------------------------------------------*/
@@ -505,73 +391,8 @@ kolab_util_http_shutdown (void)
gssize
kolab_util_http_get (KolabUtilHttpJob *job, GError **error)
{
- gssize nbytes = -1;
-
- nbytes = util_http_curl_get (job, error);
-
-#if 0
- /* TODO change this to conditional compilation once
- * things have settled.
- * We keep this for now to make sure all variants
- * compile cleanly
- */
- KolabUtilHttpLib httplib = KOLAB_UTIL_HTTP_LIB_CURL;
-
- switch (httplib) {
- case KOLAB_UTIL_HTTP_LIB_SOUP:
- nbytes = kolab_util_http_soup_get (job, error);
- break;
- case KOLAB_UTIL_HTTP_LIB_CURL:
- nbytes = kolab_util_http_curl_get (job, error);
- break;
- default:
- /* can't happen */
- g_assert_not_reached();
- }
-#endif
-
- return nbytes;
-}
-
-#if 0
-/**
- * kolab_util_http_new_hostname_from_url:
- * @url_string: the URL to extract the hostname part from
- *
- * The returned string should be freed using g_free() if no longer needed.
- *
- * Returns: The host name part from a given URL
- */
-gchar*
-kolab_util_http_new_hostname_from_url (const gchar *url_string)
-{
- /* TODO move this to http-independent place
- * and rename
- */
- CamelURL *url = NULL;
- gchar *hostname = NULL;
- CamelException *ex = NULL;
-
- g_assert (url_string != NULL);
-
- ex = camel_exception_new ();
- url = camel_url_new (url_string, ex);
- if (camel_exception_is_set (ex)) {
- g_warning ("%s: %s",
- __func__, camel_exception_get_description (ex));
- if (url != NULL)
- camel_url_free (url);
- url = NULL;
- }
- camel_exception_free (ex);
- if (url == NULL)
- return NULL;
-
- hostname = g_strdup (url->host);
- camel_url_free (url);
- return hostname;
+ return util_http_curl_get (job, error);
}
-#endif
/**
* kolab_util_http_protocol_is_ssl:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]