react-native https
作者:
OK2018 | 来源:发表于
2018-06-28 13:10 被阅读0次package com.facebook.react.modules.network;
import javax.annotation.Nullable;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
public class OkHttpClientProvider {
public static OkHttpClient.Builder createClientBuilder() {
// No timeouts by default
OkHttpClient.Builder client = new OkHttpClient.Builder()
.connectTimeout(0, TimeUnit.MILLISECONDS)
.readTimeout(0, TimeUnit.MILLISECONDS)
.writeTimeout(0, TimeUnit.MILLISECONDS)
.hostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true; //忽略所有的认证,直接返回了true
}
})
.cookieJar(new ReactCookieJarContainer());
return enableTls12OnPreLollipop(client);
}
}
本文标题:react-native https
本文链接:https://www.haomeiwen.com/subject/assgyftx.html
网友评论