1
0
mirror of https://github.com/etesync/android synced 2024-12-23 15:18:14 +00:00

Loosen some restrictions

* re-enable relaxed iCal unfolding and parsing + test
* switch to BrowserCompatHostnameVerifier again to allow IP addresses in certificate CN
This commit is contained in:
R Hirner 2015-01-06 18:42:15 +01:00
parent 4eb03f78f5
commit a7115ad39c
7 changed files with 39 additions and 14 deletions

View File

@ -0,0 +1,14 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:Blabla
BEGIN:VEVENT
CLASS:PUBLIC
CREATED;VALUE=DATE-TIME:20131008T205713
LAST-MODIFIED;VALUE=DATE-TIME:20131008T205740
SUMMARY:online Anmeldung
DESCRIPTION:http://www.tgbornheim.de/index.php?sessionid=&page=&id=&sportce
ntergroup=&day=6
UID:b99c41704b
DTSTART;VALUE=DATE-TIME;TZID=Europe/Berlin:20131019T060000
END:VEVENT
END:VCALENDAR

View File

@ -21,13 +21,11 @@ import at.bitfire.davdroid.resource.InvalidResourceException;
public class EventTest extends InstrumentationTestCase {
AssetManager assetMgr;
Event eViennaEvolution,
eOnThatDay, eAllDay1Day, eAllDay10Days, eAllDay0Sec;
Event eOnThatDay, eAllDay1Day, eAllDay10Days, eAllDay0Sec;
public void setUp() throws IOException, InvalidResourceException {
assetMgr = getInstrumentation().getContext().getResources().getAssets();
eViennaEvolution = parseCalendar("vienna-evolution.ics");
eOnThatDay = parseCalendar("event-on-that-day.ics");
eAllDay1Day = parseCalendar("all-day-1day.ics");
eAllDay10Days = parseCalendar("all-day-10days.ics");
@ -37,8 +35,9 @@ public class EventTest extends InstrumentationTestCase {
}
public void testStartEndTimes() throws IOException, ParserException {
public void testStartEndTimes() throws IOException, ParserException, InvalidResourceException {
// event with start+end date-time
Event eViennaEvolution = parseCalendar("vienna-evolution.ics");
assertEquals(1381330800000L, eViennaEvolution.getDtStartInMillis());
assertEquals("Europe/Vienna", eViennaEvolution.getDtStartTzID());
assertEquals(1381334400000L, eViennaEvolution.getDtEndInMillis());
@ -117,6 +116,11 @@ public class EventTest extends InstrumentationTestCase {
}
}
public void testUnfolding() throws IOException, InvalidResourceException {
Event e = parseCalendar("two-line-description-without-crlf.ics");
assertEquals("http://www.tgbornheim.de/index.php?sessionid=&page=&id=&sportcentergroup=&day=6", e.getDescription());
}
protected Event parseCalendar(String fname) throws IOException, InvalidResourceException {
@Cleanup InputStream in = assetMgr.open(fname, AssetManager.ACCESS_STREAMING);

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.bitfire.davdroid"
android:versionCode="51" android:versionName="0.6.10"
android:versionCode="52" android:versionName="0.6.10.1"
android:installLocation="internalOnly">
<uses-sdk

View File

@ -9,7 +9,7 @@ package at.bitfire.davdroid;
public class Constants {
public static final String
APP_VERSION = "0.6.10",
APP_VERSION = "0.6.10.1",
ACCOUNT_TYPE = "bitfire.at.davdroid",
WEB_URL_HELP = "https://davdroid.bitfire.at/configuration?pk_campaign=davdroid-app",
WEB_URL_VIEW_LOGS = "https://github.com/bitfireAT/davdroid/wiki/How-to-view-the-logs";

View File

@ -46,6 +46,7 @@ import net.fortuna.ical4j.model.property.Summary;
import net.fortuna.ical4j.model.property.Transp;
import net.fortuna.ical4j.model.property.Uid;
import net.fortuna.ical4j.model.property.Version;
import net.fortuna.ical4j.util.CompatibilityHints;
import net.fortuna.ical4j.util.SimpleHostInfo;
import net.fortuna.ical4j.util.UidGenerator;
@ -99,6 +100,15 @@ public class Event extends Resource {
alarms.add(alarm);
}
static {
CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_UNFOLDING, true);
CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, true);
CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_OUTLOOK_COMPATIBILITY, true);
// disable automatic time-zone updates (causes unnecessary network traffic for most people)
System.setProperty("net.fortuna.ical4j.timezone.update.enabled", "false");
}
public Event(String name, String ETag) {
super(name, ETag);

View File

@ -16,6 +16,7 @@ import android.util.Log;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
import org.apache.http.conn.ssl.BrowserCompatHostnameVerifierHC4;
import org.apache.http.protocol.HttpContext;
import java.io.IOException;
@ -34,12 +35,14 @@ import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
public class TlsSniSocketFactory implements LayeredConnectionSocketFactory {
private static final String TAG = "davdroid.SNISocketFactory";
private static final String TAG = "davdroid.TlsSniSocketFactory";
public final static TlsSniSocketFactory INSTANCE = new TlsSniSocketFactory();
private final static SSLSocketFactory sslSocketFactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
private final static HostnameVerifier hostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
// use BrowserCompatHostnameVerifier to allow IP addresses in the Common Name
private final static HostnameVerifier hostnameVerifier = new BrowserCompatHostnameVerifierHC4();
/*

View File

@ -1,6 +0,0 @@
net.fortuna.ical4j.timezone.update.enabled=false
ical4j.unfolding.relaxed=true
ical4j.parsing.relaxed=true
ical4j.compatibility.outlook=true