[evolution/wip/mcrha/soup3: 16/16] M!94 - Port to libsoup3




commit 5cd3de0143e6bcadbf0e6ea9fedc6be46a4b730a
Author: Milan Crha <mcrha redhat com>
Date:   Wed Nov 10 19:43:11 2021 +0100

    M!94 - Port to libsoup3
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/merge_requests/94

 CMakeLists.txt                                     |  39 ++--
 README.md                                          |   2 +-
 evolution-shell.pc.in                              |   2 +-
 src/addressbook/gui/widgets/eab-contact-display.c  |  30 +--
 src/calendar/gui/e-meeting-store.c                 | 111 +++++------
 src/e-util/e-file-request.c                        |  14 +-
 src/e-util/e-misc-utils.c                          | 106 ++++++++++-
 src/e-util/e-misc-utils.h                          |   8 +
 src/e-util/e-passwords.c                           |  54 +++---
 src/e-util/e-stock-request.c                       |  18 +-
 src/e-util/e-web-view.c                            |  24 +--
 src/e-util/e-webdav-browser.c                      |  96 +++++-----
 src/em-format/e-mail-part-utils.c                  |   6 +-
 src/mail/e-http-request.c                          | 202 +++++++--------------
 src/mail/e-mail-autoconfig.c                       |  33 ++--
 src/mail/e-mail-display.c                          |  88 ++++-----
 src/mail/e-mail-request.c                          |  40 ++--
 src/modules/addressbook/e-book-shell-backend.c     |  12 +-
 .../evolution-book-config-carddav.c                | 109 +++--------
 .../e-google-book-chooser-button.c                 |  38 ++--
 .../e-google-book-chooser-button.h                 |   2 +-
 .../evolution-book-config-google.c                 |  14 +-
 .../evolution-cal-config-caldav.c                  | 109 +++--------
 .../cal-config-google/e-cal-config-google.c        |  19 +-
 .../cal-config-google/e-google-chooser-button.c    |  40 ++--
 .../cal-config-google/e-google-chooser-button.h    |   2 +-
 .../evolution-cal-config-weather.c                 |  26 ---
 .../evolution-cal-config-webcal.c                  |  91 ++--------
 .../evolution-cal-config-webdav-notes.c            | 109 +++--------
 src/modules/calendar/e-cal-base-shell-backend.c    |  33 ++--
 src/modules/config-lookup/e-webdav-config-lookup.c |  16 +-
 src/modules/gravatar/e-gravatar-photo-source.c     |  26 +--
 .../e-mail-display-popup-prefer-plain.c            |  40 ++--
 .../e-mail-display-popup-text-highlight.c          |  38 ++--
 .../e-mail-formatter-text-highlight.c              |  16 +-
 src/plugins/publish-calendar/publish-calendar.c    |  12 +-
 src/plugins/publish-calendar/publish-location.c    |  12 +-
 src/plugins/publish-calendar/url-editor-dialog.c   |  18 +-
 38 files changed, 710 insertions(+), 945 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f8bbc92975..f45bd887d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,7 +48,7 @@ set(PROJECT_DISTCONFIGURE_PARAMS
 )
 
 # Keep these two definitions in agreement.
-set(glib_minimum_version 2.56)
+set(glib_minimum_version 2.66)
 set(glib_encoded_version GLIB_VERSION_2_56)
 
 # Keep these two definitions in agreement.
@@ -56,8 +56,8 @@ set(gdk_minimum_version 3.22)
 set(gdk_encoded_version GDK_VERSION_3_22)
 
 # Keep these two definitions in agreement.
-set(soup_minimum_version 2.42)
-set(soup_encoded_version SOUP_VERSION_2_42)
+set(soup_minimum_version 3.0)
+set(soup_encoded_version SOUP_VERSION_3_0)
 
 # Warn about API usage that violates our minimum requirements.
 add_definitions(-DGLIB_VERSION_MAX_ALLOWED=${glib_encoded_version})
@@ -82,7 +82,7 @@ set(gsettings_desktop_schemas_minimum_version 2.91.92)
 set(libpst_minimum_version 0.6.54)
 set(libxml_minimum_version 2.7.3)
 set(shared_mime_info_minimum_version 0.22)
-set(webkit2gtk_minimum_version 2.28.0)
+set(webkit2gtk_minimum_version 2.34.0)
 set(sqlite_minimum_version 3.7.17)
 
 # Optional Packages
@@ -91,7 +91,7 @@ set(clutter_gtk_minimum_version 0.90)
 set(geocode_glib_minimum_version 3.10)
 set(gladeui_minimum_version 3.10.0)
 set(gnome_autoar_minimum_version 0.1.1)
-set(gweather_minimum_version 3.10)
+set(gweather_minimum_version 3.90)
 set(libcanberra_gtk_minimum_version 0.25)
 set(libnotify_minimum_version 0.7)
 set(libunity_minimum_version 7.1.4)
@@ -266,7 +266,7 @@ pkg_check_modules(GNOME_PLATFORM REQUIRED
        gtk+-3.0>=${gdk_minimum_version}
        libxml-2.0>=${libxml_minimum_version}
        shared-mime-info>=${shared_mime_info_minimum_version}
-       webkit2gtk-4.0>=${webkit2gtk_minimum_version}
+       webkit2gtk-4.1>=${webkit2gtk_minimum_version}
 )
 
 pkg_check_modules(EVOLUTION_DATA_SERVER REQUIRED
@@ -279,8 +279,8 @@ pkg_check_modules(EVOLUTION_DATA_SERVER REQUIRED
 )
 
 pkg_check_modules(A11Y REQUIRED atk)
-pkg_check_modules(LIBSOUP REQUIRED libsoup-2.4>=${soup_minimum_version})
-pkg_check_modules(WEB_EXTENSION REQUIRED webkit2gtk-4.0>=${webkit2gtk_minimum_version})
+pkg_check_modules(LIBSOUP REQUIRED libsoup-3.0>=${soup_minimum_version})
+pkg_check_modules(WEB_EXTENSION REQUIRED webkit2gtk-4.1>=${webkit2gtk_minimum_version})
 pkg_check_modules(SQLITE3 REQUIRED sqlite3>=${sqlite_minimum_version})
 
 pkg_check_variable(EDS_SOURCES_DBUS_SERVICE_NAME evolution-data-server-1.2 sourcesdbusservicename)
@@ -669,8 +669,21 @@ endif(ENABLE_TEXT_HIGHLIGHT)
 add_printable_option(ENABLE_WEATHER "Enable weather calendars" ON)
 
 if(ENABLE_WEATHER)
-       pkg_check_modules_for_option(ENABLE_WEATHER "weather calendar" GWEATHER 
gweather-3.0>=${gweather_minimum_version})
+       pkg_check_modules_for_option(ENABLE_WEATHER "weather calendar" GWEATHER 
gweather4>=${gweather_minimum_version})
        pkg_check_modules_for_option(ENABLE_WEATHER "weather calendar" GEO 
geocode-glib-1.0>=${geocode_glib_minimum_version})
+
+       # compatibility check
+       pkg_check_variable(gweather_soupapiversion gweather4 soupapiversion)
+       if(NOT "${gweather_soupapiversion}" STREQUAL "3.0")
+               message(FATAL_ERROR "Requires libgweather compiled with libsoup 3.0 API, but found version 
'${gweather_soupapiversion}' instead. If you want to disable weather calendar, please use 
-DENABLE_WEATHER=OFF argument to cmake command.")
+       endif(NOT "${gweather_soupapiversion}" STREQUAL "3.0")
+       unset(gweather_soupapiversion)
+
+       pkg_check_variable(geocode_glib_soupapiversion geocode-glib-1.0 soupapiversion)
+       if(NOT "${geocode_glib_soupapiversion}" STREQUAL "3.0")
+               message(FATAL_ERROR "Requires geocode-glib compiled with libsoup 3.0 API, but found version 
'${geocode_glib_soupapiversion}' instead. If you want to disable weather calendar, please use 
-DENABLE_WEATHER=OFF argument to cmake command.")
+       endif(NOT "${geocode_glib_soupapiversion}" STREQUAL "3.0")
+       unset(geocode_glib_soupapiversion)
 endif(ENABLE_WEATHER)
 
 # maps in Contacts preview
@@ -678,9 +691,11 @@ endif(ENABLE_WEATHER)
 add_printable_option(ENABLE_CONTACT_MAPS "Enable contact maps" OFF)
 
 if(ENABLE_CONTACT_MAPS)
-       pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" CHAMPLAIN 
champlain-gtk-0.12>=${champlain_minimum_version})
-       pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" GEO 
geocode-glib-1.0>=${geocode_glib_minimum_version})
-       pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" CLUTTER_GTK 
clutter-gtk-1.0>=${clutter_gtk_minimum_version})
+       message("Contact maps auto-disabled due to no champlain-gtk, which uses libsoup3")
+       set(ENABLE_CONTACT_MAPS OFF)
+#      pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" CHAMPLAIN 
champlain-gtk-0.12>=${champlain_minimum_version})
+#      pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" GEO 
geocode-glib-1.0>=${geocode_glib_minimum_version})
+#      pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" CLUTTER_GTK 
clutter-gtk-1.0>=${clutter_gtk_minimum_version})
 endif(ENABLE_CONTACT_MAPS)
 
 # pst-import plugin
diff --git a/README.md b/README.md
index 45abb13bc6..b4f7a4aa06 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ Additional dependencies, besides the stock GNOME libraries (the
 dependencies should be compiled in the order they are listed here):
 
 * [evolution-data-server of the same version as the Evolution is][eds]
-* [libsoup 2.42 or later][libsoup]
+* [libsoup 3.0 or later][libsoup]
 * [WebKitGTK+ 2.28.0][webkitgtk]
 * [Mozilla NSPR/NSS libraries][mozilla]
   These are needed if you want to compile Evolution with SSL and S/MIME
diff --git a/evolution-shell.pc.in b/evolution-shell.pc.in
index 04a252d02e..8226e3d72a 100644
--- a/evolution-shell.pc.in
+++ b/evolution-shell.pc.in
@@ -17,7 +17,7 @@ execversion=@BASE_VERSION@
 Name: evolution-shell
 Description: libraries needed for Evolution shell components
 Version: @PROJECT_VERSION@
-Requires: gtk+-3.0 libebackend-1.2 libedataserver-1.2 libedataserverui-1.2 webkit2gtk-4.0
+Requires: gtk+-3.0 libebackend-1.2 libedataserver-1.2 libedataserverui-1.2 webkit2gtk-4.1
 @shell_private_requirements@
 Libs: -L${privlibdir} -levolution-shell -levolution-util@shell_privlibdir_rpath_flags@
 Cflags: -I${privincludedir}
diff --git a/src/addressbook/gui/widgets/eab-contact-display.c 
b/src/addressbook/gui/widgets/eab-contact-display.c
index 79e2664123..63eefb5b1e 100644
--- a/src/addressbook/gui/widgets/eab-contact-display.c
+++ b/src/addressbook/gui/widgets/eab-contact-display.c
@@ -320,21 +320,23 @@ contact_display_hovering_over_link (EWebView *web_view,
 
                handled = TRUE;
        } else if (uri && g_str_has_prefix (uri, "open-map:")) {
-               SoupURI *suri;
+               GUri *guri;
 
-               suri = soup_uri_new (uri);
-               if (suri) {
+               guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+               if (guri) {
                        gchar *decoded;
 
-                       decoded = soup_uri_decode (soup_uri_get_path (suri));
+                       decoded = g_uri_unescape_string (g_uri_get_path (guri), NULL);
 
-                       message = g_strdup_printf (_("Click to open map for %s"), decoded);
-                       e_web_view_status_message (web_view, message);
-                       g_free (message);
+                       if (decoded) {
+                               message = g_strdup_printf (_("Click to open map for %s"), decoded);
+                               e_web_view_status_message (web_view, message);
+                               g_free (message);
 
-                       handled = TRUE;
+                               handled = TRUE;
+                       }
 
-                       soup_uri_free (suri);
+                       g_uri_unref (guri);
                        g_free (decoded);
                }
        }
@@ -365,12 +367,12 @@ contact_display_link_clicked (EWebView *web_view,
 
        length = strlen ("open-map:");
        if (g_ascii_strncasecmp (uri, "open-map:", length) == 0) {
-               SoupURI *suri;
+               GUri *guri;
 
-               suri = soup_uri_new (uri);
-               if (suri) {
-                       contact_display_open_map (display, soup_uri_get_path (suri));
-                       soup_uri_free (suri);
+               guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+               if (guri) {
+                       contact_display_open_map (display, g_uri_get_path (guri));
+                       g_uri_unref (guri);
                }
 
                return;
diff --git a/src/calendar/gui/e-meeting-store.c b/src/calendar/gui/e-meeting-store.c
index 1311abb3f5..1737e6d2c0 100644
--- a/src/calendar/gui/e-meeting-store.c
+++ b/src/calendar/gui/e-meeting-store.c
@@ -1957,42 +1957,41 @@ async_read (GObject *source_object,
        }
 }
 
-static void
-soup_authenticate (SoupSession *session,
-                   SoupMessage *msg,
+static gboolean
+soup_authenticate (SoupMessage *msg,
                    SoupAuth *auth,
                    gboolean retrying,
                    gpointer data)
 {
-       SoupURI *suri;
+       GUri *guri;
        const gchar *orig_uri;
        gboolean tried = FALSE;
 
-       g_return_if_fail (msg != NULL);
-       g_return_if_fail (auth != NULL);
+       g_return_val_if_fail (msg != NULL, FALSE);
+       g_return_val_if_fail (auth != NULL, FALSE);
 
        orig_uri = g_object_get_data (G_OBJECT (msg), "orig-uri");
-       g_return_if_fail (orig_uri != NULL);
+       g_return_val_if_fail (orig_uri != NULL, FALSE);
 
-       suri = soup_uri_new (orig_uri);
-       if (!suri)
-               return;
+       guri = g_uri_parse (orig_uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+       if (!guri)
+               return FALSE;
 
-       if (!suri->user || !*suri->user) {
-               soup_uri_free (suri);
-               return;
+       if (!g_uri_get_user (guri) || !g_uri_get_user (guri)[0]) {
+               g_uri_unref (guri);
+               return FALSE;
        }
 
        if (!retrying) {
-               if (suri->password) {
-                       soup_auth_authenticate (auth, suri->user, suri->password);
+               if (g_uri_get_password (guri)) {
+                       soup_auth_authenticate (auth, g_uri_get_user (guri), g_uri_get_password (guri));
                        tried = TRUE;
                } else {
                        gchar *password;
 
                        password = e_passwords_get_password (orig_uri);
                        if (password) {
-                               soup_auth_authenticate (auth, suri->user, password);
+                               soup_auth_authenticate (auth, g_uri_get_user (guri), password);
                                tried = TRUE;
 
                                memset (password, 0, strlen (password));
@@ -2006,8 +2005,8 @@ soup_authenticate (SoupSession *session,
                gchar *password, *bold_host, *bold_user;
                GString *description;
 
-               bold_host = g_strconcat ("<b>", suri->host, "</b>", NULL);
-               bold_user = g_strconcat ("<b>", suri->user, "</b>", NULL);
+               bold_host = g_strconcat ("<b>", g_uri_get_host (guri), "</b>", NULL);
+               bold_user = g_strconcat ("<b>", g_uri_get_user (guri), "</b>", NULL);
 
                description = g_string_new ("");
 
@@ -2019,11 +2018,11 @@ soup_authenticate (SoupSession *session,
                g_free (bold_host);
                g_free (bold_user);
 
-               if (retrying && msg->reason_phrase && *msg->reason_phrase) {
+               if (retrying && soup_message_get_reason_phrase (msg) && *soup_message_get_reason_phrase 
(msg)) {
                        g_string_append_c (description, '\n');
                        g_string_append_printf (
                                description, _("Failure reason: %s"),
-                               msg->reason_phrase);
+                               soup_message_get_reason_phrase (msg));
                }
 
                password = e_passwords_ask_password (
@@ -2036,70 +2035,46 @@ soup_authenticate (SoupSession *session,
                g_string_free (description, TRUE);
 
                if (password) {
-                       soup_auth_authenticate (auth, suri->user, password);
+                       soup_auth_authenticate (auth, g_uri_get_user (guri), password);
 
                        memset (password, 0, strlen (password));
                        g_free (password);
                }
        }
 
-       soup_uri_free (suri);
-}
-
-static void
-redirect_handler (SoupMessage *msg,
-                  gpointer user_data)
-{
-       if (SOUP_STATUS_IS_REDIRECTION (msg->status_code)) {
-               SoupSession *soup_session = user_data;
-               SoupURI *new_uri;
-               const gchar *new_loc;
+       g_uri_unref (guri);
 
-               new_loc = soup_message_headers_get_list (msg->response_headers, "Location");
-               if (!new_loc)
-                       return;
-
-               new_uri = soup_uri_new_with_base (soup_message_get_uri (msg), new_loc);
-               if (!new_uri) {
-                       soup_message_set_status_full (
-                               msg,
-                               SOUP_STATUS_MALFORMED,
-                               "Invalid Redirect URL");
-                       return;
-               }
-
-               soup_message_set_uri (msg, new_uri);
-               soup_session_requeue_message (soup_session, msg);
-
-               soup_uri_free (new_uri);
-       }
+       return FALSE;
 }
 
 static void
-soup_msg_ready_cb (SoupSession *session,
-                   SoupMessage *msg,
+soup_msg_ready_cb (GObject *source_object,
+                   GAsyncResult *result,
                    gpointer user_data)
 {
        EMeetingStoreQueueData *qdata = user_data;
+       GBytes *bytes;
+       GError *local_error = NULL;
 
-       g_return_if_fail (session != NULL);
-       g_return_if_fail (msg != NULL);
+       g_return_if_fail (source_object != NULL);
        g_return_if_fail (qdata != NULL);
 
-       if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
+       bytes = soup_session_send_and_read_finish (SOUP_SESSION (source_object), result, &local_error);
+       if (bytes && !local_error) {
                qdata->string = g_string_new_len (
-                       msg->response_body->data,
-                       msg->response_body->length);
+                       g_bytes_get_data (bytes, NULL),
+                       g_bytes_get_size (bytes));
                process_free_busy (qdata, qdata->string->str);
        } else {
                g_warning (
                        "Unable to access free/busy url: %s",
-                       msg->reason_phrase && *msg->reason_phrase ?
-                       msg->reason_phrase : (soup_status_get_phrase (
-                       msg->status_code) ? soup_status_get_phrase (
-                       msg->status_code) : "Unknown error"));
+                       local_error ? local_error->message : "Unknown error");
                process_callbacks (qdata);
        }
+
+       if (bytes)
+               g_bytes_unref (bytes);
+       g_clear_error (&local_error);
 }
 
 static void
@@ -2122,17 +2097,13 @@ download_with_libsoup (const gchar *uri,
        g_object_set_data_full (G_OBJECT (msg), "orig-uri", g_strdup (uri), g_free);
 
        session = soup_session_new ();
-       g_object_set (session, SOUP_SESSION_TIMEOUT, 90, NULL);
+       g_object_set (session, "timeout", 60, NULL);
        g_signal_connect (
-               session, "authenticate",
+               msg, "authenticate",
                G_CALLBACK (soup_authenticate), NULL);
 
-       soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT);
-       soup_message_add_header_handler (
-               msg, "got_body", "Location",
-               G_CALLBACK (redirect_handler), session);
-       soup_message_headers_append (msg->request_headers, "Connection", "close");
-       soup_session_queue_message (session, msg, soup_msg_ready_cb, qdata);
+       soup_message_headers_append (soup_message_get_request_headers (msg), "Connection", "close");
+       soup_session_send_and_read_async (session, msg, G_PRIORITY_DEFAULT, NULL, soup_msg_ready_cb, qdata);
 }
 
 static void
@@ -2154,7 +2125,7 @@ start_async_read (const gchar *uri,
 
        istream = G_INPUT_STREAM (g_file_read (file, NULL, &error));
 
-       if (g_error_matches (error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED) ||
+       if (g_error_matches (error, E_SOUP_SESSION_ERROR, SOUP_STATUS_UNAUTHORIZED) ||
            g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED)) {
                download_with_libsoup (uri, qdata);
                g_object_unref (file);
diff --git a/src/e-util/e-file-request.c b/src/e-util/e-file-request.c
index 4dfe3e20cf..1f7ad76b73 100644
--- a/src/e-util/e-file-request.c
+++ b/src/e-util/e-file-request.c
@@ -60,7 +60,7 @@ e_file_request_process_sync (EContentRequest *request,
        GFileInfo *info;
        goffset total_size;
        gchar *filename = NULL, *path;
-       SoupURI *suri;
+       GUri *guri;
 
        g_return_val_if_fail (E_IS_FILE_REQUEST (request), FALSE);
        g_return_val_if_fail (uri != NULL, FALSE);
@@ -68,14 +68,14 @@ e_file_request_process_sync (EContentRequest *request,
        if (g_cancellable_set_error_if_cancelled (cancellable, error))
                return FALSE;
 
-       suri = soup_uri_new (uri);
-       g_return_val_if_fail (suri != NULL, FALSE);
+       guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+       g_return_val_if_fail (guri != NULL, FALSE);
 
-       path = soup_uri_decode (suri->path ? suri->path : "");
+       path = g_uri_unescape_string (g_uri_get_path (guri) ? g_uri_get_path (guri) : "", "/");
 
-       if (g_strcmp0 (suri->host, "$EVOLUTION_WEBKITDATADIR") == 0) {
+       if (g_strcmp0 (g_uri_get_host (guri), "$EVOLUTION_WEBKITDATADIR") == 0) {
                filename = g_build_filename (EVOLUTION_WEBKITDATADIR, path, NULL);
-       } else if (g_strcmp0 (suri->host, "$EVOLUTION_IMAGESDIR") == 0) {
+       } else if (g_strcmp0 (g_uri_get_host (guri), "$EVOLUTION_IMAGESDIR") == 0) {
                filename = g_build_filename (EVOLUTION_IMAGESDIR, path, NULL);
        }
 
@@ -114,7 +114,7 @@ e_file_request_process_sync (EContentRequest *request,
        }
 
        g_object_unref (file);
-       soup_uri_free (suri);
+       g_uri_unref (guri);
        g_free (filename);
        g_free (path);
 
diff --git a/src/e-util/e-misc-utils.c b/src/e-util/e-misc-utils.c
index 9dc738f431..095e0aeaa7 100644
--- a/src/e-util/e-misc-utils.c
+++ b/src/e-util/e-misc-utils.c
@@ -2850,6 +2850,102 @@ e_binding_transform_text_non_null (GBinding *binding,
        return TRUE;
 }
 
+/**
+ * e_binding_transform_text_to_uri:
+ * @binding: a #GBinding
+ * @source_value: a #GValue of type #G_TYPE_STRING
+ * @target_value: a #GValue of boxed #GUri
+ * @not_used: not used
+ *
+ * Transforms a URI string into a #GUri. It expects the source
+ * object to be an #ESourceExtension descendant, then it adds
+ * also the user name from its #ESourceAuthentication extension.
+ *
+ * Returns: %TRUE
+ *
+ **/
+gboolean
+e_binding_transform_text_to_uri (GBinding *binding,
+                                const GValue *source_value,
+                                GValue *target_value,
+                                gpointer not_used)
+{
+       GUri *uri;
+       GObject *source_binding;
+       const gchar *text;
+
+       text = g_value_get_string (source_value);
+       uri = g_uri_parse (text, SOUP_HTTP_URI_FLAGS, NULL);
+
+       if (!uri)
+               uri = g_uri_build (G_URI_FLAGS_NONE, "http", NULL, NULL, -1, "", NULL, NULL);
+
+       source_binding = g_binding_get_source (binding);
+
+       if (E_IS_SOURCE_EXTENSION (source_binding)) {
+               ESource *source = NULL;
+               ESourceAuthentication *extension;
+               const gchar *user;
+
+               source = e_source_extension_ref_source (E_SOURCE_EXTENSION (source_binding));
+               if (e_source_has_extension (source, E_SOURCE_EXTENSION_AUTHENTICATION)) {
+                       extension = e_source_get_extension (source, E_SOURCE_EXTENSION_AUTHENTICATION);
+                       user = e_source_authentication_get_user (extension);
+
+                       e_util_change_uri_component (&uri, SOUP_URI_USER, user);
+               }
+
+               g_clear_object (&source);
+       }
+
+       g_value_take_boxed (target_value, uri);
+
+       return TRUE;
+}
+
+/**
+ * e_binding_transform_uri_to_text:
+ * @binding: a #GBinding
+ * @source_value: a #GValue of boxed #GUri
+ * @target_value: a #GValue of type #G_TYPE_STRING
+ * @not_used: not used
+ *
+ * Transforms a #GUri into a string.
+ *
+ * Returns: %TRUE
+ *
+ **/
+gboolean
+e_binding_transform_uri_to_text (GBinding *binding,
+                                const GValue *source_value,
+                                GValue *target_value,
+                                gpointer not_used)
+{
+       GUri *uri;
+       gchar *text;
+
+       uri = g_value_get_boxed (source_value);
+
+       if (g_uri_get_host (uri)) {
+               text = g_uri_to_string_partial (uri, G_URI_HIDE_USERINFO | G_URI_HIDE_PASSWORD);
+       } else {
+               GObject *target;
+
+               text = NULL;
+               target = g_binding_get_target (binding);
+               g_object_get (target, g_binding_get_target_property (binding), &text, NULL);
+
+               if (!text || !*text) {
+                       g_free (text);
+                       text = g_uri_to_string_partial (uri, G_URI_HIDE_USERINFO | G_URI_HIDE_PASSWORD);
+               }
+       }
+
+       g_value_take_string (target_value, text);
+
+       return TRUE;
+}
+
 /**
  * e_binding_bind_object_text_property:
  * @source: the source #GObject
@@ -4595,21 +4691,21 @@ e_util_get_uri_tooltip (const gchar *uri)
                message = g_string_new (_("Click to hide/unhide addresses"));
        else if (g_str_has_prefix (uri, "mail:")) {
                const gchar *fragment;
-               SoupURI *soup_uri;
+               GUri *guri;
 
-               soup_uri = soup_uri_new (uri);
-               if (!soup_uri)
+               guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+               if (!guri)
                        goto exit;
 
                message = g_string_new (NULL);
-               fragment = soup_uri_get_fragment (soup_uri);
+               fragment = g_uri_get_fragment (guri);
 
                if (fragment && *fragment)
                        g_string_append_printf (message, _("Go to the section %s of the message"), fragment);
                else
                        g_string_append (message, _("Go to the beginning of the message"));
 
-               soup_uri_free (soup_uri);
+               g_uri_unref (guri);
        } else {
                message = g_string_new (NULL);
 
diff --git a/src/e-util/e-misc-utils.h b/src/e-util/e-misc-utils.h
index 85f73e8fa4..ed37ab5efb 100644
--- a/src/e-util/e-misc-utils.h
+++ b/src/e-util/e-misc-utils.h
@@ -249,6 +249,14 @@ gboolean   e_binding_transform_text_non_null
                                                 const GValue *source_value,
                                                 GValue *target_value,
                                                 gpointer user_data);
+gboolean       e_binding_transform_text_to_uri (GBinding *binding,
+                                                const GValue *source_value,
+                                                GValue *target_value,
+                                                gpointer not_used);
+gboolean       e_binding_transform_uri_to_text (GBinding *binding,
+                                                const GValue *source_value,
+                                                GValue *target_value,
+                                                gpointer not_used);
 
 GBinding *     e_binding_bind_object_text_property
                                                (gpointer source,
diff --git a/src/e-util/e-passwords.c b/src/e-util/e-passwords.c
index 2d52752ab0..a3d385c7cf 100644
--- a/src/e-util/e-passwords.c
+++ b/src/e-util/e-passwords.c
@@ -103,27 +103,33 @@ static GQueue message_queue = G_QUEUE_INIT;
 static gint idle_id;
 static gint ep_online_state = TRUE;
 
-static SoupURI *
+static GUri *
 ep_keyring_uri_new (const gchar *string,
                     GError **error)
 {
-       SoupURI *uri;
+       GUri *uri;
 
-       uri = soup_uri_new (string);
+       uri = g_uri_parse (string, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
        g_return_val_if_fail (uri != NULL, NULL);
 
        /* LDAP URIs do not have usernames, so use the URI as the username. */
-       if (uri->user == NULL && uri->scheme != NULL &&
-                       (strcmp (uri->scheme, "ldap") == 0|| strcmp (uri->scheme, "google") == 0))
-               uri->user = g_strdelimit (g_strdup (string), "/=", '_');
+       if (!g_uri_get_user (uri) &&
+           (g_strcmp0 (g_uri_get_scheme (uri), "ldap") == 0 ||
+            g_strcmp0 (g_uri_get_scheme (uri), "google") == 0)) {
+               gchar *user = g_strdelimit (g_strdup (string), "/=", '_');
+
+               e_util_change_uri_component (&uri, SOUP_URI_USER, user);
+
+               g_free (user);
+       }
 
        /* Make sure the URI has the required components. */
-       if (uri->user == NULL && uri->host == NULL) {
+       if (!g_uri_get_user (uri) && !g_uri_get_host (uri)) {
                g_set_error_literal (
                        error, G_IO_ERROR,
                        G_IO_ERROR_INVALID_ARGUMENT,
                        _("Keyring key is unusable: no user or host name"));
-               soup_uri_free (uri);
+               g_uri_unref (uri);
                uri = NULL;
        }
 
@@ -212,7 +218,7 @@ static void
 ep_remember_password (EPassMsg *msg)
 {
        gchar *password;
-       SoupURI *uri;
+       GUri *uri;
        GError *error = NULL;
 
        password = g_hash_table_lookup (password_cache, msg->key);
@@ -231,9 +237,9 @@ ep_remember_password (EPassMsg *msg)
                msg->key, password,
                NULL, &error,
                "application", "Evolution",
-               "user", uri->user,
-               "server", uri->host,
-               "protocol", uri->scheme,
+               "user", g_uri_get_user (uri),
+               "server", g_uri_get_host (uri),
+               "protocol", g_uri_get_scheme (uri),
                NULL);
 
        /* Only remove the password from the session hash
@@ -243,7 +249,7 @@ ep_remember_password (EPassMsg *msg)
        else
                g_propagate_error (&msg->error, error);
 
-       soup_uri_free (uri);
+       g_uri_unref (uri);
 
 exit:
        if (!msg->noreply)
@@ -253,7 +259,7 @@ exit:
 static void
 ep_forget_password (EPassMsg *msg)
 {
-       SoupURI *uri;
+       GUri *uri;
        GError *error = NULL;
 
        g_hash_table_remove (password_cache, msg->key);
@@ -273,14 +279,14 @@ ep_forget_password (EPassMsg *msg)
        secret_password_clear_sync (
                &e_passwords_schema, NULL, &error,
                "application", "Evolution",
-               "user", uri->user,
-               "server", uri->host,
+               "user", g_uri_get_user (uri),
+               "server", g_uri_get_host (uri),
                NULL);
 
        if (error != NULL)
                g_propagate_error (&msg->error, error);
 
-       soup_uri_free (uri);
+       g_uri_unref (uri);
 
 exit:
        if (!msg->noreply)
@@ -290,7 +296,7 @@ exit:
 static void
 ep_get_password (EPassMsg *msg)
 {
-       SoupURI *uri;
+       GUri *uri;
        gchar *password;
        GError *error = NULL;
 
@@ -308,9 +314,9 @@ ep_get_password (EPassMsg *msg)
        msg->password = secret_password_lookup_sync (
                &e_passwords_schema, NULL, &error,
                "application", "Evolution",
-               "user", uri->user,
-               "server", uri->host,
-               "protocol", uri->scheme,
+               "user", g_uri_get_user (uri),
+               "server", g_uri_get_host (uri),
+               "protocol", g_uri_get_scheme (uri),
                NULL);
 
        if (msg->password != NULL)
@@ -327,15 +333,15 @@ ep_get_password (EPassMsg *msg)
        msg->password = secret_password_lookup_sync (
                &e_passwords_schema, NULL, &error,
                "application", "Evolution",
-               "user", uri->user,
-               "server", uri->host,
+               "user", g_uri_get_user (uri),
+               "server", g_uri_get_host (uri),
                NULL);
 
 done:
        if (error != NULL)
                g_propagate_error (&msg->error, error);
 
-       soup_uri_free (uri);
+       g_uri_unref (uri);
 
 exit:
        if (!msg->noreply)
diff --git a/src/e-util/e-stock-request.c b/src/e-util/e-stock-request.c
index f913db363e..899826a6bd 100644
--- a/src/e-util/e-stock-request.c
+++ b/src/e-util/e-stock-request.c
@@ -71,7 +71,7 @@ static gboolean
 process_stock_request_idle_cb (gpointer user_data)
 {
        StockIdleData *sid = user_data;
-       SoupURI *suri;
+       GUri *guri;
        GHashTable *query = NULL;
        GtkStyleContext *context;
        GtkWidgetPath *path;
@@ -93,11 +93,11 @@ process_stock_request_idle_cb (gpointer user_data)
                return FALSE;
        }
 
-       suri = soup_uri_new (sid->uri);
-       g_return_val_if_fail (suri != NULL, FALSE);
+       guri = g_uri_parse (sid->uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+       g_return_val_if_fail (guri != NULL, FALSE);
 
-       if (suri->query != NULL)
-               query = soup_form_decode (suri->query);
+       if (g_uri_get_query (guri))
+               query = soup_form_decode (g_uri_get_query (guri));
 
        if (query != NULL) {
                const gchar *value;
@@ -117,7 +117,7 @@ process_stock_request_idle_cb (gpointer user_data)
        gtk_style_context_set_path (context, path);
        gtk_widget_path_free (path);
 
-       icon_set = gtk_style_context_lookup_icon_set (context, suri->host);
+       icon_set = gtk_style_context_lookup_icon_set (context, g_uri_get_host (guri));
        if (icon_set != NULL) {
                GdkPixbuf *pixbuf;
 
@@ -150,7 +150,7 @@ process_stock_request_idle_cb (gpointer user_data)
                icon_theme = gtk_icon_theme_get_default ();
 
                icon_info = gtk_icon_theme_lookup_icon (
-                       icon_theme, suri->host, size,
+                       icon_theme, g_uri_get_host (guri), size,
                        GTK_ICON_LOOKUP_USE_BUILTIN);
 
                /* Some icons can be missing in the theme */
@@ -176,7 +176,7 @@ process_stock_request_idle_cb (gpointer user_data)
                        }
 
                        gtk_icon_info_free (icon_info);
-               } else if (g_strcmp0 (suri->host, "x-evolution-arrow-down") == 0) {
+               } else if (g_strcmp0 (g_uri_get_host (guri), "x-evolution-arrow-down") == 0) {
                        GdkPixbuf *pixbuf;
                        GdkRGBA rgba;
                        guchar *data;
@@ -237,7 +237,7 @@ process_stock_request_idle_cb (gpointer user_data)
                sid->success = FALSE;
        }
 
-       soup_uri_free (suri);
+       g_uri_unref (guri);
        g_object_unref (context);
 
        e_flag_set (sid->flag);
diff --git a/src/e-util/e-web-view.c b/src/e-util/e-web-view.c
index 1115ab8e9b..0beb479846 100644
--- a/src/e-util/e-web-view.c
+++ b/src/e-util/e-web-view.c
@@ -721,31 +721,31 @@ web_view_decide_policy_cb (EWebView *web_view,
 
        /* Allow navigation through fragments in page */
        if (uri && *uri && view_uri && *view_uri) {
-               SoupURI *uri_link, *uri_view;
+               GUri *uri_link, *uri_view;
 
-               uri_link = soup_uri_new (uri);
-               uri_view = soup_uri_new (view_uri);
+               uri_link = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+               uri_view = g_uri_parse (view_uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
                if (uri_link && uri_view) {
                        const gchar *tmp1, *tmp2;
 
-                       tmp1 = soup_uri_get_scheme (uri_link);
-                       tmp2 = soup_uri_get_scheme (uri_view);
+                       tmp1 = g_uri_get_scheme (uri_link);
+                       tmp2 = g_uri_get_scheme (uri_view);
 
                        /* The scheme on both URIs should be the same */
                        if (tmp1 && tmp2 && g_ascii_strcasecmp (tmp1, tmp2) != 0)
                                goto free_uris;
 
-                       tmp1 = soup_uri_get_host (uri_link);
-                       tmp2 = soup_uri_get_host (uri_view);
+                       tmp1 = g_uri_get_host (uri_link);
+                       tmp2 = g_uri_get_host (uri_view);
 
                        /* The host on both URIs should be the same */
                        if (tmp1 && tmp2 && g_ascii_strcasecmp (tmp1, tmp2) != 0)
                                goto free_uris;
 
                        /* URI from link should have fragment set - could be empty */
-                       if (soup_uri_get_fragment (uri_link)) {
-                               soup_uri_free (uri_link);
-                               soup_uri_free (uri_view);
+                       if (g_uri_get_fragment (uri_link)) {
+                               g_uri_unref (uri_link);
+                               g_uri_unref (uri_view);
                                webkit_policy_decision_use (decision);
                                return TRUE;
                        }
@@ -753,9 +753,9 @@ web_view_decide_policy_cb (EWebView *web_view,
 
  free_uris:
                if (uri_link)
-                       soup_uri_free (uri_link);
+                       g_uri_unref (uri_link);
                if (uri_view)
-                       soup_uri_free (uri_view);
+                       g_uri_unref (uri_view);
        }
 
        /* XXX WebKitWebView does not provide a class method for
diff --git a/src/e-util/e-webdav-browser.c b/src/e-util/e-webdav-browser.c
index bbc092c3fb..d9c3afe668 100644
--- a/src/e-util/e-webdav-browser.c
+++ b/src/e-util/e-webdav-browser.c
@@ -38,6 +38,7 @@
 #include "e-alert-bar.h"
 #include "e-alert-dialog.h"
 #include "e-alert-sink.h"
+#include "e-misc-utils.h"
 #include "e-spell-text-view.h"
 
 #include "e-webdav-browser.h"
@@ -358,11 +359,11 @@ webdav_browser_manage_login_errors (EWebDAVBrowser *webdav_browser,
        led.flag = NULL;
        led.repeat = FALSE;
 
-       if (g_error_matches (error, SOUP_HTTP_ERROR, SOUP_STATUS_SSL_FAILED) &&
+       if (g_error_matches (error, G_TLS_ERROR, G_TLS_ERROR_BAD_CERTIFICATE) &&
            e_soup_session_get_ssl_error_details (E_SOUP_SESSION (session), &led.certificate_pem, 
&led.certificate_errors)) {
                led.run_trust_prompt = TRUE;
                led.flag = e_flag_new ();
-       } else if (g_error_matches (error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED)) {
+       } else if (g_error_matches (error, E_SOUP_SESSION_ERROR, SOUP_STATUS_UNAUTHORIZED)) {
                led.flag = e_flag_new ();
        }
 
@@ -712,7 +713,7 @@ typedef struct _SearchHomeData {
 static gboolean
 webdav_browser_search_home_hrefs_cb (EWebDAVSession *webdav,
                                     xmlNodePtr prop_node,
-                                    const SoupURI *request_uri,
+                                    const GUri *request_uri,
                                     const gchar *href,
                                     guint status_code,
                                     gpointer user_data)
@@ -899,7 +900,6 @@ webdav_browser_gather_href_resources_sync (EWebDAVBrowser *webdav_browser,
                                GHashTable *allows = NULL;
                                guint32 editing_flags = E_EDITING_FLAG_NONE;
                                ResourceData *rd;
-                               gchar *tmp;
 
                                if (!resource ||
                                    !resource->href || (
@@ -934,6 +934,8 @@ webdav_browser_gather_href_resources_sync (EWebDAVBrowser *webdav_browser,
                                        editing_flags |= E_EDITING_FLAG_IS_COLLECTION;
 
                                if (!g_str_has_suffix (resource->href, "/")) {
+                                       gchar *tmp;
+
                                        tmp = g_strconcat (resource->href, "/", NULL);
 
                                        g_free (resource->href);
@@ -942,9 +944,13 @@ webdav_browser_gather_href_resources_sync (EWebDAVBrowser *webdav_browser,
 
                                /* Because for example Google server returns the '@' sometimes encoded and 
sometimes not,
                                   which breaks lookup based on href in the code. */
-                               tmp = soup_uri_normalize (resource->href, "@");
-                               g_free (resource->href);
-                               resource->href = tmp;
+                               if (strstr (resource->href, "%40")) {
+                                       GString *tmp;
+
+                                       tmp = e_str_replace_string (resource->href, "%40", "@");
+                                       g_free (resource->href);
+                                       resource->href = g_string_free (tmp, FALSE);
+                               }
 
                                rd = g_slice_new0 (ResourceData);
                                rd->editing_flags = editing_flags;
@@ -1154,22 +1160,21 @@ webdav_browser_search_user_home_thread (EAlertSinkThreadJobData *job_data,
        source = e_soup_session_get_source (E_SOUP_SESSION (session));
        if (source && e_source_has_extension (source, E_SOURCE_EXTENSION_WEBDAV_BACKEND)) {
                ESourceWebdav *webdav_extension;
-               SoupURI *suri;
+               GUri *guri;
 
                webdav_extension = e_source_get_extension (source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
-               suri = e_source_webdav_dup_soup_uri (webdav_extension);
+               guri = e_source_webdav_dup_uri (webdav_extension);
 
-               if (suri) {
+               if (guri) {
                        gchar *path;
 
-                       soup_uri_set_user (suri, NULL);
-                       path = soup_uri_to_string (suri, FALSE);
+                       path = g_uri_to_string_partial (guri, G_URI_HIDE_USERINFO | G_URI_HIDE_PASSWORD);
                        if (path) {
                                shd.home_hrefs = g_slist_prepend (shd.home_hrefs, g_strdup (path));
                                g_hash_table_insert (shd.covered_home_hrefs, path, NULL);
                        }
 
-                       path = g_strdup (soup_uri_get_path (suri));
+                       path = g_strdup (g_uri_get_path (guri));
                        if (path) {
                                gint len, pos;
                                gint levels_back = 0;
@@ -1187,8 +1192,8 @@ webdav_browser_search_user_home_thread (EAlertSinkThreadJobData *job_data,
 
                                                path[pos + 1] = '\0';
 
-                                               soup_uri_set_path (suri, path);
-                                               shd.todo_hrefs = g_slist_prepend (shd.todo_hrefs, 
soup_uri_to_string (suri, FALSE));
+                                               e_util_change_uri_component (&guri, SOUP_URI_PATH, path);
+                                               shd.todo_hrefs = g_slist_prepend (shd.todo_hrefs, 
g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD));
                                        }
                                }
 
@@ -1196,19 +1201,18 @@ webdav_browser_search_user_home_thread (EAlertSinkThreadJobData *job_data,
                        }
                }
 
-               if (suri && (!soup_uri_get_path (suri) || !strstr (soup_uri_get_path (suri), 
"/.well-known/"))) {
-                       soup_uri_set_path (suri, "/.well-known/caldav");
-                       shd.todo_hrefs = g_slist_prepend (shd.todo_hrefs, soup_uri_to_string (suri, FALSE));
+               if (guri && (!g_uri_get_path (guri) || !strstr (g_uri_get_path (guri), "/.well-known/"))) {
+                       e_util_change_uri_component (&guri, SOUP_URI_PATH, "/.well-known/caldav");
+                       shd.todo_hrefs = g_slist_prepend (shd.todo_hrefs, g_uri_to_string_partial (guri, 
G_URI_HIDE_PASSWORD));
 
-                       soup_uri_set_path (suri, "/.well-known/carddav");
-                       shd.todo_hrefs = g_slist_prepend (shd.todo_hrefs, soup_uri_to_string (suri, FALSE));
+                       e_util_change_uri_component (&guri, SOUP_URI_PATH, "/.well-known/carddav");
+                       shd.todo_hrefs = g_slist_prepend (shd.todo_hrefs, g_uri_to_string_partial (guri, 
G_URI_HIDE_PASSWORD));
                }
 
-               if (suri) {
-                       soup_uri_set_path (suri, "");
-                       shd.todo_hrefs = g_slist_prepend (shd.todo_hrefs, soup_uri_to_string (suri, FALSE));
-
-                       soup_uri_free (suri);
+               if (guri) {
+                       e_util_change_uri_component (&guri, SOUP_URI_PATH, "");
+                       shd.todo_hrefs = g_slist_prepend (shd.todo_hrefs, g_uri_to_string_partial (guri, 
G_URI_HIDE_PASSWORD));
+                       g_uri_unref (guri);
                }
        }
 
@@ -1251,22 +1255,20 @@ webdav_browser_search_user_home_thread (EAlertSinkThreadJobData *job_data,
 
        if (!shd.home_hrefs) {
                ESourceWebdav *webdav_extension;
-               SoupURI *suri;
+               GUri *guri;
 
                webdav_extension = e_source_get_extension (source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
-               suri = e_source_webdav_dup_soup_uri (webdav_extension);
+               guri = e_source_webdav_dup_uri (webdav_extension);
 
-               if (suri) {
+               if (guri) {
                        gchar *path;
 
-                       soup_uri_set_user (suri, NULL);
-
-                       path = g_strdup (soup_uri_get_path (suri));
+                       path = g_uri_to_string_partial (guri, G_URI_HIDE_USERINFO | G_URI_HIDE_PASSWORD);
                        if (path) {
                                gint len, pos;
                                gint levels_back = 0;
 
-                               shd.home_hrefs = g_slist_prepend (shd.home_hrefs, soup_uri_to_string (suri, 
FALSE));
+                               shd.home_hrefs = g_slist_prepend (shd.home_hrefs, g_strdup (path));
 
                                /* There is no guarantee that the parent folder is a WebDAV collection,
                                   but let's try it, just in case. */
@@ -1283,8 +1285,8 @@ webdav_browser_search_user_home_thread (EAlertSinkThreadJobData *job_data,
 
                                                path[pos + 1] = '\0';
 
-                                               soup_uri_set_path (suri, path);
-                                               href = soup_uri_to_string (suri, FALSE);
+                                               e_util_change_uri_component (&guri, SOUP_URI_PATH, path);
+                                               href = g_uri_to_string_partial (guri, G_URI_HIDE_USERINFO | 
G_URI_HIDE_PASSWORD);
 
                                                if (!g_hash_table_contains (shd.covered_home_hrefs, href))
                                                        shd.home_hrefs = g_slist_prepend (shd.home_hrefs, 
href);
@@ -1296,7 +1298,7 @@ webdav_browser_search_user_home_thread (EAlertSinkThreadJobData *job_data,
                                g_free (path);
                        }
 
-                       soup_uri_free (suri);
+                       g_uri_unref (guri);
                }
        }
 
@@ -1732,23 +1734,23 @@ webdav_browser_save_changes_thread (EAlertSinkThreadJobData *job_data,
 
                g_slist_free_full (changes, e_webdav_property_change_free);
        } else {
-               SoupURI *suri;
+               GUri *guri;
                GString *path;
                gchar *encoded;
 
-               suri = soup_uri_new (scd->href);
-               path = g_string_new (soup_uri_get_path (suri));
+               guri = g_uri_parse (scd->href, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+               path = g_string_new (g_uri_get_path (guri));
 
                if (path->len && path->str[path->len - 1] != '/')
                        g_string_append_c (path, '/');
 
-               encoded = soup_uri_encode (scd->name, NULL);
+               encoded = g_uri_escape_string (scd->name, NULL, FALSE);
                g_string_append (path, encoded);
                g_free (encoded);
 
-               soup_uri_set_path (suri, path->str);
+               e_util_change_uri_component (&guri, SOUP_URI_PATH, path->str);
 
-               new_href = soup_uri_to_string (suri, FALSE);
+               new_href = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
 
                if ((scd->supports & E_WEBDAV_RESOURCE_SUPPORTS_CONTACTS) != 0) {
                        success = e_webdav_session_mkcol_addressbook_sync (session, new_href,
@@ -1792,7 +1794,7 @@ webdav_browser_save_changes_thread (EAlertSinkThreadJobData *job_data,
                }
 
                g_string_free (path, TRUE);
-               soup_uri_free (suri);
+               g_uri_unref (guri);
        }
 
        if (success) {
@@ -2405,20 +2407,20 @@ webdav_browser_refresh (EWebDAVBrowser *webdav_browser)
        if (webdav_browser->priv->session) {
                ESource *source;
                ESourceWebdav *webdav_extension;
-               SoupURI *suri;
+               GUri *guri;
 
                source = e_soup_session_get_source (E_SOUP_SESSION (webdav_browser->priv->session));
                g_return_if_fail (E_IS_SOURCE (source));
                g_return_if_fail (e_source_has_extension (source, E_SOURCE_EXTENSION_WEBDAV_BACKEND));
 
                webdav_extension = e_source_get_extension (source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
-               suri = e_source_webdav_dup_soup_uri (webdav_extension);
+               guri = e_source_webdav_dup_uri (webdav_extension);
 
-               g_return_if_fail (suri != NULL);
+               g_return_if_fail (guri != NULL);
 
-               gtk_label_set_text (webdav_browser->priv->url_label, soup_uri_get_host (suri));
+               gtk_label_set_text (webdav_browser->priv->url_label, g_uri_get_host (guri));
 
-               soup_uri_free (suri);
+               g_uri_unref (guri);
 
                webdav_browser_search_user_home (webdav_browser);
        } else {
diff --git a/src/em-format/e-mail-part-utils.c b/src/em-format/e-mail-part-utils.c
index c43d25bf43..c6aa91ac5c 100644
--- a/src/em-format/e-mail-part-utils.c
+++ b/src/em-format/e-mail-part-utils.c
@@ -518,7 +518,7 @@ e_mail_part_build_uri (CamelFolder *folder,
                service_uid = "generic";
        } else {
                tmp = (gchar *) camel_folder_get_full_name (folder);
-               folder_name = (const gchar *) soup_uri_encode (tmp, NULL);
+               folder_name = (const gchar *) g_uri_escape_string (tmp, NULL, FALSE);
                store = camel_folder_get_parent_store (folder);
                if (store)
                        service_uid = camel_service_get_uid (CAMEL_SERVICE (store));
@@ -526,7 +526,7 @@ e_mail_part_build_uri (CamelFolder *folder,
                        service_uid = "generic";
        }
 
-       encoded_message_uid = soup_uri_encode (message_uid, NULL);
+       encoded_message_uid = g_uri_escape_string (message_uid, NULL, FALSE);
        tmp = g_strdup_printf (
                "mail://%s/%s/%s",
                service_uid,
@@ -563,7 +563,7 @@ e_mail_part_build_uri (CamelFolder *folder,
                        }
                        case G_TYPE_STRING: {
                                gchar *val = va_arg (ap, gchar *);
-                               gchar *escaped = soup_uri_encode (val, NULL);
+                               gchar *escaped = g_uri_escape_string (val, NULL, FALSE);
                                tmp2 = g_strdup_printf (
                                        "%s%c%s=%s", tmp,
                                                separator, name, escaped);
diff --git a/src/mail/e-http-request.c b/src/mail/e-http-request.c
index bd5f8d44e4..a30911e801 100644
--- a/src/mail/e-http-request.c
+++ b/src/mail/e-http-request.c
@@ -19,10 +19,7 @@
 
 #include <string.h>
 
-#define LIBSOUP_USE_UNSTABLE_REQUEST_API
 #include <libsoup/soup.h>
-#include <libsoup/soup-requester.h>
-#include <libsoup/soup-request-http.h>
 #include <camel/camel.h>
 #include <webkit2/webkit2.h>
 
@@ -97,75 +94,6 @@ copy_stream_to_stream (GIOStream *file_io_stream,
        return total_len;
 }
 
-static void
-redirect_handler (SoupMessage *msg,
-                  gpointer user_data)
-{
-       if (SOUP_STATUS_IS_REDIRECTION (msg->status_code)) {
-               SoupSession *soup_session = user_data;
-               SoupURI *new_uri;
-               const gchar *new_loc;
-
-               new_loc = soup_message_headers_get_list (
-                       msg->response_headers, "Location");
-               if (new_loc == NULL)
-                       return;
-
-               new_uri = soup_uri_new_with_base (
-                       soup_message_get_uri (msg), new_loc);
-               if (new_uri == NULL) {
-                       soup_message_set_status_full (
-                               msg,
-                               SOUP_STATUS_MALFORMED,
-                               "Invalid Redirect URL");
-                       return;
-               }
-
-               soup_message_set_uri (msg, new_uri);
-               soup_session_requeue_message (soup_session, msg);
-
-               soup_uri_free (new_uri);
-       }
-}
-
-static void
-send_and_handle_redirection (SoupSession *session,
-                             SoupMessage *message,
-                             gchar **new_location)
-{
-       SoupURI *soup_uri;
-       gchar *old_uri = NULL;
-
-       g_return_if_fail (message != NULL);
-
-       soup_uri = soup_message_get_uri (message);
-
-       if (new_location != NULL)
-               old_uri = soup_uri_to_string (soup_uri, FALSE);
-
-       soup_message_set_flags (message, SOUP_MESSAGE_NO_REDIRECT);
-       soup_message_add_header_handler (
-               message, "got_body", "Location",
-               G_CALLBACK (redirect_handler), session);
-       soup_message_headers_append (
-               message->request_headers, "Connection", "close");
-       soup_session_send_message (session, message);
-
-       if (new_location != NULL) {
-               gchar *new_loc;
-
-               new_loc = soup_uri_to_string (soup_uri, FALSE);
-
-               if (new_loc && old_uri && !g_str_equal (new_loc, old_uri)) {
-                       *new_location = new_loc;
-               } else {
-                       g_free (new_loc);
-               }
-       }
-
-       g_free (old_uri);
-}
-
 static void
 http_request_cancelled_cb (GCancellable *cancellable,
                           SoupSession *session)
@@ -183,7 +111,7 @@ e_http_request_process_sync (EContentRequest *request,
                             GCancellable *cancellable,
                             GError **error)
 {
-       SoupURI *soup_uri;
+       GUri *guri;
        gchar *evo_uri = NULL, *use_uri;
        gchar *mail_uri = NULL;
        GInputStream *stream;
@@ -205,22 +133,23 @@ e_http_request_process_sync (EContentRequest *request,
        if (g_cancellable_set_error_if_cancelled (cancellable, error))
                return FALSE;
 
-       soup_uri = soup_uri_new (uri);
-       g_return_val_if_fail (soup_uri != NULL, FALSE);
+       guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+       g_return_val_if_fail (guri != NULL, FALSE);
 
        /* Remove the __evo-mail query */
-       soup_query = soup_uri_get_query (soup_uri);
+       soup_query = g_uri_get_query (guri);
        if (soup_query) {
                GHashTable *query;
+               gchar *query_str;
 
-               query = soup_form_decode (soup_uri_get_query (soup_uri));
+               query = soup_form_decode (g_uri_get_query (guri));
                mail_uri = g_hash_table_lookup (query, "__evo-mail");
                if (mail_uri)
                        mail_uri = g_strdup (mail_uri);
 
                g_hash_table_remove (query, "__evo-mail");
 
-               /* Required, because soup_uri_set_query_from_form() can change
+               /* Required, because soup_form_encode_hash() can change
                   order of arguments, then the URL checksum doesn't match. */
                evo_uri = g_hash_table_lookup (query, "__evo-original-uri");
                if (evo_uri)
@@ -232,12 +161,14 @@ e_http_request_process_sync (EContentRequest *request,
                 * force_load_images to TRUE) */
                force_load_images = g_hash_table_remove (query, "__evo-load-images");
 
-               soup_uri_set_query_from_form (soup_uri, query);
+               query_str = soup_form_encode_hash (query);
+               e_util_change_uri_component (&guri, SOUP_URI_QUERY, query_str);
                g_hash_table_unref (query);
+               g_free (query_str);
        }
 
        if (!evo_uri)
-               evo_uri = soup_uri_to_string (soup_uri, FALSE);
+               evo_uri = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
 
        if (camel_debug_start ("emformat:requests")) {
                printf (
@@ -363,9 +294,12 @@ e_http_request_process_sync (EContentRequest *request,
                EMailPartList *part_list;
 
                registry = e_mail_part_list_get_registry ();
-               decoded_uri = soup_uri_decode (mail_uri);
+               decoded_uri = g_uri_unescape_string (mail_uri, NULL);
 
-               part_list = camel_object_bag_get (registry, decoded_uri);
+               if (!decoded_uri)
+                       part_list = NULL;
+               else
+                       part_list = camel_object_bag_get (registry, decoded_uri);
                if (part_list != NULL) {
                        EShellBackend *shell_backend;
                        EMailBackend *backend;
@@ -406,7 +340,7 @@ e_http_request_process_sync (EContentRequest *request,
                SoupSession *temp_session;
                SoupMessage *message;
                GIOStream *cache_stream;
-               GMainContext *context;
+               GInputStream *input_stream;
                gulong cancelled_id = 0;
 
                if (g_cancellable_set_error_if_cancelled (cancellable, error))
@@ -418,39 +352,33 @@ e_http_request_process_sync (EContentRequest *request,
                        goto cleanup;
                }
 
-               context = g_main_context_new ();
-               g_main_context_push_thread_default (context);
-
-               temp_session = soup_session_new_with_options (
-                       SOUP_SESSION_TIMEOUT, 90, NULL);
-
                proxy_source = e_source_registry_ref_builtin_proxy (e_shell_get_registry (shell));
 
-               g_object_set (
-                       temp_session,
-                       SOUP_SESSION_PROXY_RESOLVER,
-                       G_PROXY_RESOLVER (proxy_source),
+               temp_session = soup_session_new_with_options (
+                       "timeout", 90,
+                       "proxy-resolver", proxy_source,
                        NULL);
 
                g_object_unref (proxy_source);
 
                soup_message_headers_append (
-                       message->request_headers,
+                       soup_message_get_request_headers (message),
                        "User-Agent", "Evolution/" VERSION);
 
                if (cancellable)
                        cancelled_id = g_cancellable_connect (cancellable, G_CALLBACK 
(http_request_cancelled_cb), temp_session, NULL);
 
-               send_and_handle_redirection (temp_session, message, NULL);
+               soup_message_headers_append (soup_message_get_request_headers (message), "Connection", 
"close");
+               input_stream = soup_session_send (temp_session, message, cancellable, NULL);
 
                if (cancellable && cancelled_id)
                        g_cancellable_disconnect (cancellable, cancelled_id);
 
-               if (!SOUP_STATUS_IS_SUCCESSFUL (message->status_code)) {
-                       g_debug ("Failed to request %s (code %d)", use_uri, message->status_code);
+               if (!input_stream || !SOUP_STATUS_IS_SUCCESSFUL (soup_message_get_status (message))) {
+                       g_debug ("Failed to request %s (code %d)", use_uri, soup_message_get_status 
(message));
                        g_object_unref (message);
                        g_object_unref (temp_session);
-                       g_main_context_unref (context);
+                       g_clear_object (&input_stream);
                        goto cleanup;
                }
 
@@ -466,52 +394,60 @@ e_http_request_process_sync (EContentRequest *request,
                                g_clear_error (&local_error);
                        } else {
                                GOutputStream *output_stream;
+                               gssize bytes_copied;
 
-                               output_stream =
-                                       g_io_stream_get_output_stream (cache_stream);
-
-                               success = g_output_stream_write_all (
-                                       output_stream,
-                                       message->response_body->data,
-                                       message->response_body->length,
-                                       NULL, cancellable, &local_error);
+                               output_stream = g_io_stream_get_output_stream (cache_stream);
+                               bytes_copied = g_output_stream_splice (output_stream, input_stream, 
G_OUTPUT_STREAM_SPLICE_NONE, cancellable, &local_error);
 
                                g_io_stream_close (cache_stream, NULL, NULL);
                                g_object_unref (cache_stream);
 
                                if (local_error != NULL) {
                                        if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-                                               g_warning (
-                                                       "Failed to write data to cache stream: %s",
-                                                       local_error->message);
+                                               g_warning ("Failed to write data to cache stream: %s", 
local_error->message);
                                        g_clear_error (&local_error);
                                        g_object_unref (message);
                                        g_object_unref (temp_session);
-                                       g_main_context_unref (context);
+                                       g_clear_object (&input_stream);
                                        goto cleanup;
                                }
 
-                               if (success) {
-                                       /* Send the response body to WebKit */
-                                       stream = g_memory_input_stream_new_from_data (
-                                               g_memdup (
-                                                       message->response_body->data,
-                                                       message->response_body->length),
-                                               message->response_body->length,
-                                               (GDestroyNotify) g_free);
-
-                                       *out_stream = stream;
-                                       *out_stream_length = message->response_body->length;
-                                       *out_mime_type = g_strdup (
-                                               soup_message_headers_get_content_type (
-                                                       message->response_headers, NULL));
+                               if (bytes_copied >= 0) {
+                                       gchar *filename;
+
+                                       filename = camel_data_cache_get_filename (cache, "http", uri_md5);
+
+                                       if (filename) {
+                                               GFileInputStream *file_input_stream;
+                                               GFile *file;
+
+                                               file = g_file_new_for_path (filename);
+                                               file_input_stream = g_file_read (file, cancellable, 
&local_error);
+
+                                               g_object_unref (file);
+
+                                               if (file_input_stream) {
+                                                       *out_stream = G_INPUT_STREAM (file_input_stream);
+                                                       *out_stream_length = bytes_copied;
+                                                       *out_mime_type = g_strdup 
(soup_message_headers_get_content_type (soup_message_get_response_headers (message), NULL));
+
+                                                       success = TRUE;
+                                               } else {
+                                                       g_warning ("Failed to read cache file '%s': %s", 
filename, local_error ? local_error->message : "Unknown error");
+                                                       g_clear_error (&local_error);
+                                               }
+
+                                               g_free (filename);
+                                       } else {
+                                               g_warning ("Failed to get just written cache file name");
+                                       }
                                }
                        }
                }
 
                g_object_unref (message);
                g_object_unref (temp_session);
-               g_main_context_unref (context);
+               g_clear_object (&input_stream);
 
                d (printf ("Received image from %s\n"
                        "Content-Type: %s\n"
@@ -527,7 +463,7 @@ e_http_request_process_sync (EContentRequest *request,
        g_free (use_uri);
        g_free (uri_md5);
        g_free (mail_uri);
-       soup_uri_free (soup_uri);
+       g_uri_unref (guri);
 
        return success;
 }
@@ -562,18 +498,18 @@ gchar *
 e_http_request_util_compute_uri_checksum (const gchar *in_uri)
 {
        GString *string;
-       SoupURI *soup_uri;
+       GUri *guri;
        const gchar *soup_query;
        gchar *md5, *uri;
 
        g_return_val_if_fail (in_uri != NULL, NULL);
 
-       soup_uri = soup_uri_new (in_uri);
-       g_return_val_if_fail (soup_uri != NULL, NULL);
+       guri = g_uri_parse (in_uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+       g_return_val_if_fail (guri != NULL, NULL);
 
        string = g_string_new ("");
 
-       soup_query = soup_uri_get_query (soup_uri);
+       soup_query = g_uri_get_query (guri);
        if (soup_query) {
                GHashTable *query;
                GList *keys, *link;
@@ -593,10 +529,10 @@ e_http_request_util_compute_uri_checksum (const gchar *in_uri)
                g_list_free (keys);
                g_hash_table_unref (query);
 
-               soup_uri_set_query (soup_uri, NULL);
+               e_util_change_uri_component (&guri, SOUP_URI_QUERY, NULL);
        }
 
-       uri = soup_uri_to_string (soup_uri, FALSE);
+       uri = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
        g_string_append (string, uri ? uri : "");
        g_free (uri);
 
@@ -608,7 +544,7 @@ e_http_request_util_compute_uri_checksum (const gchar *in_uri)
                md5 = NULL;
 
        g_string_free (string, TRUE);
-       soup_uri_free (soup_uri);
+       g_uri_unref (guri);
 
        return md5;
 }
diff --git a/src/mail/e-mail-autoconfig.c b/src/mail/e-mail-autoconfig.c
index 38f470e28c..03efcb1d70 100644
--- a/src/mail/e-mail-autoconfig.c
+++ b/src/mail/e-mail-autoconfig.c
@@ -80,7 +80,7 @@
 #define FAKE_EVOLUTION_USER_STRING "EVOLUTIONUSER"
 
 #define ERROR_IS_NOT_FOUND(error) \
-       (g_error_matches ((error), SOUP_HTTP_ERROR, SOUP_STATUS_NOT_FOUND))
+       (g_error_matches ((error), E_SOUP_SESSION_ERROR, SOUP_STATUS_NOT_FOUND))
 
 typedef struct _EMailAutoconfigResult EMailAutoconfigResult;
 typedef struct _ParserClosure ParserClosure;
@@ -501,8 +501,9 @@ mail_autoconfig_lookup_uri_sync (EMailAutoconfig *autoconfig,
                                 GError **error)
 {
        SoupMessage *soup_message;
+       GBytes *data;
        gboolean success;
-       guint status;
+       GError *local_error = NULL;
 
        soup_message = soup_message_new (SOUP_METHOD_GET, uri);
 
@@ -513,14 +514,14 @@ mail_autoconfig_lookup_uri_sync (EMailAutoconfig *autoconfig,
        }
 
        soup_message_headers_append (
-               soup_message->request_headers,
+               soup_message_get_request_headers (soup_message),
                "User-Agent", "Evolution/" VERSION VERSION_SUBSTRING " " VERSION_COMMENT);
 
-       status = soup_session_send_message (soup_session, soup_message);
+       data = soup_session_send_and_read (soup_session, soup_message, cancellable, &local_error);
 
-       success = SOUP_STATUS_IS_SUCCESSFUL (status);
+       success = SOUP_STATUS_IS_SUCCESSFUL (soup_message_get_status (soup_message));
 
-       if (success) {
+       if (success && data) {
                GMarkupParseContext *context;
                ParserClosure closure;
 
@@ -535,8 +536,8 @@ mail_autoconfig_lookup_uri_sync (EMailAutoconfig *autoconfig,
 
                success = g_markup_parse_context_parse (
                        context,
-                       soup_message->response_body->data,
-                       soup_message->response_body->length,
+                       g_bytes_get_data (data, NULL),
+                       g_bytes_get_size (data),
                        error);
 
                if (success)
@@ -546,14 +547,20 @@ mail_autoconfig_lookup_uri_sync (EMailAutoconfig *autoconfig,
                g_clear_pointer (&closure.current_type, g_free);
 
                g_markup_parse_context_free (context);
+       } else if (local_error) {
+               g_propagate_error (error, local_error);
+               local_error = NULL;
        } else {
                g_set_error_literal (
-                       error, SOUP_HTTP_ERROR,
-                       soup_message->status_code,
-                       soup_message->reason_phrase);
+                       error, E_SOUP_SESSION_ERROR,
+                       soup_message_get_status (soup_message),
+                       soup_message_get_reason_phrase (soup_message));
        }
 
+       if (data)
+               g_bytes_unref (data);
        g_object_unref (soup_message);
+       g_clear_error (&local_error);
 
        return success;
 }
@@ -576,8 +583,8 @@ mail_autoconfig_lookup (EMailAutoconfig *autoconfig,
        proxy_source = e_source_registry_ref_builtin_proxy (registry);
 
        soup_session = soup_session_new_with_options (
-               SOUP_SESSION_PROXY_RESOLVER, G_PROXY_RESOLVER (proxy_source),
-               SOUP_SESSION_TIMEOUT, 15,
+               "proxy-resolver", G_PROXY_RESOLVER (proxy_source),
+               "timeout", 15,
                NULL);
 
        g_object_unref (proxy_source);
diff --git a/src/mail/e-mail-display.c b/src/mail/e-mail-display.c
index ba0ec8892a..baf3e5f8ce 100644
--- a/src/mail/e-mail-display.c
+++ b/src/mail/e-mail-display.c
@@ -193,7 +193,7 @@ static void
 e_mail_display_claim_skipped_uri (EMailDisplay *mail_display,
                                  const gchar *uri)
 {
-       SoupURI *soup_uri;
+       GUri *guri;
        const gchar *site;
 
        g_return_if_fail (E_IS_MAIL_DISPLAY (mail_display));
@@ -203,11 +203,11 @@ e_mail_display_claim_skipped_uri (EMailDisplay *mail_display,
        if (!g_settings_get_boolean (mail_display->priv->settings, "notify-remote-content"))
                return;
 
-       soup_uri = soup_uri_new (uri);
-       if (!soup_uri)
+       guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+       if (!guri)
                return;
 
-       site = soup_uri_get_host (soup_uri);
+       site = g_uri_get_host (guri);
        if (site && *site) {
                g_mutex_lock (&mail_display->priv->remote_content_lock);
 
@@ -218,7 +218,7 @@ e_mail_display_claim_skipped_uri (EMailDisplay *mail_display,
                g_mutex_unlock (&mail_display->priv->remote_content_lock);
        }
 
-       soup_uri_free (soup_uri);
+       g_uri_unref (guri);
 }
 
 static void
@@ -235,7 +235,7 @@ static gboolean
 e_mail_display_can_download_uri (EMailDisplay *mail_display,
                                 const gchar *uri)
 {
-       SoupURI *soup_uri;
+       GUri *guri;
        const gchar *site;
        gboolean can_download = FALSE;
        EMailRemoteContent *remote_content;
@@ -247,17 +247,17 @@ e_mail_display_can_download_uri (EMailDisplay *mail_display,
        if (!remote_content)
                return FALSE;
 
-       soup_uri = soup_uri_new (uri);
-       if (!soup_uri) {
+       guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+       if (!guri) {
                g_object_unref (remote_content);
                return FALSE;
        }
 
-       site = soup_uri_get_host (soup_uri);
+       site = g_uri_get_host (guri);
        if (site && *site)
                can_download = e_mail_remote_content_has_site (remote_content, site);
 
-       soup_uri_free (soup_uri);
+       g_uri_unref (guri);
 
        if (!can_download && mail_display->priv->part_list) {
                CamelMimeMessage *message;
@@ -1773,8 +1773,8 @@ mail_display_uri_requested_cb (EWebView *web_view,
        if (uri_is_http) {
                CamelFolder *folder;
                const gchar *message_uid;
-               gchar *new_uri, *mail_uri;
-               SoupURI *soup_uri;
+               gchar *new_uri, *mail_uri, *query_str;
+               GUri *guri;
                GHashTable *query;
                gboolean can_download_uri;
                EImageLoadingPolicy image_policy;
@@ -1803,10 +1803,10 @@ mail_display_uri_requested_cb (EWebView *web_view,
                message_uid = e_mail_part_list_get_message_uid (part_list);
 
                if (g_str_has_prefix (uri, "evo-")) {
-                       soup_uri = soup_uri_new (uri);
+                       guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
                } else {
                        new_uri = g_strconcat ("evo-", uri, NULL);
-                       soup_uri = soup_uri_new (new_uri);
+                       guri = g_uri_parse (new_uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
 
                        g_free (new_uri);
                }
@@ -1818,7 +1818,7 @@ mail_display_uri_requested_cb (EWebView *web_view,
                        g_str_hash, g_str_equal,
                        g_free, g_free);
 
-               if (soup_uri->query) {
+               if (g_uri_get_query (guri)) {
                        GHashTable *uri_query;
                        GHashTableIter iter;
                        gpointer key, value;
@@ -1826,7 +1826,7 @@ mail_display_uri_requested_cb (EWebView *web_view,
                        /* It's required to copy the hash table, because it's uncertain
                           which of the key/value pair is freed and which not, while the code
                           below expects to have freed both. */
-                       uri_query = soup_form_decode (soup_uri->query);
+                       uri_query = soup_form_decode (g_uri_get_query (guri));
 
                        g_hash_table_iter_init (&iter, uri_query);
                        while (g_hash_table_iter_next (&iter, &key, &value)) {
@@ -1836,9 +1836,9 @@ mail_display_uri_requested_cb (EWebView *web_view,
                        g_hash_table_unref (uri_query);
                }
 
-               g_hash_table_insert (query, g_strdup ("__evo-mail"), soup_uri_encode (mail_uri, NULL));
+               g_hash_table_insert (query, g_strdup ("__evo-mail"), g_uri_escape_string (mail_uri, NULL, 
FALSE));
 
-               /* Required, because soup_uri_set_query_from_form() can change
+               /* Required, because soup_form_encode_hash() can change
                   order of arguments, then the URL checksum doesn't match. */
                g_hash_table_insert (query, g_strdup ("__evo-original-uri"), g_strdup (uri));
 
@@ -1851,11 +1851,13 @@ mail_display_uri_requested_cb (EWebView *web_view,
                        e_mail_display_claim_skipped_uri (display, uri);
                }
 
-               soup_uri_set_query_from_form (soup_uri, query);
+               query_str = soup_form_encode_hash (query);
+               e_util_change_uri_component (&guri, SOUP_URI_QUERY, query_str);
+               g_free (query_str);
 
-               new_uri = soup_uri_to_string (soup_uri, FALSE);
+               new_uri = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
 
-               soup_uri_free (soup_uri);
+               g_uri_unref (guri);
                g_hash_table_unref (query);
                g_free (mail_uri);
 
@@ -1895,7 +1897,7 @@ mail_display_suggest_filename (EWebView *web_view,
 {
        EMailDisplay *display;
        CamelMimePart *mime_part;
-       SoupURI *suri;
+       GUri *guri;
 
        /* Note, this assumes the URI comes
         * from the currently loaded message. */
@@ -1906,14 +1908,14 @@ mail_display_suggest_filename (EWebView *web_view,
        if (mime_part)
                return g_strdup (camel_mime_part_get_filename (mime_part));
 
-       suri = soup_uri_new (uri);
-       if (suri) {
+       guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+       if (guri) {
                gchar *filename = NULL;
 
-               if (suri->query) {
+               if (g_uri_get_query (guri)) {
                        GHashTable *uri_query;
 
-                       uri_query = soup_form_decode (suri->query);
+                       uri_query = soup_form_decode (g_uri_get_query (guri));
                        if (uri_query && g_hash_table_contains (uri_query, "filename"))
                                filename = g_strdup (g_hash_table_lookup (uri_query, "filename"));
 
@@ -1921,7 +1923,7 @@ mail_display_suggest_filename (EWebView *web_view,
                                g_hash_table_destroy (uri_query);
                }
 
-               soup_uri_free (suri);
+               g_uri_unref (guri);
 
                if (filename && *filename)
                        return filename;
@@ -2024,17 +2026,17 @@ mail_display_drag_data_get (GtkWidget *widget,
        mime_part = camel_mime_part_from_cid (display, uri);
 
        if (!mime_part && g_str_has_prefix (uri, "mail:")) {
-               SoupURI *soup_uri;
-               const gchar *soup_query;
+               GUri *guri;
+               const gchar *query_str;
 
-               soup_uri = soup_uri_new (uri);
-               if (soup_uri) {
-                       soup_query = soup_uri_get_query (soup_uri);
-                       if (soup_query) {
+               guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+               if (guri) {
+                       query_str = g_uri_get_query (guri);
+                       if (query_str) {
                                GHashTable *query;
                                const gchar *part_id_raw;
 
-                               query = soup_form_decode (soup_query);
+                               query = soup_form_decode (query_str);
                                part_id_raw = query ? g_hash_table_lookup (query, "part_id") : NULL;
                                if (part_id_raw && *part_id_raw) {
                                        EMailPartList *part_list;
@@ -2042,9 +2044,9 @@ mail_display_drag_data_get (GtkWidget *widget,
 
                                        part_list = e_mail_display_get_part_list (display);
                                        if (part_list) {
-                                               gchar *part_id = soup_uri_decode (part_id_raw);
+                                               gchar *part_id = g_uri_unescape_string (part_id_raw, NULL);
 
-                                               mail_part = e_mail_part_list_ref_part (part_list, part_id);
+                                               mail_part = part_id ? e_mail_part_list_ref_part (part_list, 
part_id) : NULL;
                                                g_free (part_id);
 
                                                if (mail_part) {
@@ -2065,7 +2067,7 @@ mail_display_drag_data_get (GtkWidget *widget,
                                        g_hash_table_unref (query);
                        }
 
-                       soup_uri_free (soup_uri);
+                       g_uri_unref (guri);
                }
        }
 
@@ -2766,7 +2768,7 @@ do_reload_display (EMailDisplay *display)
        EWebView *web_view;
        gchar *uri, *query;
        GHashTable *table;
-       SoupURI *soup_uri;
+       GUri *guri;
        gchar *mode, *collapsable, *collapsed;
        const gchar *default_charset, *charset;
 
@@ -2783,7 +2785,7 @@ do_reload_display (EMailDisplay *display)
                return FALSE;
        }
 
-       soup_uri = soup_uri_new (uri);
+       guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
 
        mode = g_strdup_printf ("%d", display->priv->mode);
        collapsable = g_strdup_printf ("%d", display->priv->headers_collapsable);
@@ -2796,7 +2798,7 @@ do_reload_display (EMailDisplay *display)
        if (!charset)
                charset = "";
 
-       table = soup_form_decode (soup_uri->query);
+       table = soup_form_decode (g_uri_get_query (guri));
        g_hash_table_replace (
                table, g_strdup ("mode"), mode);
        g_hash_table_replace (
@@ -2816,13 +2818,13 @@ do_reload_display (EMailDisplay *display)
        g_free (collapsed);
        g_hash_table_destroy (table);
 
-       soup_uri_set_query (soup_uri, query);
+       e_util_change_uri_component (&guri, SOUP_URI_QUERY, query);
        g_free (query);
 
-       uri = soup_uri_to_string (soup_uri, FALSE);
+       uri = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
        e_web_view_load_uri (web_view, uri);
        g_free (uri);
-       soup_uri_free (soup_uri);
+       g_uri_unref (guri);
 
        return FALSE;
 }
diff --git a/src/mail/e-mail-request.c b/src/mail/e-mail-request.c
index 65038036c6..8e4a5b5053 100644
--- a/src/mail/e-mail-request.c
+++ b/src/mail/e-mail-request.c
@@ -91,7 +91,7 @@ save_gicon_to_stream (GIcon *icon,
 
 static gboolean
 mail_request_process_mail_sync (EContentRequest *request,
-                               SoupURI *suri,
+                               GUri *guri,
                                GHashTable *uri_query,
                                GObject *requester,
                                GInputStream **out_stream,
@@ -115,7 +115,7 @@ mail_request_process_mail_sync (EContentRequest *request,
        if (g_cancellable_set_error_if_cancelled (cancellable, error))
                return FALSE;
 
-       tmp = g_strdup_printf ("%s://%s%s", suri->scheme, suri->host, suri->path);
+       tmp = g_strdup_printf ("%s://%s%s", g_uri_get_scheme (guri), g_uri_get_host (guri), g_uri_get_path 
(guri));
 
        registry = e_mail_part_list_get_registry ();
        part_list = camel_object_bag_get (registry, tmp);
@@ -129,7 +129,7 @@ mail_request_process_mail_sync (EContentRequest *request,
                        g_object_ref (part_list);
        }
 
-       context.uri = soup_uri_to_string (suri, FALSE);
+       context.uri = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
 
        if (camel_debug_start ("emformat:requests")) {
                printf ("%s: found part-list %p for full_uri '%s'\n", G_STRFUNC, part_list, context.uri);
@@ -176,8 +176,8 @@ mail_request_process_mail_sync (EContentRequest *request,
        if (val) {
                gchar *attachment_id;
 
-               attachment_id = soup_uri_decode (val);
-               if (E_IS_MAIL_DISPLAY (requester)) {
+               attachment_id = g_uri_unescape_string (val, NULL);
+               if (attachment_id && E_IS_MAIL_DISPLAY (requester)) {
                        EMailDisplay *mail_display = E_MAIL_DISPLAY (requester);
                        EAttachmentStore *attachment_store;
                        GList *attachments, *link;
@@ -236,8 +236,8 @@ mail_request_process_mail_sync (EContentRequest *request,
                const gchar *mime_type;
                gchar *part_id;
 
-               part_id = soup_uri_decode (val);
-               part = e_mail_part_list_ref_part (part_list, part_id);
+               part_id = g_uri_unescape_string (val, NULL);
+               part = part_id ? e_mail_part_list_ref_part (part_list, part_id) : NULL;
                if (!part) {
                        if (camel_debug_start ("emformat:requests")) {
                                printf ("%s: part with id '%s' not found\n", G_STRFUNC, part_id);
@@ -316,7 +316,7 @@ mail_request_process_mail_sync (EContentRequest *request,
 
 static gboolean
 mail_request_process_contact_photo_sync (EContentRequest *request,
-                                        SoupURI *suri,
+                                        GUri *guri,
                                         GHashTable *uri_query,
                                         GObject *requester,
                                         GInputStream **out_stream,
@@ -393,7 +393,7 @@ mail_request_process_contact_photo_sync (EContentRequest *request,
 typedef struct _MailIdleData
 {
        EContentRequest *request;
-       SoupURI *suri;
+       GUri *guri;
        GHashTable *uri_query;
        GObject *requester;
        GInputStream **out_stream;
@@ -413,11 +413,11 @@ process_mail_request_idle_cb (gpointer user_data)
 
        g_return_val_if_fail (mid != NULL, FALSE);
        g_return_val_if_fail (E_IS_MAIL_REQUEST (mid->request), FALSE);
-       g_return_val_if_fail (mid->suri != NULL, FALSE);
+       g_return_val_if_fail (mid->guri != NULL, FALSE);
        g_return_val_if_fail (mid->flag != NULL, FALSE);
 
        mid->success = mail_request_process_mail_sync (mid->request,
-               mid->suri, mid->uri_query, mid->requester, mid->out_stream,
+               mid->guri, mid->uri_query, mid->requester, mid->out_stream,
                mid->out_stream_length, mid->out_mime_type,
                mid->cancellable, mid->error);
 
@@ -436,7 +436,7 @@ e_mail_request_process_sync (EContentRequest *request,
                             GCancellable *cancellable,
                             GError **error)
 {
-       SoupURI *suri;
+       GUri *guri;
        GHashTable *uri_query;
        gboolean success = FALSE;
 
@@ -446,23 +446,23 @@ e_mail_request_process_sync (EContentRequest *request,
        if (g_cancellable_set_error_if_cancelled (cancellable, error))
                return FALSE;
 
-       suri = soup_uri_new (uri);
-       g_return_val_if_fail (suri != NULL, FALSE);
+       guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+       g_return_val_if_fail (guri != NULL, FALSE);
 
-       if (suri->query) {
-               uri_query = soup_form_decode (suri->query);
+       if (g_uri_get_query (guri)) {
+               uri_query = soup_form_decode (g_uri_get_query (guri));
        } else {
                uri_query = NULL;
        }
 
-       if (g_strcmp0 (suri->host, "contact-photo") == 0) {
-               success = mail_request_process_contact_photo_sync (request, suri, uri_query, requester,
+       if (g_strcmp0 (g_uri_get_host (guri), "contact-photo") == 0) {
+               success = mail_request_process_contact_photo_sync (request, guri, uri_query, requester,
                        out_stream, out_stream_length, out_mime_type, cancellable, error);
        } else {
                MailIdleData mid;
 
                mid.request = request;
-               mid.suri = suri;
+               mid.guri = guri;
                mid.uri_query = uri_query;
                mid.requester = requester;
                mid.out_stream = out_stream;
@@ -494,7 +494,7 @@ e_mail_request_process_sync (EContentRequest *request,
 
        if (uri_query)
                g_hash_table_destroy (uri_query);
-       soup_uri_free (suri);
+       g_uri_unref (guri);
 
        return success;
 }
diff --git a/src/modules/addressbook/e-book-shell-backend.c b/src/modules/addressbook/e-book-shell-backend.c
index cc63532d2f..4154eae8a6 100644
--- a/src/modules/addressbook/e-book-shell-backend.c
+++ b/src/modules/addressbook/e-book-shell-backend.c
@@ -361,7 +361,7 @@ static gboolean
 book_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
                                   const gchar *uri)
 {
-       SoupURI *soup_uri;
+       GUri *guri;
        const gchar *cp;
        gchar *source_uid = NULL;
        gchar *contact_uid = NULL;
@@ -369,15 +369,15 @@ book_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
        if (!g_str_has_prefix (uri, "contacts:"))
                return FALSE;
 
-       soup_uri = soup_uri_new (uri);
+       guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
 
-       if (soup_uri == NULL)
+       if (!guri)
                return FALSE;
 
-       cp = soup_uri_get_query (soup_uri);
+       cp = g_uri_get_query (guri);
 
        if (cp == NULL) {
-               soup_uri_free (soup_uri);
+               g_uri_unref (guri);
                return FALSE;
        }
 
@@ -422,7 +422,7 @@ book_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
        g_free (source_uid);
        g_free (contact_uid);
 
-       soup_uri_free (soup_uri);
+       g_uri_unref (guri);
 
        return TRUE;
 }
diff --git a/src/modules/book-config-carddav/evolution-book-config-carddav.c 
b/src/modules/book-config-carddav/evolution-book-config-carddav.c
index 7acd37c4a0..cc69f32bc7 100644
--- a/src/modules/book-config-carddav/evolution-book-config-carddav.c
+++ b/src/modules/book-config-carddav/evolution-book-config-carddav.c
@@ -75,7 +75,7 @@ book_config_carddav_run_dialog (GtkButton *button,
        ESourceRegistry *registry;
        ESourceWebdav *webdav_extension;
        ECredentialsPrompter *prompter;
-       SoupURI *uri;
+       GUri *guri;
        gchar *base_url;
        GtkDialog *dialog;
        gpointer parent;
@@ -94,11 +94,11 @@ book_config_carddav_run_dialog (GtkButton *button,
 
        webdav_extension = e_source_get_extension (context->scratch_source, 
E_SOURCE_EXTENSION_WEBDAV_BACKEND);
 
-       uri = e_source_webdav_dup_soup_uri (webdav_extension);
+       guri = e_source_webdav_dup_uri (webdav_extension);
 
        prompter = e_credentials_prompter_new (registry);
        e_credentials_prompter_set_auto_prompt (prompter, FALSE);
-       base_url = soup_uri_to_string (uri, FALSE);
+       base_url = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
 
        dialog = e_webdav_discover_dialog_new (parent, title, prompter, context->scratch_source, base_url, 
supports_filter);
 
@@ -121,10 +121,10 @@ book_config_carddav_run_dialog (GtkButton *button,
                content = e_webdav_discover_dialog_get_content (dialog);
 
                if (e_webdav_discover_content_get_selected (content, 0, &href, &supports, &display_name, 
&color, &order)) {
-                       soup_uri_free (uri);
-                       uri = soup_uri_new (href);
+                       g_uri_unref (guri);
+                       guri = g_uri_parse (href, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
 
-                       if (uri) {
+                       if (guri) {
                                ESourceAddressBook *addressbook_extension;
 
                                addressbook_extension = e_source_get_extension (context->scratch_source, 
E_SOURCE_EXTENSION_ADDRESS_BOOK);
@@ -132,7 +132,7 @@ book_config_carddav_run_dialog (GtkButton *button,
                                e_source_set_display_name (context->scratch_source, display_name);
 
                                e_source_webdav_set_display_name (webdav_extension, display_name);
-                               e_source_webdav_set_soup_uri (webdav_extension, uri);
+                               e_source_webdav_set_uri (webdav_extension, guri);
                                e_source_webdav_set_order (webdav_extension, order);
 
                                e_source_address_book_set_order (addressbook_extension, order);
@@ -158,80 +158,11 @@ book_config_carddav_run_dialog (GtkButton *button,
        gtk_widget_destroy (GTK_WIDGET (dialog));
 
        g_object_unref (prompter);
-       if (uri)
-               soup_uri_free (uri);
+       if (guri)
+               g_uri_unref (guri);
        g_free (base_url);
 }
 
-static gboolean
-book_config_carddav_uri_to_text (GBinding *binding,
-                                const GValue *source_value,
-                                GValue *target_value,
-                                gpointer user_data)
-{
-       SoupURI *soup_uri;
-       gchar *text;
-
-       soup_uri = g_value_get_boxed (source_value);
-       soup_uri_set_user (soup_uri, NULL);
-
-       if (soup_uri_get_host (soup_uri)) {
-               text = soup_uri_to_string (soup_uri, FALSE);
-       } else {
-               GObject *target;
-
-               text = NULL;
-               target = g_binding_get_target (binding);
-               g_object_get (target, g_binding_get_target_property (binding), &text, NULL);
-
-               if (!text || !*text) {
-                       g_free (text);
-                       text = soup_uri_to_string (soup_uri, FALSE);
-               }
-       }
-
-       g_value_take_string (target_value, text);
-
-       return TRUE;
-}
-
-static gboolean
-book_config_carddav_text_to_uri (GBinding *binding,
-                                const GValue *source_value,
-                                GValue *target_value,
-                                gpointer user_data)
-{
-       ESource *source;
-       SoupURI *soup_uri;
-       GObject *source_binding;
-       ESourceAuthentication *extension;
-       const gchar *extension_name;
-       const gchar *text;
-       const gchar *user;
-
-       text = g_value_get_string (source_value);
-       soup_uri = soup_uri_new (text);
-
-       if (!soup_uri)
-               soup_uri = soup_uri_new ("http://";);
-
-       source_binding = g_binding_get_source (binding);
-       source = e_source_extension_ref_source (
-               E_SOURCE_EXTENSION (source_binding));
-
-       extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
-       extension = e_source_get_extension (source, extension_name);
-       user = e_source_authentication_get_user (extension);
-
-       soup_uri_set_user (soup_uri, user);
-
-       g_value_take_boxed (target_value, soup_uri);
-
-       g_object_unref (source);
-
-       return TRUE;
-}
-
 static void
 book_config_carddav_insert_widgets (ESourceConfigBackend *backend,
                                    ESource *scratch_source)
@@ -269,10 +200,10 @@ book_config_carddav_insert_widgets (ESourceConfigBackend *backend,
                gtk_widget_show (widget);
 
                e_binding_bind_property_full (
-                       extension, "soup-uri",
+                       extension, "uri",
                        widget, "label",
                        G_BINDING_SYNC_CREATE,
-                       book_config_carddav_uri_to_text,
+                       e_binding_transform_uri_to_text,
                        NULL,
                        g_object_ref (scratch_source),
                        (GDestroyNotify) g_object_unref);
@@ -316,12 +247,12 @@ book_config_carddav_insert_widgets (ESourceConfigBackend *backend,
 
        if (context->url_entry) {
                e_binding_bind_property_full (
-                       extension, "soup-uri",
+                       extension, "uri",
                        context->url_entry, "text",
                        G_BINDING_BIDIRECTIONAL |
                        G_BINDING_SYNC_CREATE,
-                       book_config_carddav_uri_to_text,
-                       book_config_carddav_text_to_uri,
+                       e_binding_transform_uri_to_text,
+                       e_binding_transform_text_to_uri,
                        NULL, (GDestroyNotify) NULL);
        }
 }
@@ -330,7 +261,7 @@ static gboolean
 book_config_carddav_check_complete (ESourceConfigBackend *backend,
                                    ESource *scratch_source)
 {
-       SoupURI *soup_uri;
+       GUri *guri;
        GtkEntry *entry;
        Context *context;
        const gchar *uri_string;
@@ -347,11 +278,13 @@ book_config_carddav_check_complete (ESourceConfigBackend *backend,
        entry = GTK_ENTRY (context->url_entry);
        uri_string = gtk_entry_get_text (entry);
 
-       soup_uri = soup_uri_new (uri_string);
-       complete = SOUP_URI_VALID_FOR_HTTP (soup_uri);
+       guri = g_uri_parse (uri_string, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+       complete = guri && (g_strcmp0 (g_uri_get_scheme (guri), "http") == 0 ||
+                           g_strcmp0 (g_uri_get_scheme (guri), "https") == 0) &&
+                           g_uri_get_host (guri) && g_uri_get_path (guri);
 
-       if (soup_uri != NULL)
-               soup_uri_free (soup_uri);
+       if (guri)
+               g_uri_unref (guri);
 
        e_util_set_entry_issue_hint (context->url_entry, complete ? NULL : _("URL is not a valid http:// nor 
https:// URL"));
 
diff --git a/src/modules/book-config-google/e-google-book-chooser-button.c 
b/src/modules/book-config-google/e-google-book-chooser-button.c
index 796353a1b3..e3bb2f471c 100644
--- a/src/modules/book-config-google/e-google-book-chooser-button.c
+++ b/src/modules/book-config-google/e-google-book-chooser-button.c
@@ -167,7 +167,7 @@ google_book_chooser_button_clicked (GtkButton *btn)
        ECredentialsPrompter *prompter;
        ESourceWebdav *webdav_extension;
        ESourceAuthentication *authentication_extension;
-       SoupURI *uri;
+       GUri *guri;
        gchar *base_url;
        GtkDialog *dialog;
        gulong handler_id;
@@ -184,28 +184,28 @@ google_book_chooser_button_clicked (GtkButton *btn)
        authentication_extension = e_source_get_extension (button->priv->source, 
E_SOURCE_EXTENSION_AUTHENTICATION);
        webdav_extension = e_source_get_extension (button->priv->source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
 
-       uri = e_source_webdav_dup_soup_uri (webdav_extension);
+       guri = e_source_webdav_dup_uri (webdav_extension);
 
-       e_google_book_chooser_button_construct_default_uri (uri, e_source_authentication_get_user 
(authentication_extension));
+       e_google_book_chooser_button_construct_default_uri (&guri, e_source_authentication_get_user 
(authentication_extension));
 
        /* Prefer 'Google', aka internal OAuth2, authentication method, if available */
        e_source_authentication_set_method (authentication_extension, "Google");
 
        /* See https://developers.google.com/people/carddav */
-       soup_uri_set_host (uri, "www.googleapis.com");
-       soup_uri_set_path (uri, "/.well-known/carddav");
+       e_util_change_uri_component (&guri, SOUP_URI_HOST, "www.googleapis.com");
+       e_util_change_uri_component (&guri, SOUP_URI_PATH, "/.well-known/carddav");
 
        /* Google's CardDAV interface requires a secure connection. */
-       soup_uri_set_scheme (uri, SOUP_URI_SCHEME_HTTPS);
+       e_util_change_uri_component (&guri, SOUP_URI_SCHEME, "https");
 
-       e_source_webdav_set_soup_uri (webdav_extension, uri);
+       e_source_webdav_set_uri (webdav_extension, guri);
 
        prompter = e_credentials_prompter_new (registry);
        e_credentials_prompter_set_auto_prompt (prompter, FALSE);
 
        supports_filter = E_WEBDAV_DISCOVER_SUPPORTS_CONTACTS;
        title = _("Choose an Address Book");
-       base_url = soup_uri_to_string (uri, FALSE);
+       base_url = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
 
        dialog = e_webdav_discover_dialog_new (parent, title, prompter, button->priv->source, base_url, 
supports_filter);
 
@@ -228,10 +228,10 @@ google_book_chooser_button_clicked (GtkButton *btn)
                content = e_webdav_discover_dialog_get_content (dialog);
 
                if (e_webdav_discover_content_get_selected (content, 0, &href, &supports, &display_name, 
&color, &order)) {
-                       soup_uri_free (uri);
-                       uri = soup_uri_new (href);
+                       g_uri_unref (guri);
+                       guri = g_uri_parse (href, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
 
-                       if (uri) {
+                       if (guri) {
                                ESourceAddressBook *addressbook_extension;
 
                                addressbook_extension = e_source_get_extension (button->priv->source, 
E_SOURCE_EXTENSION_ADDRESS_BOOK);
@@ -239,7 +239,7 @@ google_book_chooser_button_clicked (GtkButton *btn)
                                e_source_set_display_name (button->priv->source, display_name);
 
                                e_source_webdav_set_display_name (webdav_extension, display_name);
-                               e_source_webdav_set_soup_uri (webdav_extension, uri);
+                               e_source_webdav_set_uri (webdav_extension, guri);
                                e_source_webdav_set_order (webdav_extension, order);
 
                                e_source_address_book_set_order (addressbook_extension, order);
@@ -261,8 +261,8 @@ google_book_chooser_button_clicked (GtkButton *btn)
        gtk_widget_destroy (GTK_WIDGET (dialog));
 
        g_object_unref (prompter);
-       if (uri)
-               soup_uri_free (uri);
+       if (guri)
+               g_uri_unref (guri);
        g_free (base_url);
 }
 
@@ -381,7 +381,7 @@ google_book_chooser_decode_user (const gchar *user)
 }
 
 void
-e_google_book_chooser_button_construct_default_uri (SoupURI *soup_uri,
+e_google_book_chooser_button_construct_default_uri (GUri **inout_uri,
                                                    const gchar *username)
 {
        gchar *decoded_user, *path;
@@ -392,10 +392,10 @@ e_google_book_chooser_button_construct_default_uri (SoupURI *soup_uri,
 
        path = g_strdup_printf ("/carddav/v1/principals/%s/lists/default/", decoded_user);
 
-       soup_uri_set_scheme (soup_uri, SOUP_URI_SCHEME_HTTPS);
-       soup_uri_set_user (soup_uri, decoded_user);
-       soup_uri_set_host (soup_uri, "www.googleapis.com");
-       soup_uri_set_path (soup_uri, path);
+       e_util_change_uri_component (inout_uri, SOUP_URI_SCHEME, "https");
+       e_util_change_uri_component (inout_uri, SOUP_URI_USER, decoded_user);
+       e_util_change_uri_component (inout_uri, SOUP_URI_HOST, "www.googleapis.com");
+       e_util_change_uri_component (inout_uri, SOUP_URI_PATH, path);
 
        g_free (decoded_user);
        g_free (path);
diff --git a/src/modules/book-config-google/e-google-book-chooser-button.h 
b/src/modules/book-config-google/e-google-book-chooser-button.h
index 2483d637b2..aecdea50e1 100644
--- a/src/modules/book-config-google/e-google-book-chooser-button.h
+++ b/src/modules/book-config-google/e-google-book-chooser-button.h
@@ -62,7 +62,7 @@ ESource *     e_google_book_chooser_button_get_source
 ESourceConfig *        e_google_book_chooser_button_get_config
                                                (EGoogleBookChooserButton *button);
 void           e_google_book_chooser_button_construct_default_uri
-                                               (SoupURI *soup_uri,
+                                               (GUri **inout_uri,
                                                 const gchar *username);
 
 G_END_DECLS
diff --git a/src/modules/book-config-google/evolution-book-config-google.c 
b/src/modules/book-config-google/evolution-book-config-google.c
index 850c502ab3..8f39f7fcaa 100644
--- a/src/modules/book-config-google/evolution-book-config-google.c
+++ b/src/modules/book-config-google/evolution-book-config-google.c
@@ -111,7 +111,7 @@ book_config_google_commit_changes (ESourceConfigBackend *backend,
        ESourceBackend *addressbook_extension;
        ESourceWebdav *webdav_extension;
        ESourceAuthentication *extension;
-       SoupURI *soup_uri;
+       GUri *guri;
        const gchar *extension_name;
        const gchar *user;
 
@@ -146,18 +146,18 @@ book_config_google_commit_changes (ESourceConfigBackend *backend,
                g_free (full_user);
        }
 
-       soup_uri = e_source_webdav_dup_soup_uri (webdav_extension);
+       guri = e_source_webdav_dup_uri (webdav_extension);
 
-       if (!soup_uri->path || !*soup_uri->path || g_strcmp0 (soup_uri->path, "/") == 0) {
-               e_google_book_chooser_button_construct_default_uri (soup_uri, 
e_source_authentication_get_user (extension));
+       if (!g_uri_get_path (guri) || !*g_uri_get_path (guri) || g_strcmp0 (g_uri_get_path (guri), "/") == 0) 
{
+               e_google_book_chooser_button_construct_default_uri (&guri, e_source_authentication_get_user 
(extension));
        }
 
        /* Google's CalDAV interface requires a secure connection. */
-       soup_uri_set_scheme (soup_uri, SOUP_URI_SCHEME_HTTPS);
+       e_util_change_uri_component (&guri, SOUP_URI_SCHEME, "https");
 
-       e_source_webdav_set_soup_uri (webdav_extension, soup_uri);
+       e_source_webdav_set_uri (webdav_extension, guri);
 
-       soup_uri_free (soup_uri);
+       g_uri_unref (guri);
 }
 
 static void
diff --git a/src/modules/cal-config-caldav/evolution-cal-config-caldav.c 
b/src/modules/cal-config-caldav/evolution-cal-config-caldav.c
index a6514bc8bc..1677956780 100644
--- a/src/modules/cal-config-caldav/evolution-cal-config-caldav.c
+++ b/src/modules/cal-config-caldav/evolution-cal-config-caldav.c
@@ -91,7 +91,7 @@ cal_config_caldav_run_dialog (GtkButton *button,
        ESourceWebdav *webdav_extension;
        ECalClientSourceType source_type;
        ECredentialsPrompter *prompter;
-       SoupURI *uri;
+       GUri *guri;
        gchar *base_url;
        GtkDialog *dialog;
        gpointer parent;
@@ -125,11 +125,11 @@ cal_config_caldav_run_dialog (GtkButton *button,
 
        webdav_extension = e_source_get_extension (context->scratch_source, 
E_SOURCE_EXTENSION_WEBDAV_BACKEND);
 
-       uri = e_source_webdav_dup_soup_uri (webdav_extension);
+       guri = e_source_webdav_dup_uri (webdav_extension);
 
        prompter = e_credentials_prompter_new (registry);
        e_credentials_prompter_set_auto_prompt (prompter, FALSE);
-       base_url = soup_uri_to_string (uri, FALSE);
+       base_url = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
 
        dialog = e_webdav_discover_dialog_new (parent, title, prompter, context->scratch_source, base_url, 
supports_filter);
 
@@ -152,10 +152,10 @@ cal_config_caldav_run_dialog (GtkButton *button,
                content = e_webdav_discover_dialog_get_content (dialog);
 
                if (e_webdav_discover_content_get_selected (content, 0, &href, &supports, &display_name, 
&color, &order)) {
-                       soup_uri_free (uri);
-                       uri = soup_uri_new (href);
+                       g_uri_unref (guri);
+                       guri = g_uri_parse (href, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
 
-                       if (uri) {
+                       if (guri) {
                                ESourceSelectable *selectable_extension;
                                const gchar *extension_name;
 
@@ -178,7 +178,7 @@ cal_config_caldav_run_dialog (GtkButton *button,
                                e_source_set_display_name (context->scratch_source, display_name);
 
                                e_source_webdav_set_display_name (webdav_extension, display_name);
-                               e_source_webdav_set_soup_uri (webdav_extension, uri);
+                               e_source_webdav_set_uri (webdav_extension, guri);
                                e_source_webdav_set_order (webdav_extension, order);
 
                                if (source_type != E_CAL_CLIENT_SOURCE_TYPE_MEMOS)
@@ -210,74 +210,11 @@ cal_config_caldav_run_dialog (GtkButton *button,
        gtk_widget_destroy (GTK_WIDGET (dialog));
 
        g_object_unref (prompter);
-       if (uri)
-               soup_uri_free (uri);
+       if (guri)
+               g_uri_unref (guri);
        g_free (base_url);
 }
 
-static gboolean
-cal_config_caldav_uri_to_text (GBinding *binding,
-                               const GValue *source_value,
-                               GValue *target_value,
-                               gpointer user_data)
-{
-       SoupURI *soup_uri;
-       gchar *text;
-
-       soup_uri = g_value_get_boxed (source_value);
-       soup_uri_set_user (soup_uri, NULL);
-
-       if (soup_uri_get_host (soup_uri)) {
-               text = soup_uri_to_string (soup_uri, FALSE);
-       } else {
-               GObject *target;
-
-               text = NULL;
-               target = g_binding_get_target (binding);
-               g_object_get (target, g_binding_get_target_property (binding), &text, NULL);
-
-               if (!text || !*text) {
-                       g_free (text);
-                       text = soup_uri_to_string (soup_uri, FALSE);
-               }
-       }
-
-       g_value_take_string (target_value, text);
-
-       return TRUE;
-}
-
-static gboolean
-cal_config_caldav_text_to_uri (GBinding *binding,
-                               const GValue *source_value,
-                               GValue *target_value,
-                               gpointer user_data)
-{
-       ESource *source;
-       SoupURI *soup_uri;
-       ESourceAuthentication *extension;
-       const gchar *extension_name;
-       const gchar *text;
-       const gchar *user;
-
-       text = g_value_get_string (source_value);
-       soup_uri = soup_uri_new (text);
-
-       if (!soup_uri)
-               soup_uri = soup_uri_new ("http://";);
-
-       source = E_SOURCE (user_data);
-       extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
-       extension = e_source_get_extension (source, extension_name);
-       user = e_source_authentication_get_user (extension);
-
-       soup_uri_set_user (soup_uri, user);
-
-       g_value_take_boxed (target_value, soup_uri);
-
-       return TRUE;
-}
-
 static void
 cal_config_caldav_insert_widgets (ESourceConfigBackend *backend,
                                   ESource *scratch_source)
@@ -315,10 +252,10 @@ cal_config_caldav_insert_widgets (ESourceConfigBackend *backend,
                extension = e_source_get_extension (scratch_source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
 
                e_binding_bind_property_full (
-                       extension, "soup-uri",
+                       extension, "uri",
                        widget, "label",
                        G_BINDING_SYNC_CREATE,
-                       cal_config_caldav_uri_to_text,
+                       e_binding_transform_uri_to_text,
                        NULL,
                        g_object_ref (scratch_source),
                        (GDestroyNotify) g_object_unref);
@@ -404,12 +341,12 @@ cal_config_caldav_insert_widgets (ESourceConfigBackend *backend,
 
        if (context->url_entry) {
                e_binding_bind_property_full (
-                       extension, "soup-uri",
+                       extension, "uri",
                        context->url_entry, "text",
                        G_BINDING_BIDIRECTIONAL |
                        G_BINDING_SYNC_CREATE,
-                       cal_config_caldav_uri_to_text,
-                       cal_config_caldav_text_to_uri,
+                       e_binding_transform_uri_to_text,
+                       e_binding_transform_text_to_uri,
                        g_object_ref (scratch_source),
                        (GDestroyNotify) g_object_unref);
        }
@@ -422,7 +359,7 @@ cal_config_caldav_check_complete (ESourceConfigBackend *backend,
        Context *context;
        const gchar *uid;
        const gchar *uri_string;
-       SoupURI *soup_uri;
+       GUri *guri;
        gboolean complete;
 
        uid = e_source_get_uid (scratch_source);
@@ -433,19 +370,21 @@ cal_config_caldav_check_complete (ESourceConfigBackend *backend,
                return TRUE;
 
        uri_string = gtk_entry_get_text (GTK_ENTRY (context->url_entry));
-       soup_uri = soup_uri_new (uri_string);
+       guri = g_uri_parse (uri_string, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
 
-       if (soup_uri) {
-               if (g_strcmp0 (soup_uri_get_scheme (soup_uri), "caldav") == 0)
-                       soup_uri_set_scheme (soup_uri, SOUP_URI_SCHEME_HTTP);
+       if (guri) {
+               if (g_strcmp0 (g_uri_get_scheme (guri), "caldav") == 0)
+                       e_util_change_uri_component (&guri, SOUP_URI_SCHEME, "https");
 
-               complete = soup_uri_get_host (soup_uri) && SOUP_URI_VALID_FOR_HTTP (soup_uri);
+               complete = (g_strcmp0 (g_uri_get_scheme (guri), "http") == 0 ||
+                           g_strcmp0 (g_uri_get_scheme (guri), "https") == 0) &&
+                           g_uri_get_host (guri) && g_uri_get_path (guri);
        } else {
                complete = FALSE;
        }
 
-       if (soup_uri != NULL)
-               soup_uri_free (soup_uri);
+       if (guri)
+               g_uri_unref (guri);
 
        gtk_widget_set_sensitive (context->find_button, complete);
 
diff --git a/src/modules/cal-config-google/e-cal-config-google.c 
b/src/modules/cal-config-google/e-cal-config-google.c
index ede4d8a495..ace4b2294d 100644
--- a/src/modules/cal-config-google/e-cal-config-google.c
+++ b/src/modules/cal-config-google/e-cal-config-google.c
@@ -116,7 +116,7 @@ cal_config_google_commit_changes (ESourceConfigBackend *backend,
        ESourceWebdav *webdav_extension;
        ESourceAuthentication *authentication_extension;
        gboolean can_google_auth;
-       SoupURI *soup_uri;
+       GUri *guri;
 
        /* We need to hard-code a few settings. */
 
@@ -136,33 +136,32 @@ cal_config_google_commit_changes (ESourceConfigBackend *backend,
         * ESource is a child of the built-in "Google" source. */
        e_source_backend_set_backend_name (calendar_extension, "caldav");
 
-       soup_uri = e_source_webdav_dup_soup_uri (webdav_extension);
+       guri = e_source_webdav_dup_uri (webdav_extension);
 
        if (can_google_auth || g_strcmp0 (e_source_authentication_get_method (authentication_extension), 
"Google") == 0) {
                /* Prefer 'Google', aka internal OAuth2, authentication method, if available */
                e_source_authentication_set_method (authentication_extension, "Google");
 
                /* See https://developers.google.com/google-apps/calendar/caldav/v2/guide */
-               soup_uri_set_host (soup_uri, "apidata.googleusercontent.com");
+               e_util_change_uri_component (&guri, SOUP_URI_HOST, "apidata.googleusercontent.com");
        } else {
-               soup_uri_set_host (soup_uri, "www.google.com");
+               e_util_change_uri_component (&guri, SOUP_URI_HOST, "www.google.com");
        }
 
-       if (!soup_uri->path || !*soup_uri->path || g_strcmp0 (soup_uri->path, "/") == 0) {
+       if (!g_uri_get_path (guri) || !*g_uri_get_path (guri) || g_strcmp0 (g_uri_get_path (guri), "/") == 0) 
{
                ESourceAuthentication *authentication_extension
                        = e_source_get_extension (scratch_source, E_SOURCE_EXTENSION_AUTHENTICATION);
 
-               e_google_chooser_button_construct_default_uri (
-                       soup_uri,
+               e_google_chooser_button_construct_default_uri (&guri,
                        e_source_authentication_get_user (authentication_extension));
        }
 
        /* Google's CalDAV interface requires a secure connection. */
-       soup_uri_set_scheme (soup_uri, SOUP_URI_SCHEME_HTTPS);
+       e_util_change_uri_component (&guri, SOUP_URI_SCHEME, "https");
 
-       e_source_webdav_set_soup_uri (webdav_extension, soup_uri);
+       e_source_webdav_set_uri (webdav_extension, guri);
 
-       soup_uri_free (soup_uri);
+       g_uri_unref (guri);
 }
 
 static gboolean
diff --git a/src/modules/cal-config-google/e-google-chooser-button.c 
b/src/modules/cal-config-google/e-google-chooser-button.c
index 80978d572c..0a0c408609 100644
--- a/src/modules/cal-config-google/e-google-chooser-button.c
+++ b/src/modules/cal-config-google/e-google-chooser-button.c
@@ -178,7 +178,7 @@ google_chooser_button_clicked (GtkButton *button)
        ECredentialsPrompter *prompter;
        ESourceWebdav *webdav_extension;
        ESourceAuthentication *authentication_extension;
-       SoupURI *uri;
+       GUri *guri;
        gchar *base_url;
        GtkDialog *dialog;
        gulong handler_id;
@@ -196,29 +196,29 @@ google_chooser_button_clicked (GtkButton *button)
        authentication_extension = e_source_get_extension (priv->source, E_SOURCE_EXTENSION_AUTHENTICATION);
        webdav_extension = e_source_get_extension (priv->source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
 
-       uri = e_source_webdav_dup_soup_uri (webdav_extension);
+       guri = e_source_webdav_dup_uri (webdav_extension);
        can_google_auth = e_module_cal_config_google_is_supported (NULL, registry) &&
                          g_strcmp0 (e_source_authentication_get_method (authentication_extension), "OAuth2") 
!= 0;
 
-       e_google_chooser_button_construct_default_uri (uri, e_source_authentication_get_user 
(authentication_extension));
+       e_google_chooser_button_construct_default_uri (&guri, e_source_authentication_get_user 
(authentication_extension));
 
        if (can_google_auth) {
                /* Prefer 'Google', aka internal OAuth2, authentication method, if available */
                e_source_authentication_set_method (authentication_extension, "Google");
 
                /* See https://developers.google.com/google-apps/calendar/caldav/v2/guide */
-               soup_uri_set_host (uri, "apidata.googleusercontent.com");
-               soup_uri_set_path (uri, "/caldav/v2/");
+               e_util_change_uri_component (&guri, SOUP_URI_HOST, "apidata.googleusercontent.com");
+               e_util_change_uri_component (&guri, SOUP_URI_PATH, "/caldav/v2/");
        } else {
-               soup_uri_set_host (uri, "www.google.com");
+               e_util_change_uri_component (&guri, SOUP_URI_HOST, "www.google.com");
                /* To find also calendar email, not only calendars */
-               soup_uri_set_path (uri, "/calendar/dav/");
+               e_util_change_uri_component (&guri, SOUP_URI_PATH, "/calendar/dav/");
        }
 
        /* Google's CalDAV interface requires a secure connection. */
-       soup_uri_set_scheme (uri, SOUP_URI_SCHEME_HTTPS);
+       e_util_change_uri_component (&guri, SOUP_URI_SCHEME, "https");
 
-       e_source_webdav_set_soup_uri (webdav_extension, uri);
+       e_source_webdav_set_uri (webdav_extension, guri);
 
        switch (e_cal_source_config_get_source_type (E_CAL_SOURCE_CONFIG (priv->config))) {
        case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
@@ -240,7 +240,7 @@ google_chooser_button_clicked (GtkButton *button)
        prompter = e_credentials_prompter_new (registry);
        e_credentials_prompter_set_auto_prompt (prompter, FALSE);
 
-       base_url = soup_uri_to_string (uri, FALSE);
+       base_url = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
 
        dialog = e_webdav_discover_dialog_new (parent, title, prompter, priv->source, base_url, 
supports_filter);
 
@@ -263,10 +263,10 @@ google_chooser_button_clicked (GtkButton *button)
                content = e_webdav_discover_dialog_get_content (dialog);
 
                if (e_webdav_discover_content_get_selected (content, 0, &href, &supports, &display_name, 
&color, &order)) {
-                       soup_uri_free (uri);
-                       uri = soup_uri_new (href);
+                       g_uri_unref (guri);
+                       guri = g_uri_parse (href, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
 
-                       if (uri) {
+                       if (guri) {
                                ESourceSelectable *selectable_extension;
                                const gchar *extension_name;
 
@@ -289,7 +289,7 @@ google_chooser_button_clicked (GtkButton *button)
                                e_source_set_display_name (priv->source, display_name);
 
                                e_source_webdav_set_display_name (webdav_extension, display_name);
-                               e_source_webdav_set_soup_uri (webdav_extension, uri);
+                               e_source_webdav_set_uri (webdav_extension, guri);
                                e_source_webdav_set_order (webdav_extension, order);
 
                                if (color && *color)
@@ -318,8 +318,8 @@ google_chooser_button_clicked (GtkButton *button)
        gtk_widget_destroy (GTK_WIDGET (dialog));
 
        g_object_unref (prompter);
-       if (uri)
-               soup_uri_free (uri);
+       if (guri)
+               g_uri_unref (guri);
        g_free (base_url);
 }
 
@@ -440,7 +440,7 @@ google_chooser_decode_user (const gchar *user)
 }
 
 void
-e_google_chooser_button_construct_default_uri (SoupURI *soup_uri,
+e_google_chooser_button_construct_default_uri (GUri **inout_uri,
                                               const gchar *username)
 {
        gchar *decoded_user, *path;
@@ -449,13 +449,13 @@ e_google_chooser_button_construct_default_uri (SoupURI *soup_uri,
        if (!decoded_user)
                return;
 
-       if (g_strcmp0 (soup_uri_get_host (soup_uri), "apidata.googleusercontent.com") == 0)
+       if (g_strcmp0 (g_uri_get_host (*inout_uri), "apidata.googleusercontent.com") == 0)
                path = g_strdup_printf ("/caldav/v2/%s/events", decoded_user);
        else
                path = g_strdup_printf ("/calendar/dav/%s/events", decoded_user);
 
-       soup_uri_set_user (soup_uri, decoded_user);
-       soup_uri_set_path (soup_uri, path);
+       e_util_change_uri_component (inout_uri, SOUP_URI_USER, decoded_user);
+       e_util_change_uri_component (inout_uri, SOUP_URI_PATH, path);
 
        g_free (decoded_user);
        g_free (path);
diff --git a/src/modules/cal-config-google/e-google-chooser-button.h 
b/src/modules/cal-config-google/e-google-chooser-button.h
index eccdf6d8ba..5eda8fcfe2 100644
--- a/src/modules/cal-config-google/e-google-chooser-button.h
+++ b/src/modules/cal-config-google/e-google-chooser-button.h
@@ -64,7 +64,7 @@ ESource *     e_google_chooser_button_get_source
 ESourceConfig *        e_google_chooser_button_get_config
                                                (EGoogleChooserButton *button);
 void           e_google_chooser_button_construct_default_uri
-                                               (SoupURI *soup_uri,
+                                               (GUri **inout_uri,
                                                 const gchar *username);
 
 G_END_DECLS
diff --git a/src/modules/cal-config-weather/evolution-cal-config-weather.c 
b/src/modules/cal-config-weather/evolution-cal-config-weather.c
index 423d6e2357..36d360e3de 100644
--- a/src/modules/cal-config-weather/evolution-cal-config-weather.c
+++ b/src/modules/cal-config-weather/evolution-cal-config-weather.c
@@ -73,20 +73,14 @@ cal_config_weather_location_to_string (GBinding *binding,
        gchar *string = NULL;
 
        location = g_value_get_boxed (source_value);
-       #if GWEATHER_CHECK_VERSION(3, 39, 0)
        if (location)
                gweather_location_ref (location);
-       #endif
 
        while (location && !gweather_location_has_coords (location)) {
-               #if GWEATHER_CHECK_VERSION(3, 39, 0)
                GWeatherLocation *child = location;
 
                location = gweather_location_get_parent (child);
                gweather_location_unref (child);
-               #else
-               location = gweather_location_get_parent (location);
-               #endif
        }
 
        if (location) {
@@ -101,9 +95,7 @@ cal_config_weather_location_to_string (GBinding *binding,
 
                string = g_strdup_printf ("%s/%s", lat_str, lon_str);
 
-               #if GWEATHER_CHECK_VERSION(3, 39, 0)
                gweather_location_unref (location);
-               #endif
        }
 
        g_value_take_string (target_value, string);
@@ -117,12 +109,7 @@ cal_config_weather_find_location_by_coords (GWeatherLocation *start,
                                            gdouble longitude)
 {
        GWeatherLocation *location;
-       #if GWEATHER_CHECK_VERSION(3, 39, 0)
        GWeatherLocation *child = NULL;
-       #else
-       GWeatherLocation **children;
-       gint ii;
-       #endif
 
        if (!start)
                return NULL;
@@ -139,7 +126,6 @@ cal_config_weather_find_location_by_coords (GWeatherLocation *start,
                }
        }
 
-       #if GWEATHER_CHECK_VERSION(3, 39, 0)
        while (child = gweather_location_next_child (location, child), child) {
                GWeatherLocation *result;
 
@@ -149,16 +135,6 @@ cal_config_weather_find_location_by_coords (GWeatherLocation *start,
                        return result;
                }
        }
-       #else
-       children = gweather_location_get_children (location);
-       for (ii = 0; children[ii]; ii++) {
-               location = cal_config_weather_find_location_by_coords (children[ii], latitude, longitude);
-               if (location) {
-                       gweather_location_ref (location);
-                       return location;
-               }
-       }
-       #endif
 
        return NULL;
 }
@@ -329,9 +305,7 @@ cal_config_weather_insert_widgets (ESourceConfigBackend *backend,
                G_BINDING_BIDIRECTIONAL |
                G_BINDING_SYNC_CREATE);
 
-#if GWEATHER_CHECK_VERSION(3, 39, 0)
        gweather_location_unref (world);
-#endif
 }
 
 static gboolean
diff --git a/src/modules/cal-config-webcal/evolution-cal-config-webcal.c 
b/src/modules/cal-config-webcal/evolution-cal-config-webcal.c
index 8a9f39d41b..ce189aa042 100644
--- a/src/modules/cal-config-webcal/evolution-cal-config-webcal.c
+++ b/src/modules/cal-config-webcal/evolution-cal-config-webcal.c
@@ -52,69 +52,6 @@ cal_config_webcal_context_free (Context *context)
        g_slice_free (Context, context);
 }
 
-static gboolean
-cal_config_webcal_uri_to_text (GBinding *binding,
-                               const GValue *source_value,
-                               GValue *target_value,
-                               gpointer user_data)
-{
-       SoupURI *soup_uri;
-       gchar *text;
-
-       soup_uri = g_value_get_boxed (source_value);
-       soup_uri_set_user (soup_uri, NULL);
-
-       if (soup_uri_get_host (soup_uri)) {
-               text = soup_uri_to_string (soup_uri, FALSE);
-       } else {
-               GObject *target;
-
-               text = NULL;
-               target = g_binding_get_target (binding);
-               g_object_get (target, g_binding_get_target_property (binding), &text, NULL);
-
-               if (!text || !*text) {
-                       g_free (text);
-                       text = soup_uri_to_string (soup_uri, FALSE);
-               }
-       }
-
-       g_value_take_string (target_value, text);
-
-       return TRUE;
-}
-
-static gboolean
-cal_config_webcal_text_to_uri (GBinding *binding,
-                               const GValue *source_value,
-                               GValue *target_value,
-                               gpointer user_data)
-{
-       ESource *source;
-       SoupURI *soup_uri;
-       ESourceAuthentication *extension;
-       const gchar *extension_name;
-       const gchar *text;
-       const gchar *user;
-
-       text = g_value_get_string (source_value);
-       soup_uri = soup_uri_new (text);
-
-       if (!soup_uri)
-               soup_uri = soup_uri_new ("http://";);
-
-       source = E_SOURCE (user_data);
-       extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
-       extension = e_source_get_extension (source, extension_name);
-       user = e_source_authentication_get_user (extension);
-
-       soup_uri_set_user (soup_uri, user);
-
-       g_value_take_boxed (target_value, soup_uri);
-
-       return TRUE;
-}
-
 static void
 cal_config_webcal_insert_widgets (ESourceConfigBackend *backend,
                                   ESource *scratch_source)
@@ -147,10 +84,10 @@ cal_config_webcal_insert_widgets (ESourceConfigBackend *backend,
                extension = e_source_get_extension (scratch_source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
 
                e_binding_bind_property_full (
-                       extension, "soup-uri",
+                       extension, "uri",
                        widget, "label",
                        G_BINDING_SYNC_CREATE,
-                       cal_config_webcal_uri_to_text,
+                       e_binding_transform_uri_to_text,
                        NULL,
                        g_object_ref (scratch_source),
                        (GDestroyNotify) g_object_unref);
@@ -179,12 +116,12 @@ cal_config_webcal_insert_widgets (ESourceConfigBackend *backend,
 
        if (context->url_entry) {
                e_binding_bind_property_full (
-                       extension, "soup-uri",
+                       extension, "uri",
                        context->url_entry, "text",
                        G_BINDING_BIDIRECTIONAL |
                        G_BINDING_SYNC_CREATE,
-                       cal_config_webcal_uri_to_text,
-                       cal_config_webcal_text_to_uri,
+                       e_binding_transform_uri_to_text,
+                       e_binding_transform_text_to_uri,
                        g_object_ref (scratch_source),
                        (GDestroyNotify) g_object_unref);
        }
@@ -194,7 +131,7 @@ static gboolean
 cal_config_webcal_check_complete (ESourceConfigBackend *backend,
                                   ESource *scratch_source)
 {
-       SoupURI *soup_uri;
+       GUri *guri;
        GtkEntry *entry;
        Context *context;
        const gchar *uri_string;
@@ -211,21 +148,23 @@ cal_config_webcal_check_complete (ESourceConfigBackend *backend,
        entry = GTK_ENTRY (context->url_entry);
        uri_string = gtk_entry_get_text (entry);
 
-       soup_uri = soup_uri_new (uri_string);
+       guri = g_uri_parse (uri_string, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
 
-       if (soup_uri) {
+       if (guri) {
                /* XXX webcal:// is a non-standard scheme, but we accept it.
                 *     Just convert it to http:// for the URI validity test. */
-               if (g_strcmp0 (soup_uri_get_scheme (soup_uri), "webcal") == 0)
-                       soup_uri_set_scheme (soup_uri, SOUP_URI_SCHEME_HTTP);
+               if (g_strcmp0 (g_uri_get_scheme (guri), "webcal") == 0)
+                       e_util_change_uri_component (&guri, SOUP_URI_SCHEME, "https");
 
-               complete = soup_uri_get_host (soup_uri) && SOUP_URI_VALID_FOR_HTTP (soup_uri);
+               complete = (g_strcmp0 (g_uri_get_scheme (guri), "http") == 0 ||
+                           g_strcmp0 (g_uri_get_scheme (guri), "https") == 0) &&
+                           g_uri_get_host (guri) && g_uri_get_path (guri);
        } else {
                complete = FALSE;
        }
 
-       if (soup_uri != NULL)
-               soup_uri_free (soup_uri);
+       if (guri)
+               g_uri_unref (guri);
 
        e_util_set_entry_issue_hint (context->url_entry, complete ? NULL : _("URL is not a valid http:// nor 
https:// URL"));
 
diff --git a/src/modules/cal-config-webdav-notes/evolution-cal-config-webdav-notes.c 
b/src/modules/cal-config-webdav-notes/evolution-cal-config-webdav-notes.c
index f4e6460999..149fdfa119 100644
--- a/src/modules/cal-config-webdav-notes/evolution-cal-config-webdav-notes.c
+++ b/src/modules/cal-config-webdav-notes/evolution-cal-config-webdav-notes.c
@@ -85,7 +85,7 @@ cal_config_webdav_notes_run_dialog (GtkButton *button,
        ESourceWebdav *webdav_extension;
        ECalClientSourceType source_type;
        ECredentialsPrompter *prompter;
-       SoupURI *uri;
+       GUri *guri;
        gchar *base_url;
        GtkDialog *dialog;
        gpointer parent;
@@ -111,11 +111,11 @@ cal_config_webdav_notes_run_dialog (GtkButton *button,
 
        webdav_extension = e_source_get_extension (context->scratch_source, 
E_SOURCE_EXTENSION_WEBDAV_BACKEND);
 
-       uri = e_source_webdav_dup_soup_uri (webdav_extension);
+       guri = e_source_webdav_dup_uri (webdav_extension);
 
        prompter = e_credentials_prompter_new (registry);
        e_credentials_prompter_set_auto_prompt (prompter, FALSE);
-       base_url = soup_uri_to_string (uri, FALSE);
+       base_url = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
 
        dialog = e_webdav_discover_dialog_new (parent, title, prompter, context->scratch_source, base_url, 
supports_filter);
 
@@ -138,10 +138,10 @@ cal_config_webdav_notes_run_dialog (GtkButton *button,
                content = e_webdav_discover_dialog_get_content (dialog);
 
                if (e_webdav_discover_content_get_selected (content, 0, &href, &supports, &display_name, 
&color, &order)) {
-                       soup_uri_free (uri);
-                       uri = soup_uri_new (href);
+                       g_uri_unref (guri);
+                       guri = g_uri_parse (href, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
 
-                       if (uri) {
+                       if (guri) {
                                ESourceSelectable *selectable_extension;
                                const gchar *extension_name;
 
@@ -158,7 +158,7 @@ cal_config_webdav_notes_run_dialog (GtkButton *button,
                                e_source_set_display_name (context->scratch_source, display_name);
 
                                e_source_webdav_set_display_name (webdav_extension, display_name);
-                               e_source_webdav_set_soup_uri (webdav_extension, uri);
+                               e_source_webdav_set_uri (webdav_extension, guri);
                                e_source_webdav_set_order (webdav_extension, order);
 
                                if (color && *color)
@@ -187,74 +187,11 @@ cal_config_webdav_notes_run_dialog (GtkButton *button,
        gtk_widget_destroy (GTK_WIDGET (dialog));
 
        g_object_unref (prompter);
-       if (uri)
-               soup_uri_free (uri);
+       if (guri)
+               g_uri_unref (guri);
        g_free (base_url);
 }
 
-static gboolean
-cal_config_webdav_notes_uri_to_text (GBinding *binding,
-                                    const GValue *source_value,
-                                    GValue *target_value,
-                                    gpointer user_data)
-{
-       SoupURI *soup_uri;
-       gchar *text;
-
-       soup_uri = g_value_get_boxed (source_value);
-       soup_uri_set_user (soup_uri, NULL);
-
-       if (soup_uri_get_host (soup_uri)) {
-               text = soup_uri_to_string (soup_uri, FALSE);
-       } else {
-               GObject *target;
-
-               text = NULL;
-               target = g_binding_get_target (binding);
-               g_object_get (target, g_binding_get_target_property (binding), &text, NULL);
-
-               if (!text || !*text) {
-                       g_free (text);
-                       text = soup_uri_to_string (soup_uri, FALSE);
-               }
-       }
-
-       g_value_take_string (target_value, text);
-
-       return TRUE;
-}
-
-static gboolean
-cal_config_webdav_notes_text_to_uri (GBinding *binding,
-                                    const GValue *source_value,
-                                    GValue *target_value,
-                                    gpointer user_data)
-{
-       ESource *source;
-       SoupURI *soup_uri;
-       ESourceAuthentication *extension;
-       const gchar *extension_name;
-       const gchar *text;
-       const gchar *user;
-
-       text = g_value_get_string (source_value);
-       soup_uri = soup_uri_new (text);
-
-       if (!soup_uri)
-               soup_uri = soup_uri_new ("http://";);
-
-       source = E_SOURCE (user_data);
-       extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
-       extension = e_source_get_extension (source, extension_name);
-       user = e_source_authentication_get_user (extension);
-
-       soup_uri_set_user (soup_uri, user);
-
-       g_value_take_boxed (target_value, soup_uri);
-
-       return TRUE;
-}
-
 static gboolean
 cal_config_webdav_notes_allow_creation (ESourceConfigBackend *backend)
 {
@@ -305,10 +242,10 @@ cal_config_webdav_notes_insert_widgets (ESourceConfigBackend *backend,
                extension = e_source_get_extension (scratch_source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
 
                e_binding_bind_property_full (
-                       extension, "soup-uri",
+                       extension, "uri",
                        widget, "label",
                        G_BINDING_SYNC_CREATE,
-                       cal_config_webdav_notes_uri_to_text,
+                       e_binding_transform_uri_to_text,
                        NULL,
                        g_object_ref (scratch_source),
                        (GDestroyNotify) g_object_unref);
@@ -386,12 +323,12 @@ cal_config_webdav_notes_insert_widgets (ESourceConfigBackend *backend,
 
        if (context->url_entry) {
                e_binding_bind_property_full (
-                       extension, "soup-uri",
+                       extension, "uri",
                        context->url_entry, "text",
                        G_BINDING_BIDIRECTIONAL |
                        G_BINDING_SYNC_CREATE,
-                       cal_config_webdav_notes_uri_to_text,
-                       cal_config_webdav_notes_text_to_uri,
+                       e_binding_transform_uri_to_text,
+                       e_binding_transform_text_to_uri,
                        g_object_ref (scratch_source),
                        (GDestroyNotify) g_object_unref);
        }
@@ -404,7 +341,7 @@ cal_config_webdav_notes_check_complete (ESourceConfigBackend *backend,
        Context *context;
        const gchar *uid;
        const gchar *uri_string;
-       SoupURI *soup_uri;
+       GUri *guri;
        gboolean complete;
 
        uid = e_source_get_uid (scratch_source);
@@ -415,19 +352,21 @@ cal_config_webdav_notes_check_complete (ESourceConfigBackend *backend,
                return TRUE;
 
        uri_string = gtk_entry_get_text (GTK_ENTRY (context->url_entry));
-       soup_uri = soup_uri_new (uri_string);
+       guri = g_uri_parse (uri_string, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
 
-       if (soup_uri) {
-               if (g_strcmp0 (soup_uri_get_scheme (soup_uri), "caldav") == 0)
-                       soup_uri_set_scheme (soup_uri, SOUP_URI_SCHEME_HTTP);
+       if (guri) {
+               if (g_strcmp0 (g_uri_get_scheme (guri), "caldav") == 0)
+                       e_util_change_uri_component (&guri, SOUP_URI_SCHEME, "https");
 
-               complete = soup_uri_get_host (soup_uri) && SOUP_URI_VALID_FOR_HTTP (soup_uri);
+               complete = (g_strcmp0 (g_uri_get_scheme (guri), "http") == 0 ||
+                           g_strcmp0 (g_uri_get_scheme (guri), "https") == 0) &&
+                           g_uri_get_host (guri) && g_uri_get_path (guri);
        } else {
                complete = FALSE;
        }
 
-       if (soup_uri != NULL)
-               soup_uri_free (soup_uri);
+       if (guri)
+               g_uri_unref (guri);
 
        gtk_widget_set_sensitive (context->find_button, complete);
 
diff --git a/src/modules/calendar/e-cal-base-shell-backend.c b/src/modules/calendar/e-cal-base-shell-backend.c
index 6c41dfcfa1..43395fc9a2 100644
--- a/src/modules/calendar/e-cal-base-shell-backend.c
+++ b/src/modules/calendar/e-cal-base-shell-backend.c
@@ -104,23 +104,22 @@ cal_base_shell_backend_handle_webcal_uri (EShellBackend *shell_backend,
                                e_source_get_extension (candidate, extension_name));
                        if (g_strcmp0 (backend_name, "webcal") == 0) {
                                ESourceWebdav *webdav_extension;
-                               SoupURI *soup_uri;
+                               GUri *guri;
 
-                               soup_uri = soup_uri_new (uri);
-                               if (!soup_uri) {
+                               guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, 
NULL);
+                               if (!guri) {
                                        /* Just a fallback when the passed-in URI is invalid,
                                           to have set something in the UI. */
-                                       soup_uri = soup_uri_new (NULL);
-                                       soup_uri_set_path (soup_uri, uri);
+                                       guri = g_uri_build (G_URI_FLAGS_NONE, "https", NULL, NULL, -1, uri, 
NULL, NULL);
+                               } else if (g_strcmp0 (g_uri_get_scheme (guri), "https") != 0) {
+                                       /* https everywhere */
+                                       e_util_change_uri_component (&guri, SOUP_URI_SCHEME, "https");
                                }
 
-                               /* https everywhere */
-                               soup_uri_set_scheme (soup_uri, "https");
-
-                               if (soup_uri_get_path (soup_uri)) {
+                               if (g_uri_get_path (guri)) {
                                        gchar *basename;
 
-                                       basename = g_path_get_basename (soup_uri_get_path (soup_uri));
+                                       basename = g_path_get_basename (g_uri_get_path (guri));
                                        if (basename && g_utf8_strlen (basename, -1) > 3) {
                                                gchar *dot;
 
@@ -136,11 +135,11 @@ cal_base_shell_backend_handle_webcal_uri (EShellBackend *shell_backend,
                                }
 
                                webdav_extension = e_source_get_extension (candidate, 
E_SOURCE_EXTENSION_WEBDAV_BACKEND);
-                               e_source_webdav_set_soup_uri (webdav_extension, soup_uri);
+                               e_source_webdav_set_uri (webdav_extension, guri);
 
                                e_source_config_select_page (source_config, candidate);
 
-                               soup_uri_free (soup_uri);
+                               g_uri_unref (guri);
                                break;
                        }
                }
@@ -462,7 +461,7 @@ e_cal_base_shell_backend_util_handle_uri (EShellBackend *shell_backend,
 {
        EShell *shell;
        EShellWindow *shell_window;
-       SoupURI *soup_uri;
+       GUri *guri;
        const gchar *cp;
        gchar *source_uid = NULL;
        gchar *comp_uid = NULL;
@@ -497,9 +496,9 @@ e_cal_base_shell_backend_util_handle_uri (EShellBackend *shell_backend,
 
        shell = e_shell_backend_get_shell (shell_backend);
 
-       soup_uri = soup_uri_new (uri);
+       guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
 
-       if (soup_uri == NULL)
+       if (!guri)
                return FALSE;
 
        g_date_clear (&start_date, 1);
@@ -525,7 +524,7 @@ e_cal_base_shell_backend_util_handle_uri (EShellBackend *shell_backend,
 
        g_object_unref (settings);
 
-       cp = soup_uri_get_query (soup_uri);
+       cp = g_uri_get_query (guri);
        if (cp == NULL)
                goto exit;
 
@@ -709,7 +708,7 @@ e_cal_base_shell_backend_util_handle_uri (EShellBackend *shell_backend,
        g_free (comp_rid);
        g_free (new_ics);
 
-       soup_uri_free (soup_uri);
+       g_uri_unref (guri);
 
        return handled;
 }
diff --git a/src/modules/config-lookup/e-webdav-config-lookup.c 
b/src/modules/config-lookup/e-webdav-config-lookup.c
index a4646138c6..28d588c2cd 100644
--- a/src/modules/config-lookup/e-webdav-config-lookup.c
+++ b/src/modules/config-lookup/e-webdav-config-lookup.c
@@ -157,7 +157,7 @@ webdav_config_lookup_propagate_error (GError **error,
                                      GTlsCertificateFlags certificate_errors,
                                      gboolean *out_authentication_failed)
 {
-       if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED)) {
+       if (g_error_matches (local_error, E_SOUP_SESSION_ERROR, SOUP_STATUS_UNAUTHORIZED)) {
                g_set_error_literal (error, E_CONFIG_LOOKUP_WORKER_ERROR, 
E_CONFIG_LOOKUP_WORKER_ERROR_REQUIRES_PASSWORD,
                        _("Requires password to continue."));
 
@@ -169,7 +169,7 @@ webdav_config_lookup_propagate_error (GError **error,
                return TRUE;
        }
 
-       if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_SSL_FAILED) &&
+       if (g_error_matches (local_error, G_TLS_ERROR, G_TLS_ERROR_BAD_CERTIFICATE) &&
            certificate_pem && *certificate_pem && certificate_errors) {
                gchar *description = e_trust_prompt_describe_certificate_errors (certificate_errors);
 
@@ -190,21 +190,21 @@ static void
 webdav_config_lookup_set_host_from_url (ESourceAuthentication *authentication_extension,
                                        const gchar *url)
 {
-       SoupURI *suri = NULL;
+       GUri *guri = NULL;
        const gchar *host = NULL;
 
        g_return_if_fail (E_IS_SOURCE_AUTHENTICATION (authentication_extension));
 
        if (url) {
-               suri = soup_uri_new (url);
-               if (suri)
-                       host = soup_uri_get_host (suri);
+               guri = g_uri_parse (url, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+               if (guri)
+                       host = g_uri_get_host (guri);
        }
 
        e_source_authentication_set_host (authentication_extension, host);
 
-       if (suri)
-               soup_uri_free (suri);
+       if (guri)
+               g_uri_unref (guri);
 }
 
 static const gchar *
diff --git a/src/modules/gravatar/e-gravatar-photo-source.c b/src/modules/gravatar/e-gravatar-photo-source.c
index 1eba1c3660..6f5d09bfd8 100644
--- a/src/modules/gravatar/e-gravatar-photo-source.c
+++ b/src/modules/gravatar/e-gravatar-photo-source.c
@@ -71,7 +71,7 @@ gravatar_photo_source_get_photo_thread (GSimpleAsyncResult *simple,
                                         GCancellable *cancellable)
 {
        AsyncContext *async_context;
-       SoupRequest *request;
+       SoupMessage *message;
        SoupSession *session;
        GInputStream *stream = NULL;
        gchar *hash;
@@ -94,10 +94,10 @@ gravatar_photo_source_get_photo_thread (GSimpleAsyncResult *simple,
        session = soup_session_new ();
 
        /* We control the URI so there should be no error. */
-       request = soup_session_request (session, uri, NULL);
-       g_return_if_fail (request != NULL);
+       message = soup_message_new (SOUP_METHOD_GET, uri);
+       g_return_if_fail (message != NULL);
 
-       stream = soup_request_send (request, cancellable, &local_error);
+       stream = soup_session_send (session, message, cancellable, &local_error);
 
        /* Sanity check. */
        g_return_if_fail (
@@ -108,22 +108,16 @@ gravatar_photo_source_get_photo_thread (GSimpleAsyncResult *simple,
         *     We need to check the status code on the SoupMessage
         *     to make sure the we're not getting an error message. */
        if (stream != NULL) {
-               SoupMessage *message;
-
-               message = soup_request_http_get_message (
-                       SOUP_REQUEST_HTTP (request));
-
-               if (SOUP_STATUS_IS_SUCCESSFUL (message->status_code)) {
+               if (SOUP_STATUS_IS_SUCCESSFUL (soup_message_get_status (message))) {
                        async_context->stream = g_object_ref (stream);
 
-               } else if (message->status_code != SOUP_STATUS_NOT_FOUND) {
+               } else if (soup_message_get_status (message) != SOUP_STATUS_NOT_FOUND) {
                        local_error = g_error_new_literal (
-                               SOUP_HTTP_ERROR,
-                               message->status_code,
-                               message->reason_phrase);
+                               E_SOUP_SESSION_ERROR,
+                               soup_message_get_status (message),
+                               soup_message_get_reason_phrase (message));
                }
 
-               g_object_unref (message);
                g_object_unref (stream);
        }
 
@@ -137,7 +131,7 @@ gravatar_photo_source_get_photo_thread (GSimpleAsyncResult *simple,
 
        g_debug ("Request complete");
 
-       g_clear_object (&request);
+       g_clear_object (&message);
        g_clear_object (&session);
 
        g_free (hash);
diff --git a/src/modules/prefer-plain/e-mail-display-popup-prefer-plain.c 
b/src/modules/prefer-plain/e-mail-display-popup-prefer-plain.c
index 2784153282..777bdc69b1 100644
--- a/src/modules/prefer-plain/e-mail-display-popup-prefer-plain.c
+++ b/src/modules/prefer-plain/e-mail-display-popup-prefer-plain.c
@@ -92,22 +92,22 @@ toggle_part (GtkAction *action,
              EMailDisplayPopupExtension *extension)
 {
        EMailDisplayPopupPreferPlain *pp_extension = (EMailDisplayPopupPreferPlain *) extension;
-       SoupURI *soup_uri;
+       GUri *guri;
        GHashTable *query;
-       gchar *uri;
+       gchar *uri, *query_str;
 
        if (!pp_extension->iframe_src)
                return;
 
-       soup_uri = soup_uri_new (pp_extension->iframe_src);
+       guri = g_uri_parse (pp_extension->iframe_src, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
 
-       if (!soup_uri || !soup_uri->query) {
-               if (soup_uri)
-                       soup_uri_free (soup_uri);
+       if (!guri || !g_uri_get_query (guri)) {
+               if (guri)
+                       g_uri_unref (guri);
                return;
        }
 
-       query = soup_form_decode (soup_uri->query);
+       query = soup_form_decode (g_uri_get_query (guri));
        g_hash_table_replace (
                query, g_strdup ("part_id"),
                pp_extension->text_html_id ?
@@ -119,11 +119,13 @@ toggle_part (GtkAction *action,
                        (gpointer) "text/html" :
                        (gpointer) "text/plain");
 
-       soup_uri_set_query_from_form (soup_uri, query);
-       g_hash_table_destroy (query);
+       query_str = soup_form_encode_hash (query);
+       e_util_change_uri_component (&guri, SOUP_URI_QUERY, query_str);
+       g_hash_table_unref (query);
+       g_free (query_str);
 
-       uri = soup_uri_to_string (soup_uri, FALSE);
-       soup_uri_free (soup_uri);
+       uri = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
+       g_uri_unref (guri);
 
        e_web_view_set_iframe_src (E_WEB_VIEW (e_extension_get_extensible (E_EXTENSION (extension))),
                pp_extension->iframe_id, uri);
@@ -240,7 +242,7 @@ mail_display_popup_prefer_plain_update_actions (EMailDisplayPopupExtension *exte
        EMailDisplayPopupPreferPlain *pp_extension;
        GtkAction *action;
        gchar *part_id, *pos, *prefix;
-       SoupURI *soup_uri;
+       GUri *guri;
        GHashTable *query;
        EMailPartList *part_list;
        gboolean is_text_plain;
@@ -259,18 +261,18 @@ mail_display_popup_prefer_plain_update_actions (EMailDisplayPopupExtension *exte
        set_popup_place (pp_extension, popup_iframe_src, popup_iframe_id);
 
        if (pp_extension->iframe_src)
-               soup_uri = soup_uri_new (pp_extension->iframe_src);
+               guri = g_uri_parse (pp_extension->iframe_src, SOUP_HTTP_URI_FLAGS | 
G_URI_FLAGS_PARSE_RELAXED, NULL);
        else
-               soup_uri = NULL;
+               guri = NULL;
 
-       if (!soup_uri || !soup_uri->query) {
+       if (!guri || !g_uri_get_query (guri)) {
                gtk_action_group_set_visible (pp_extension->action_group, FALSE);
-               if (soup_uri)
-                       soup_uri_free (soup_uri);
+               if (guri)
+                       g_uri_unref (guri);
                return;
        }
 
-       query = soup_form_decode (soup_uri->query);
+       query = soup_form_decode (g_uri_get_query (guri));
        part_id = g_hash_table_lookup (query, "part_id");
        if (part_id == NULL) {
                gtk_action_group_set_visible (pp_extension->action_group, FALSE);
@@ -356,7 +358,7 @@ mail_display_popup_prefer_plain_update_actions (EMailDisplayPopupExtension *exte
        g_free (prefix);
  out:
        g_hash_table_destroy (query);
-       soup_uri_free (soup_uri);
+       g_uri_unref (guri);
 }
 
 void
diff --git a/src/modules/text-highlight/e-mail-display-popup-text-highlight.c 
b/src/modules/text-highlight/e-mail-display-popup-text-highlight.c
index 606024b8a6..d4bd02c981 100644
--- a/src/modules/text-highlight/e-mail-display-popup-text-highlight.c
+++ b/src/modules/text-highlight/e-mail-display-popup-text-highlight.c
@@ -128,9 +128,9 @@ reformat (GtkAction *old,
           gpointer user_data)
 {
        EMailDisplayPopupTextHighlight *th_extension;
-       SoupURI *soup_uri;
+       GUri *guri;
        GHashTable *query;
-       gchar *uri;
+       gchar *uri, *query_str;
 
        th_extension = E_MAIL_DISPLAY_POPUP_TEXT_HIGHLIGHT (user_data);
 
@@ -138,19 +138,19 @@ reformat (GtkAction *old,
                return;
 
        if (th_extension->iframe_src)
-               soup_uri = soup_uri_new (th_extension->iframe_src);
+               guri = g_uri_parse (th_extension->iframe_src, SOUP_HTTP_URI_FLAGS | 
G_URI_FLAGS_PARSE_RELAXED, NULL);
        else
-               soup_uri = NULL;
+               guri = NULL;
 
-       if (!soup_uri)
+       if (!guri)
                return;
 
-       if (!soup_uri->query) {
-               soup_uri_free (soup_uri);
+       if (!g_uri_get_query (guri)) {
+               g_uri_unref (guri);
                return;
        }
 
-       query = soup_form_decode (soup_uri->query);
+       query = soup_form_decode (g_uri_get_query (guri));
        g_hash_table_replace (
                query, g_strdup ("__formatas"), (gpointer) gtk_action_get_name (action));
        g_hash_table_replace (
@@ -166,11 +166,13 @@ reformat (GtkAction *old,
        }
        #endif
 
-       soup_uri_set_query_from_form (soup_uri, query);
-       g_hash_table_destroy (query);
+       query_str = soup_form_encode_hash (query);
+       e_util_change_uri_component (&guri, SOUP_URI_QUERY, query_str);
+       g_hash_table_unref (query);
+       g_free (query_str);
 
-       uri = soup_uri_to_string (soup_uri, FALSE);
-       soup_uri_free (soup_uri);
+       uri = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
+       g_uri_unref (guri);
 
        e_web_view_set_iframe_src (E_WEB_VIEW (e_extension_get_extensible (E_EXTENSION (th_extension))),
                th_extension->iframe_id, uri);
@@ -323,13 +325,13 @@ update_actions (EMailDisplayPopupExtension *extension,
         * then try to check what formatter it's using at the moment and set
         * it as active in the popup menu */
        if (th_extension->iframe_src && strstr (th_extension->iframe_src, ".text-highlight") != NULL) {
-               SoupURI *soup_uri;
+               GUri *guri;
                gtk_action_group_set_visible (
                        th_extension->action_group, TRUE);
 
-               soup_uri = soup_uri_new (th_extension->iframe_src);
-               if (soup_uri && soup_uri->query) {
-                       GHashTable *query = soup_form_decode (soup_uri->query);
+               guri = g_uri_parse (th_extension->iframe_src, SOUP_HTTP_URI_FLAGS | 
G_URI_FLAGS_PARSE_RELAXED, NULL);
+               if (guri && g_uri_get_query (guri)) {
+                       GHashTable *query = soup_form_decode (g_uri_get_query (guri));
                        const gchar *highlighter;
 
                        if (!emdp_text_highlight_is_enabled () &&
@@ -356,8 +358,8 @@ update_actions (EMailDisplayPopupExtension *extension,
                        g_hash_table_destroy (query);
                }
 
-               if (soup_uri)
-                       soup_uri_free (soup_uri);
+               if (guri)
+                       g_uri_unref (guri);
        } else {
                gtk_action_group_set_visible (th_extension->action_group, FALSE);
        }
diff --git a/src/modules/text-highlight/e-mail-formatter-text-highlight.c 
b/src/modules/text-highlight/e-mail-formatter-text-highlight.c
index d7c641c157..d43d2fcbb6 100644
--- a/src/modules/text-highlight/e-mail-formatter-text-highlight.c
+++ b/src/modules/text-highlight/e-mail-formatter-text-highlight.c
@@ -78,15 +78,15 @@ get_syntax (EMailPart *part,
        mime_part = e_mail_part_ref_mime_part (part);
 
        if (uri) {
-               SoupURI *soup_uri = soup_uri_new (uri);
-               GHashTable *query = soup_form_decode (soup_uri->query);
+               GUri *guri = g_uri_parse (uri, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+               GHashTable *query = soup_form_decode (g_uri_get_query (guri));
 
                syntax = g_hash_table_lookup (query, "__formatas");
                if (syntax) {
                        syntax = g_strdup (syntax);
                }
                g_hash_table_destroy (query);
-               soup_uri_free (soup_uri);
+               g_uri_unref (guri);
        }
 
        /* Try to detect syntax by content-type first */
@@ -293,17 +293,17 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
                        gboolean can_process = FALSE;
 
                        if (context->uri) {
-                               SoupURI *soup_uri;
+                               GUri *guri;
 
-                               soup_uri = soup_uri_new (context->uri);
-                               if (soup_uri) {
+                               guri = g_uri_parse (context->uri, SOUP_HTTP_URI_FLAGS | 
G_URI_FLAGS_PARSE_RELAXED, NULL);
+                               if (guri) {
                                        GHashTable *query;
 
-                                       query = soup_form_decode (soup_uri->query);
+                                       query = soup_form_decode (g_uri_get_query (guri));
                                        can_process = query && g_strcmp0 (g_hash_table_lookup (query, 
"__force_highlight"), "true") == 0;
                                        if (query)
                                                g_hash_table_destroy (query);
-                                       soup_uri_free (soup_uri);
+                                       g_uri_unref (guri);
                                }
                        }
 
diff --git a/src/plugins/publish-calendar/publish-calendar.c b/src/plugins/publish-calendar/publish-calendar.c
index 5e0f79d263..765543217b 100644
--- a/src/plugins/publish-calendar/publish-calendar.c
+++ b/src/plugins/publish-calendar/publish-calendar.c
@@ -325,7 +325,7 @@ ask_password (GMountOperation *op,
        const gchar *username;
        gchar *password;
        gboolean req_pass = FALSE;
-       SoupURI *soup_uri;
+       GUri *guri;
 
        g_return_if_fail (ms != NULL);
 
@@ -333,10 +333,10 @@ ask_password (GMountOperation *op,
        if ((flags & G_ASK_PASSWORD_NEED_PASSWORD) == 0)
                return;
 
-       soup_uri = soup_uri_new (ms->uri->location);
-       g_return_if_fail (soup_uri != NULL);
+       guri = g_uri_parse (ms->uri->location, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+       g_return_if_fail (guri != NULL);
 
-       username = soup_uri_get_user (soup_uri);
+       username = g_uri_get_user (guri);
        password = e_passwords_get_password (ms->uri->location);
        req_pass =
                ((username && *username) &&
@@ -357,7 +357,7 @@ ask_password (GMountOperation *op,
                if (!password) {
                        /* user canceled password dialog */
                        g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED);
-                       soup_uri_free (soup_uri);
+                       g_uri_unref (guri);
 
                        return;
                }
@@ -373,7 +373,7 @@ ask_password (GMountOperation *op,
 
        g_mount_operation_reply (op, G_MOUNT_OPERATION_HANDLED);
 
-       soup_uri_free (soup_uri);
+       g_uri_unref (guri);
 }
 
 static void
diff --git a/src/plugins/publish-calendar/publish-location.c b/src/plugins/publish-calendar/publish-location.c
index 452a4c2d30..f7f7788882 100644
--- a/src/plugins/publish-calendar/publish-location.c
+++ b/src/plugins/publish-calendar/publish-location.c
@@ -41,7 +41,7 @@ migrateURI (const gchar *xml,
        xmlNodePtr root, p;
        EPublishUri *uri;
        gchar *password, *temp;
-       SoupURI *soup_uri;
+       GUri *guri;
        gint ii;
        gboolean found = FALSE;
 
@@ -53,20 +53,20 @@ migrateURI (const gchar *xml,
        frequency = xmlGetProp (root, (const guchar *)"frequency");
        username = xmlGetProp (root, (const guchar *)"username");
 
-       soup_uri = soup_uri_new ((gchar *) location);
+       guri = g_uri_parse ((const gchar *) location, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
 
-       if (soup_uri == NULL) {
+       if (guri == NULL) {
                g_warning ("Could not form the uri for %s \n", location);
                goto cleanup;
        }
 
-       soup_uri_set_user (soup_uri, (gchar *) username);
+       e_util_change_uri_component (&guri, SOUP_URI_USER, (const gchar *) username);
 
-       temp = soup_uri_to_string (soup_uri, FALSE);
+       temp = g_uri_to_string_partial (guri, G_URI_HIDE_PASSWORD);
        uri->location = g_strdup_printf ("dav://%s", strstr (temp, "//") + 2);
        g_free (temp);
 
-       soup_uri_free (soup_uri);
+       g_uri_unref (guri);
 
        if (enabled != NULL)
                uri->enabled = atoi ((gchar *) enabled);
diff --git a/src/plugins/publish-calendar/url-editor-dialog.c 
b/src/plugins/publish-calendar/url-editor-dialog.c
index 345f81c748..7b8a1b585a 100644
--- a/src/plugins/publish-calendar/url-editor-dialog.c
+++ b/src/plugins/publish-calendar/url-editor-dialog.c
@@ -300,7 +300,7 @@ static void
 set_from_uri (UrlEditorDialog *dialog)
 {
        EPublishUri *uri;
-       SoupURI *soup_uri;
+       GUri *guri;
        const gchar *scheme;
        const gchar *user;
        const gchar *host;
@@ -309,11 +309,11 @@ set_from_uri (UrlEditorDialog *dialog)
 
        uri = dialog->uri;
 
-       soup_uri = soup_uri_new (uri->location);
-       g_return_if_fail (soup_uri != NULL);
+       guri = g_uri_parse (uri->location, SOUP_HTTP_URI_FLAGS | G_URI_FLAGS_PARSE_RELAXED, NULL);
+       g_return_if_fail (guri != NULL);
 
        /* determine our service type */
-       scheme = soup_uri_get_scheme (soup_uri);
+       scheme = g_uri_get_scheme (guri);
        g_return_if_fail (scheme != NULL);
 
        if (strcmp (scheme, "smb") == 0)
@@ -331,10 +331,10 @@ set_from_uri (UrlEditorDialog *dialog)
        else
                uri->service_type = TYPE_URI;
 
-       user = soup_uri_get_user (soup_uri);
-       host = soup_uri_get_host (soup_uri);
-       port = soup_uri_get_port (soup_uri);
-       path = soup_uri_get_path (soup_uri);
+       user = g_uri_get_user (guri);
+       host = g_uri_get_host (guri);
+       port = g_uri_get_port (guri);
+       path = g_uri_get_path (guri);
 
        if (user != NULL)
                gtk_entry_set_text (GTK_ENTRY (dialog->username_entry), user);
@@ -357,7 +357,7 @@ set_from_uri (UrlEditorDialog *dialog)
 
        gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->publish_service), uri->service_type);
 
-       soup_uri_free (soup_uri);
+       g_uri_unref (guri);
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]