From 8d26fb0c0d67b906c68edea14b192aed2a9ae995 Mon Sep 17 00:00:00 2001 From: Amit Uttam Date: Thu, 14 May 2020 10:00:23 -0300 Subject: [PATCH] MM-18642 Ensure SSL exception is thrown for bad servers (#4299) Without the explicitly thrown exception, the TLS handshake never exits cleanly as it should ( [conversation](https://community.mattermost.com/private-core/pl/36cp76j5g3r7z8hre1pr8hfhmy) ) --- patches/rn-fetch-blob+0.12.0.patch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/patches/rn-fetch-blob+0.12.0.patch b/patches/rn-fetch-blob+0.12.0.patch index ac9fa1a36..6dbc2ef18 100644 --- a/patches/rn-fetch-blob+0.12.0.patch +++ b/patches/rn-fetch-blob+0.12.0.patch @@ -194,7 +194,7 @@ index a8abd71..9078855 100644 if(rnFetchBlobFileResp != null && !rnFetchBlobFileResp.isDownloadComplete()){ callback.invoke("Download interrupted.", null); diff --git a/node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlobUtils.java b/node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlobUtils.java -index ab35fdd..69f4b49 100644 +index ab35fdd..60465a0 100644 --- a/node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlobUtils.java +++ b/node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlobUtils.java @@ -6,12 +6,16 @@ import com.facebook.react.modules.core.DeviceEventManagerModule; @@ -233,7 +233,7 @@ index ab35fdd..69f4b49 100644 } public static OkHttpClient.Builder getUnsafeOkHttpClient(OkHttpClient client) { -@@ -92,4 +98,59 @@ public class RNFetchBlobUtils { +@@ -92,4 +98,60 @@ public class RNFetchBlobUtils { throw new RuntimeException(e); } } @@ -255,6 +255,7 @@ index ab35fdd..69f4b49 100644 + defaultTrustManager.checkServerTrusted(chain, authType); + } catch(CertificateException ce) { + emitWarningEvent("RNFetchBlob custom: Server presented problem with SSL handshake.", RNFetchBlobConst.EVENT_SSL_TRUST_MESSAGE); ++ throw ce; + } + } +