From 268560bf45c06793f3cd7546132056e191a138b1 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Tue, 5 Mar 2024 12:04:53 -0300 Subject: [PATCH 1/4] Don't fail session resumption test if session doesn't get resumed --- .../org/fdroid/download/HttpManagerInstrumentationTest.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/download/src/androidInstrumentedTest/kotlin/org/fdroid/download/HttpManagerInstrumentationTest.kt b/libs/download/src/androidInstrumentedTest/kotlin/org/fdroid/download/HttpManagerInstrumentationTest.kt index de6e15299..df54aad23 100644 --- a/libs/download/src/androidInstrumentedTest/kotlin/org/fdroid/download/HttpManagerInstrumentationTest.kt +++ b/libs/download/src/androidInstrumentedTest/kotlin/org/fdroid/download/HttpManagerInstrumentationTest.kt @@ -16,12 +16,12 @@ import org.fdroid.getIndexFile import org.fdroid.getRandomString import org.fdroid.runSuspend import org.json.JSONObject +import org.junit.Assume.assumeTrue import org.junit.runner.RunWith import javax.net.ssl.SSLHandshakeException import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse -import kotlin.test.assertTrue @RunWith(AndroidJUnit4::class) @Suppress("BlockingMethodInNonBlockingContext") @@ -113,7 +113,10 @@ internal class HttpManagerInstrumentationTest { // second request right after resumed session JSONObject(httpManager.getBytes(downloadRequest).decodeToString()).let { json -> val connectionInfo = json.getJSONObject("connection_info") - assertTrue(connectionInfo.getBoolean("session_resumed")) + assumeTrue( + "Session was not resumed at all", + connectionInfo.getBoolean("session_resumed") + ) } delay(10_100) // third request after 10s did not resume session From 2836bd4d9009d0b5d5bc7d769e0eb3fd54cdd2ee Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 12 Mar 2024 16:09:00 +0100 Subject: [PATCH 2/4] remove obsolete SDK 22 code block --- .../java/org/fdroid/fdroid/net/HttpDownloaderTest.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/src/androidTest/java/org/fdroid/fdroid/net/HttpDownloaderTest.java b/app/src/androidTest/java/org/fdroid/fdroid/net/HttpDownloaderTest.java index 32510b95a..b5e9a7ab6 100644 --- a/app/src/androidTest/java/org/fdroid/fdroid/net/HttpDownloaderTest.java +++ b/app/src/androidTest/java/org/fdroid/fdroid/net/HttpDownloaderTest.java @@ -51,14 +51,10 @@ public class HttpDownloaderTest { new Pair<>("https://ftp.fau.de/fdroid/repo", "dev.lonami.klooni/en-US/phoneScreenshots/1-game.jpg"), //new Pair<>("https://microg.org/fdroid/repo/index-v1.jar"), //new Pair<>("https://grobox.de/fdroid/repo/index.jar"), - new Pair<>("https://guardianproject.info/fdroid/repo", IndexV1UpdaterKt.SIGNED_FILE_NAME) + new Pair<>("https://guardianproject.info/fdroid/repo", IndexV1UpdaterKt.SIGNED_FILE_NAME), + new Pair<>("https://en.wikipedia.org", "/wiki/Index.html"), // no SNI but weird ipv6 lookup issues + new Pair<>("https://mirror.cyberbits.eu/fdroid/repo/", IndexV1UpdaterKt.SIGNED_FILE_NAME) // TLSv1.2 only and SNI )); - if (Build.VERSION.SDK_INT >= 22) { - tempUrls.addAll(Arrays.asList( - new Pair<>("https://en.wikipedia.org", "/wiki/Index.html"), // no SNI but weird ipv6 lookup issues - new Pair<>("https://mirror.cyberbits.eu/fdroid/repo/", IndexV1UpdaterKt.SIGNED_FILE_NAME) // TLSv1.2 only and SNI - )); - } URLS = tempUrls; } From 5d8e5e584949ae3209aa78b01671b25a32beff46 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 12 Mar 2024 17:10:24 +0100 Subject: [PATCH 3/4] switch downloadThenCancel test to host w/o Let's Encrypt cert refs #2102 --- .../org/fdroid/fdroid/net/HttpDownloaderTest.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/androidTest/java/org/fdroid/fdroid/net/HttpDownloaderTest.java b/app/src/androidTest/java/org/fdroid/fdroid/net/HttpDownloaderTest.java index b5e9a7ab6..cdbbc4bb9 100644 --- a/app/src/androidTest/java/org/fdroid/fdroid/net/HttpDownloaderTest.java +++ b/app/src/androidTest/java/org/fdroid/fdroid/net/HttpDownloaderTest.java @@ -55,6 +55,15 @@ public class HttpDownloaderTest { new Pair<>("https://en.wikipedia.org", "/wiki/Index.html"), // no SNI but weird ipv6 lookup issues new Pair<>("https://mirror.cyberbits.eu/fdroid/repo/", IndexV1UpdaterKt.SIGNED_FILE_NAME) // TLSv1.2 only and SNI )); + if (Build.VERSION.SDK_INT < 26) { + // domains that use Let's Encrypt won't work on Android 7.1 and older + // https://gitlab.com/fdroid/fdroidclient/-/issues/2102 + tempUrls = new ArrayList<>(Arrays.asList( + new Pair<>("https://en.wikipedia.org", "/wiki/Index.html"), + new Pair<>("https://ftp.fau.de/fdroid/repo/", IndexV1UpdaterKt.SIGNED_FILE_NAME), + new Pair<>("https://ftp.gwdg.de/pub/android/fdroid/repo/", IndexV1UpdaterKt.SIGNED_FILE_NAME) + )); + } URLS = tempUrls; } @@ -147,7 +156,7 @@ public class HttpDownloaderTest { public void downloadThenCancel() throws IOException, InterruptedException { final CountDownLatch latch = new CountDownLatch(2); String path = "index.jar"; - List mirrors = Mirror.fromStrings(Collections.singletonList("https://f-droid.org/repo/")); + List mirrors = Mirror.fromStrings(Collections.singletonList("https://ftp.fau.de/fdroid/repo/")); File destFile = File.createTempFile("dl-", ""); final DownloadRequest request = new DownloadRequest(path, mirrors, null, null, null); final HttpDownloader httpDownloader = new HttpDownloader(httpManager, request, destFile); From fe86bf302fdfa0a7619ea59cb39303d837484eaa Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Tue, 12 Mar 2024 17:35:11 -0300 Subject: [PATCH 4/4] [app] wikipedia uses letsencrypt, so that needs SDK >= 26 --- .../java/org/fdroid/fdroid/net/HttpDownloaderTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/androidTest/java/org/fdroid/fdroid/net/HttpDownloaderTest.java b/app/src/androidTest/java/org/fdroid/fdroid/net/HttpDownloaderTest.java index cdbbc4bb9..682dfe212 100644 --- a/app/src/androidTest/java/org/fdroid/fdroid/net/HttpDownloaderTest.java +++ b/app/src/androidTest/java/org/fdroid/fdroid/net/HttpDownloaderTest.java @@ -59,7 +59,6 @@ public class HttpDownloaderTest { // domains that use Let's Encrypt won't work on Android 7.1 and older // https://gitlab.com/fdroid/fdroidclient/-/issues/2102 tempUrls = new ArrayList<>(Arrays.asList( - new Pair<>("https://en.wikipedia.org", "/wiki/Index.html"), new Pair<>("https://ftp.fau.de/fdroid/repo/", IndexV1UpdaterKt.SIGNED_FILE_NAME), new Pair<>("https://ftp.gwdg.de/pub/android/fdroid/repo/", IndexV1UpdaterKt.SIGNED_FILE_NAME) ));