mirror of
https://github.com/etesync/android
synced 2025-01-11 00:01:12 +00:00
Multiple bug fixes
* doesn't try to update address book URL when there is no sync-able address book (fixes #208) * add test for HTTPS/SNI
This commit is contained in:
parent
c5905b44ed
commit
cba27426b7
@ -126,9 +126,11 @@ public class AccountSettings {
|
||||
URI principalURI = new URI(v0_principalURL);
|
||||
|
||||
// update address book
|
||||
String addressBookURL = principalURI.resolve(v0_addressBookPath).toASCIIString();
|
||||
Log.d(TAG, "New address book URL = " + addressBookURL);
|
||||
accountManager.setUserData(account, "addressbook_url", addressBookURL);
|
||||
if (v0_addressBookPath != null) {
|
||||
String addressBookURL = principalURI.resolve(v0_addressBookPath).toASCIIString();
|
||||
Log.d(TAG, "New address book URL = " + addressBookURL);
|
||||
accountManager.setUserData(account, "addressbook_url", addressBookURL);
|
||||
}
|
||||
|
||||
// update calendars
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
|
@ -28,8 +28,8 @@ public class DavHttpClient {
|
||||
|
||||
static {
|
||||
socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory> create()
|
||||
.register("https", TlsSniSocketFactory.INSTANCE)
|
||||
.register("http", PlainConnectionSocketFactory.getSocketFactory())
|
||||
.register("https", TlsSniSocketFactory.INSTANCE)
|
||||
.build();
|
||||
|
||||
// use request defaults from AndroidHttpClient
|
||||
|
@ -7,12 +7,16 @@ import java.net.URISyntaxException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.net.ssl.SSLPeerUnverifiedException;
|
||||
|
||||
import lombok.Cleanup;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import android.content.res.AssetManager;
|
||||
import android.os.Build;
|
||||
import android.test.InstrumentationTestCase;
|
||||
import android.util.Log;
|
||||
import at.bitfire.davdroid.webdav.DavException;
|
||||
import at.bitfire.davdroid.webdav.DavHttpClient;
|
||||
import at.bitfire.davdroid.webdav.DavMultiget;
|
||||
@ -27,6 +31,8 @@ import ch.boye.httpclientandroidlib.impl.client.CloseableHttpClient;
|
||||
// tests require running robohydra!
|
||||
|
||||
public class WebDavResourceTest extends InstrumentationTestCase {
|
||||
private static final String TAG = "davdroidTest.WebDavResourceTest";
|
||||
|
||||
static final String ROBOHYDRA_BASE = "http://10.0.0.11:3000/";
|
||||
static byte[] SAMPLE_CONTENT = new byte[] { 1, 2, 3, 4, 5 };
|
||||
|
||||
@ -157,6 +163,25 @@ public class WebDavResourceTest extends InstrumentationTestCase {
|
||||
assertTrue(Arrays.equals(expected, simpleFile.getContent()));
|
||||
}
|
||||
|
||||
public void testGetHttpsWithSni() throws URISyntaxException, HttpException, IOException, DavException {
|
||||
WebDavResource file = new WebDavResource(httpClient, new URI("https://sni.velox.ch"), false);
|
||||
|
||||
boolean sniWorking;
|
||||
try {
|
||||
file.get();
|
||||
sniWorking = true;
|
||||
} catch (SSLPeerUnverifiedException e) {
|
||||
sniWorking = false;
|
||||
}
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
// SNI should be available in Android 4.2+
|
||||
assertTrue(sniWorking);
|
||||
} else
|
||||
Log.i(TAG, "SNI not tested (only available in Android 4.2+)");
|
||||
|
||||
}
|
||||
|
||||
public void testMultiGet() throws DavException, IOException, HttpException {
|
||||
WebDavResource davAddressBook = new WebDavResource(davCollection, "addressbooks/default.vcf", true);
|
||||
davAddressBook.multiGet(DavMultiget.Type.ADDRESS_BOOK, new String[] { "1.vcf", "2.vcf" });
|
||||
|
Loading…
Reference in New Issue
Block a user