mirror of
https://github.com/bitfireAT/davx5-ose
synced 2024-09-06 18:01:11 +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:
parent
09da0df62f
commit
7216415d34
|
@ -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
|
|
@ -21,13 +21,11 @@ import at.bitfire.davdroid.resource.InvalidResourceException;
|
||||||
public class EventTest extends InstrumentationTestCase {
|
public class EventTest extends InstrumentationTestCase {
|
||||||
AssetManager assetMgr;
|
AssetManager assetMgr;
|
||||||
|
|
||||||
Event eViennaEvolution,
|
Event eOnThatDay, eAllDay1Day, eAllDay10Days, eAllDay0Sec;
|
||||||
eOnThatDay, eAllDay1Day, eAllDay10Days, eAllDay0Sec;
|
|
||||||
|
|
||||||
public void setUp() throws IOException, InvalidResourceException {
|
public void setUp() throws IOException, InvalidResourceException {
|
||||||
assetMgr = getInstrumentation().getContext().getResources().getAssets();
|
assetMgr = getInstrumentation().getContext().getResources().getAssets();
|
||||||
|
|
||||||
eViennaEvolution = parseCalendar("vienna-evolution.ics");
|
|
||||||
eOnThatDay = parseCalendar("event-on-that-day.ics");
|
eOnThatDay = parseCalendar("event-on-that-day.ics");
|
||||||
eAllDay1Day = parseCalendar("all-day-1day.ics");
|
eAllDay1Day = parseCalendar("all-day-1day.ics");
|
||||||
eAllDay10Days = parseCalendar("all-day-10days.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 with start+end date-time
|
||||||
|
Event eViennaEvolution = parseCalendar("vienna-evolution.ics");
|
||||||
assertEquals(1381330800000L, eViennaEvolution.getDtStartInMillis());
|
assertEquals(1381330800000L, eViennaEvolution.getDtStartInMillis());
|
||||||
assertEquals("Europe/Vienna", eViennaEvolution.getDtStartTzID());
|
assertEquals("Europe/Vienna", eViennaEvolution.getDtStartTzID());
|
||||||
assertEquals(1381334400000L, eViennaEvolution.getDtEndInMillis());
|
assertEquals(1381334400000L, eViennaEvolution.getDtEndInMillis());
|
||||||
|
@ -116,6 +115,11 @@ public class EventTest extends InstrumentationTestCase {
|
||||||
assert(true);
|
assert(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {
|
protected Event parseCalendar(String fname) throws IOException, InvalidResourceException {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="at.bitfire.davdroid"
|
package="at.bitfire.davdroid"
|
||||||
android:versionCode="51" android:versionName="0.6.10"
|
android:versionCode="52" android:versionName="0.6.10.1"
|
||||||
android:installLocation="internalOnly">
|
android:installLocation="internalOnly">
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
|
|
|
@ -9,7 +9,7 @@ package at.bitfire.davdroid;
|
||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
public static final String
|
public static final String
|
||||||
APP_VERSION = "0.6.10",
|
APP_VERSION = "0.6.10.1",
|
||||||
ACCOUNT_TYPE = "bitfire.at.davdroid",
|
ACCOUNT_TYPE = "bitfire.at.davdroid",
|
||||||
WEB_URL_HELP = "https://davdroid.bitfire.at/configuration?pk_campaign=davdroid-app",
|
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";
|
WEB_URL_VIEW_LOGS = "https://github.com/bitfireAT/davdroid/wiki/How-to-view-the-logs";
|
||||||
|
|
|
@ -46,6 +46,7 @@ import net.fortuna.ical4j.model.property.Summary;
|
||||||
import net.fortuna.ical4j.model.property.Transp;
|
import net.fortuna.ical4j.model.property.Transp;
|
||||||
import net.fortuna.ical4j.model.property.Uid;
|
import net.fortuna.ical4j.model.property.Uid;
|
||||||
import net.fortuna.ical4j.model.property.Version;
|
import net.fortuna.ical4j.model.property.Version;
|
||||||
|
import net.fortuna.ical4j.util.CompatibilityHints;
|
||||||
import net.fortuna.ical4j.util.SimpleHostInfo;
|
import net.fortuna.ical4j.util.SimpleHostInfo;
|
||||||
import net.fortuna.ical4j.util.UidGenerator;
|
import net.fortuna.ical4j.util.UidGenerator;
|
||||||
|
|
||||||
|
@ -98,6 +99,15 @@ public class Event extends Resource {
|
||||||
public void addAlarm(VAlarm alarm) {
|
public void addAlarm(VAlarm alarm) {
|
||||||
alarms.add(alarm);
|
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) {
|
public Event(String name, String ETag) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import android.util.Log;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.http.HttpHost;
|
import org.apache.http.HttpHost;
|
||||||
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
|
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
|
||||||
|
import org.apache.http.conn.ssl.BrowserCompatHostnameVerifierHC4;
|
||||||
import org.apache.http.protocol.HttpContext;
|
import org.apache.http.protocol.HttpContext;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -34,12 +35,14 @@ import javax.net.ssl.SSLSocket;
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
|
|
||||||
public class TlsSniSocketFactory implements LayeredConnectionSocketFactory {
|
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();
|
public final static TlsSniSocketFactory INSTANCE = new TlsSniSocketFactory();
|
||||||
|
|
||||||
private final static SSLSocketFactory sslSocketFactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
|
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();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
|
|
||||||
net.fortuna.ical4j.timezone.update.enabled=false
|
|
||||||
|
|
||||||
ical4j.unfolding.relaxed=true
|
|
||||||
ical4j.parsing.relaxed=true
|
|
||||||
ical4j.compatibility.outlook=true
|
|
Loading…
Reference in a new issue