Package: evolution
Version: 2.30.3
Severity: important
Tags: patch upstream
Forwarded-To: https://bugzilla.gnome.org/show_bug.cgi?id=627713
X-Debbugs-CC: and...@morphoss.com

When setting a non default port for a WebDAV address book the port is
correctly saved by the backend. But, when the port is read back into the
UI (e.g. to display the address book property page) an error (with the
handling of SoupURI object which represent the URI to the server)
discard the non standard port which is not displayed (which may lead to
its deletion from the backend).

This bug also affects evolution-data-server (but I did not know if I can
report the same bug with two packages). the webdav address book backend
performs the same error when handling the SoupURI object and this
completely prevents using WebDAV server on non standard port.

I reported this bug upstream, and I am attaching here the two patches
that I sent to them (one for evolution and one for
evolution-data-server). They seems to correctly fixe this issue (without
any foreseeable drawback).

The last message of (Debian) bug 550195 seems to refer to this bug, but
the rest of the thread does not, so I am creating a new bug report.

Also, as WebDAV address book is a commonly used feature I am reporting
this bug as important, even though the most common use is certainly with
HTTPS on port 443 (which happen to be the only thing that worked).
Please tell me if I should have reported it with lower severity.

As a additional bonus, the patch for evolution-data-server fixes an
issue that I spotted while fixing the "port" bug and which completely
prevented to use HTTP (as opposed to HTTPS) WebDAV server even on
standard port (this as been reported alternatively as bug 639469 on the
gnome bugzilla).


--- evolution-data-server-2.30.3.orig/addressbook/backends/webdav/e-book-backend-webdav.c
+++ evolution-data-server-2.30.3/addressbook/backends/webdav/e-book-backend-webdav.c
@@ -1031,6 +1031,7 @@ e_book_backend_webdav_load_source(EBookB
 	const gchar               *use_ssl;
 	SoupSession               *session;
 	SoupURI                   *suri;
+    guint                     *port;
 
 	uri = e_source_get_uri(source);
 	if (uri == NULL) {
@@ -1063,11 +1064,14 @@ e_book_backend_webdav_load_source(EBookB
 	}
 
 	use_ssl = e_source_get_property (source, "use_ssl");
+    /* soup_uri_set_scheme reset the port if it was specified by the user. */
+    port = suri->port;
 	if (use_ssl != NULL && strcmp (use_ssl, "1") == 0) {
 		soup_uri_set_scheme (suri, "https");
 	} else {
-		soup_uri_set_scheme (suri, "https");
+		soup_uri_set_scheme (suri, "http");
 	}
+    soup_uri_set_port(suri, port);
 
 	/* append slash if missing */
 	if (!suri->path || !*suri->path || suri->path[strlen (suri->path) - 1] != '/') {
--- evolution-2.30.3.orig/plugins/webdav-account-setup/webdav-contacts-source.c
+++ evolution-2.30.3/plugins/webdav-account-setup/webdav-contacts-source.c
@@ -123,8 +123,12 @@ set_ui_from_source(ui_data *data)
 	gtk_toggle_button_set_active(data->avoid_ifmatch_toggle, avoid_ifmatch);
 
 	/* it's really a http or https protocol */
-	if (suri)
+	if (suri) {
+        /* soup_uri_set_scheme reset the port if it was specified by the user. */
+        guint port = suri->port;
 		soup_uri_set_scheme (suri, use_ssl ? "https" : "http");
+        soup_uri_set_port(suri, port);
+    }
 
 	/* remove user/username and set user field */
 	if (suri && suri->user != NULL) {

Reply via email to