GNOME Bugzilla – Bug 752736
owncloud: Doesn't work with non-standard ports
Last modified: 2015-10-14 17:54:17 UTC
When adding an account to GOA (in this case, ownCloud) and providing a URI with a port number included, the GOA Files component does not work properly. The WebDAV mount is added to Nautilus, but when attempting to mount, it reports the following errors: If the URI is https://my.server.com:42123/owncloud/ "Unable to access "[SERVER]" HTTP Error: Could not connect: Connection refused" If the URI is http://my.server.com:42123/owncloud/ "Unable to access "[SERVER]" Not a WebDAV enabled share" If the ownCloud site is bound to the standard ports (80/443) and the GOA URI is https://my.server.com/owncloud/ or http://my.server.com/owncloud/ then Files integration works properly and the WebDAV share is mounted. Contacts, Calendar, and Documents all work properly using a :[port] URI. In Nautilus, using the "Connect to Server" function and providing the URI: davs://my.server.com:42123/owncloud/remote.php/webdav Nautilus prompts for authentication and the WebDAV share is mounted properly. So it seems the problem is not with Nautilus or GVFS, per se. This looks to be an issue of properly parsing the URI in accounts.conf and handing off the ownCloud-extended URI to Nautilus. It seems the :[port] portion is not being handled properly in the conversion. Thanks.
Looking at goaowncloudprovider.c WebDAV URI processing differs from CalDAV/CardDAV, in that the URI is passed to libsoup to determine the scheme of the URI (dav or davs): @ line 266 scheme = soup_uri_get_scheme (uri); if (g_strcmp0 (scheme, SOUP_URI_SCHEME_HTTPS) == 0) soup_uri_set_scheme (uri, "davs"); else soup_uri_set_scheme (uri, "dav"); Looking at soup_uri_set_scheme, the port is set by soup_scheme_default_port: soup_uri_set_scheme (SoupURI *uri, const char *scheme) { uri->scheme = soup_uri_get_scheme (scheme, strlen (scheme)); uri->port = soup_scheme_default_port (uri->scheme); } Which just returns the standard ports for http and https: soup_scheme_default_port (const char *scheme) { if (scheme == SOUP_URI_SCHEME_HTTP) return 80; else if (scheme == SOUP_URI_SCHEME_HTTPS) return 443; else return 0; } So basically, the ownCloud provider is assuming the server is listening on the default ports for either dav or davs, and is ignoring the user-defined port in the URI. soup_uri_to_string appears to properly handle non-standard ports (it works for CardDAV and CalDAV), so it seems the direct option is to avoid the use of soup_uri_set_scheme and implement this functionality: uri->scheme = soup_uri_get_scheme (scheme, strlen (scheme)); without the added step of setting the uri->port to the default. I'm not a C programmer, so I don't have a patch to submit, but it seems like it would be straightforward to fix. Thanks.
Many thanks for the detailed bug report. You are right.
Created attachment 311170 [details] [review] owncloud: Set the correct port number in GoaFiles:Uri
Can you please test the attached patch?
Created attachment 311559 [details] [review] owncloud: Set the correct port number in GoaFiles:Uri
This is will make it to 3.18.x once we have released 3.18.0 and the code freeze is over. Thanks for the excellent bug report.
*** Bug 719653 has been marked as a duplicate of this bug. ***