1
0
mirror of https://github.com/etesync/android synced 2024-12-23 07:08:16 +00:00

Ensure trailing slash on user-given base URL (assuming users will always provide collections or base paths)

This commit is contained in:
rfc2822 2014-10-31 17:32:16 +01:00
parent e9901f38f5
commit 69c94c8d93
3 changed files with 9 additions and 7 deletions

View File

@ -12,6 +12,7 @@ import ezvcard.VCardVersion;
import android.content.Context;
import android.util.Log;
import at.bitfire.davdroid.R;
import at.bitfire.davdroid.URIUtils;
import at.bitfire.davdroid.webdav.DavException;
import at.bitfire.davdroid.webdav.DavHttpClient;
import at.bitfire.davdroid.webdav.DavIncapableException;
@ -27,8 +28,9 @@ public class DavResourceFinder {
// disable compression and enable network logging for debugging purposes
CloseableHttpClient httpClient = DavHttpClient.create(true, true);
WebDavResource base = new WebDavResource(httpClient, new URI(serverInfo.getProvidedURL()), serverInfo.getUserName(),
serverInfo.getPassword(), serverInfo.isAuthPreemptive());
WebDavResource base = new WebDavResource(httpClient,
new URI(URIUtils.ensureTrailingSlash(serverInfo.getProvidedURL())),
serverInfo.getUserName(), serverInfo.getPassword(), serverInfo.isAuthPreemptive());
// CardDAV
WebDavResource principal = getCurrentUserPrincipal(base, "carddav");
@ -159,6 +161,7 @@ public class DavResourceFinder {
} catch (DavException e) {
Log.d(TAG, "DAV error when querying principal for " + serviceName + " service", e);
}
Log.i(TAG, "Couldn't find current-user-principal for service " + serviceName);
return null;
}

View File

@ -135,7 +135,7 @@ public class TlsSniSocketFactory implements LayeredConnectionSocketFactory {
for (String protocol : ssl.getSupportedProtocols())
if (!protocol.toUpperCase().contains("SSL"))
protocols.add(protocol);
Log.d(TAG, "Setting allowed TLS protocols: " + StringUtils.join(protocols, ", "));
Log.v(TAG, "Setting allowed TLS protocols: " + StringUtils.join(protocols, ", "));
ssl.setEnabledProtocols(protocols.toArray(new String[0]));
// choose secure cipher suites
@ -173,7 +173,7 @@ public class TlsSniSocketFactory implements LayeredConnectionSocketFactory {
HashSet<String> enabledCiphers = new HashSet<String>(Arrays.asList(ssl.getEnabledCipherSuites()));
enabledCiphers.addAll(preferredCiphers);
Log.d(TAG, "Setting allowed TLS ciphers: " + StringUtils.join(enabledCiphers, ", "));
Log.v(TAG, "Setting allowed TLS ciphers: " + StringUtils.join(enabledCiphers, ", "));
ssl.setEnabledCipherSuites(enabledCiphers.toArray(new String[0]));
}

View File

@ -558,14 +558,13 @@ public class WebDavResource {
}
// about which resource is this response?
// "this" resource is either at "location"
if (location.equals(href)) { // -> ourselves
if (location.equals(href)) { // about ourselves
this.properties.putAll(properties);
if (supportedComponents != null)
this.supportedComponents = supportedComponents;
this.content = data;
} else {
} else { // about a member
WebDavResource member = new WebDavResource(this, href);
member.properties = properties;
member.supportedComponents = supportedComponents;