After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 752736 - owncloud: Doesn't work with non-standard ports
owncloud: Doesn't work with non-standard ports
Status: RESOLVED FIXED
Product: gnome-online-accounts
Classification: Core
Component: general
3.16.x
Other All
: Normal normal
: ---
Assigned To: GNOME Online Accounts maintainer(s)
GNOME Online Accounts maintainer(s)
: 719653 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-07-22 17:02 UTC by Sean O'Connell
Modified: 2015-10-14 17:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
owncloud: Set the correct port number in GoaFiles:Uri (1.95 KB, patch)
2015-09-11 17:55 UTC, Debarshi Ray
committed Details | Review
owncloud: Set the correct port number in GoaFiles:Uri (2.00 KB, patch)
2015-09-17 14:23 UTC, Debarshi Ray
committed Details | Review

Description Sean O'Connell 2015-07-22 17:02:58 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.
Comment 1 Sean O'Connell 2015-07-22 17:57:15 UTC
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.
Comment 2 Debarshi Ray 2015-09-11 17:54:58 UTC
Many thanks for the detailed bug report. You are right.
Comment 3 Debarshi Ray 2015-09-11 17:55:51 UTC
Created attachment 311170 [details] [review]
owncloud: Set the correct port number in GoaFiles:Uri
Comment 4 Debarshi Ray 2015-09-11 17:56:41 UTC
Can you please test the attached patch?
Comment 5 Debarshi Ray 2015-09-17 14:23:57 UTC
Created attachment 311559 [details] [review]
owncloud: Set the correct port number in GoaFiles:Uri
Comment 6 Debarshi Ray 2015-09-17 14:24:50 UTC
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.
Comment 7 Debarshi Ray 2015-09-17 14:47:03 UTC
*** Bug 719653 has been marked as a duplicate of this bug. ***