Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9dbb72c

Browse files
committed
JDKProvider's HostnameVerifier is null when enabling acceptAnyCertificate
1 parent2501534 commit9dbb72c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

‎src/main/java/com/ning/http/client/AsyncHttpClientConfig.java‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
importjavax.net.ssl.HostnameVerifier;
2727
importjavax.net.ssl.SSLContext;
28+
importjavax.net.ssl.SSLSession;
2829

2930
importjava.util.Collections;
3031
importjava.util.LinkedList;
@@ -385,10 +386,15 @@ public boolean isValid() {
385386
* @return the {@link HostnameVerifier}
386387
*/
387388
publicHostnameVerifiergetHostnameVerifier() {
388-
if (hostnameVerifier ==null && !acceptAnyCertificate) {
389-
synchronized(this) {
389+
if (hostnameVerifier ==null) {
390+
synchronized(this) {
390391
if (hostnameVerifier ==null)
391-
hostnameVerifier =newDefaultHostnameVerifier();
392+
hostnameVerifier =acceptAnyCertificate ?newHostnameVerifier() {
393+
@Override
394+
publicbooleanverify(Stringhostname,SSLSessionsession) {
395+
returntrue;
396+
}
397+
} :newDefaultHostnameVerifier();
392398
}
393399
}
394400
returnhostnameVerifier;
@@ -926,12 +932,12 @@ public Builder setSslSessionCacheSize(Integer sslSessionCacheSize) {
926932
this.sslSessionCacheSize =sslSessionCacheSize;
927933
returnthis;
928934
}
929-
935+
930936
publicBuildersetSslSessionTimeout(IntegersslSessionTimeout) {
931937
this.sslSessionTimeout =sslSessionTimeout;
932938
returnthis;
933939
}
934-
940+
935941
/**
936942
* Create a config builder with values taken from the given prototype configuration.
937943
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp