Skip to content

Commit 3dbd07c

Browse files
committed
Merge branch 'master' into ios-networking-indicator
2 parents cb597c0 + 60189a6 commit 3dbd07c

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

src/android/com/github/kevinsawicki/http/HttpRequest.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,13 @@ public static void setSSLCertMode(String mode) {
302302
try {
303303
if (mode == CERT_MODE_TRUSTALL) {
304304
SOCKET_FACTORY = createSocketFactory(getNoopTrustManagers());
305+
HOSTNAME_VERIFIER = getTrustedVerifier();
305306
} else if (mode == CERT_MODE_PINNED) {
306307
SOCKET_FACTORY = createSocketFactory(getPinnedTrustManagers());
308+
HOSTNAME_VERIFIER = null;
307309
} else {
308310
SOCKET_FACTORY = null;
311+
HOSTNAME_VERIFIER = null;
309312
}
310313

311314
CURRENT_CERT_MODE = mode;
@@ -314,19 +317,6 @@ public static void setSSLCertMode(String mode) {
314317
}
315318
}
316319

317-
/**
318-
* Configure host name verification for all future HTTPS connections
319-
*
320-
* @param enabled
321-
*/
322-
public static void setHostnameVerification(boolean enabled) {
323-
if (enabled) {
324-
HOSTNAME_VERIFIER = null;
325-
} else {
326-
HOSTNAME_VERIFIER = getTrustedVerifier();
327-
}
328-
}
329-
330320
private static TrustManager[] getPinnedTrustManagers() throws IOException {
331321
if (PINNED_CERTS == null) {
332322
throw new IOException("You must add at least 1 certificate in order to pin to certificates");

src/android/com/synconset/cordovahttp/CordovaHttpPlugin.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,8 @@ else if (action.equals("delete")) {
100100

101101
if (accept) {
102102
HttpRequest.setSSLCertMode(HttpRequest.CERT_MODE_TRUSTALL);
103-
HttpRequest.setHostnameVerification(false);
104103
} else {
105104
HttpRequest.setSSLCertMode(HttpRequest.CERT_MODE_DEFAULT);
106-
HttpRequest.setHostnameVerification(true);
107105
}
108106

109107
callbackContext.success();
@@ -169,10 +167,8 @@ private void enableSSLPinning(boolean enable) throws GeneralSecurityException, I
169167
}
170168

171169
HttpRequest.setSSLCertMode(HttpRequest.CERT_MODE_PINNED);
172-
HttpRequest.setHostnameVerification(true);
173170
} else {
174171
HttpRequest.setSSLCertMode(HttpRequest.CERT_MODE_DEFAULT);
175-
HttpRequest.setHostnameVerification(true);
176172
}
177173
}
178174
}
264 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)