Fix parsing of remote URL when mounting remote shares

This fix allows for having the remote ownCloud instance live in a
subpath like "http://example.com/basedir/subdir/owncloud".
Such URLs are now parsed correctly.

Added unit test for URL parsing.

Partial fix for #9125 

Please review @schiesbn @icewind1991