Ensure X509HostnameVerifier is never null

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1528614 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2013-10-02 20:14:31 +00:00
parent d9e2140b12
commit 08140864e3
2 changed files with 7 additions and 0 deletions

View File

@ -1,6 +1,9 @@
Changes since 4.3
-------------------
* Ensure X509HostnameVerifier is never null.
Contributed by Oleg Kalnichevski <olegk at apache.org>
* [HTTPCLIENT-1405] CONNECT HTTP/1.1 requests lack mandatory 'Host' header.
Contributed by Oleg Kalnichevski <olegk at apache.org>

View File

@ -699,6 +699,10 @@ public class HttpClientBuilder {
if (connManager == null) {
LayeredConnectionSocketFactory sslSocketFactory = this.sslSocketFactory;
if (sslSocketFactory == null) {
X509HostnameVerifier hostnameVerifier = this.hostnameVerifier;
if (hostnameVerifier == null) {
hostnameVerifier = SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER;
}
if (sslcontext != null) {
sslSocketFactory = new SSLConnectionSocketFactory(sslcontext, hostnameVerifier);
} else {