diff --git a/app/src/main/java/ru/yourok/torrserve/utils/Http.kt b/app/src/main/java/ru/yourok/torrserve/utils/Http.kt index 3aa697ef..beb3e6aa 100644 --- a/app/src/main/java/ru/yourok/torrserve/utils/Http.kt +++ b/app/src/main/java/ru/yourok/torrserve/utils/Http.kt @@ -1,6 +1,7 @@ package ru.yourok.torrserve.utils import android.net.Uri +import android.os.Build import info.guardianproject.netcipher.NetCipher import java.io.IOException import java.io.InputStream @@ -13,6 +14,8 @@ import java.net.HttpURLConnection.HTTP_SEE_OTHER import java.net.URL import java.util.Locale import java.util.zip.GZIPInputStream +import javax.net.ssl.HostnameVerifier +import javax.net.ssl.HttpsURLConnection /** @@ -45,6 +48,15 @@ class Http(url: Uri) { connection = if (currUrl.startsWith("https")) NetCipher.getHttpsURLConnection(url) + .also { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + val trustAllHostnames = HostnameVerifier { _, _ -> + true // Just allow them all + } + HttpsURLConnection.setDefaultHostnameVerifier(trustAllHostnames) + HttpsURLConnection.setDefaultSSLSocketFactory(Net.insecureTlsSocketFactory()) + } + } else NetCipher.getHttpURLConnection(url) connection!!.connectTimeout = timeout diff --git a/build.gradle b/build.gradle index 5bca505c..27046ae5 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.3.0' + classpath 'com.android.tools.build:gradle:8.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}" classpath 'com.google.gms:google-services:4.4.1' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'