Skip to content

Commit f0e3357

Browse files
authored
Check protocol when opening connection without ignoreSsl (#848)
1 parent a630b1c commit f0e3357

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

android/src/main/kotlin/vn/hunghd/flutterdownloader/DownloadWorker.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,11 @@ class DownloadWorker(context: Context, params: WorkerParameters) :
300300
resourceUrl.openConnection() as HttpURLConnection
301301
}
302302
} else {
303-
resourceUrl.openConnection() as HttpsURLConnection
303+
if (resourceUrl.protocol.lowercase(Locale.US) == "https") {
304+
resourceUrl.openConnection() as HttpsURLConnection
305+
} else {
306+
resourceUrl.openConnection() as HttpURLConnection
307+
}
304308
}
305309
log("Open connection to $url")
306310
httpConn.connectTimeout = timeout

0 commit comments

Comments
 (0)