javax.net.ssl.SSLPeerUnverifiedException: Host name 'raw.githubusercontent.com' does not match the certificate subject provided by the peer (CN=www.github.com, O="Fastly, Inc.", ST=California, L=San Francisco, C=US)

Apache's JIRA Issue Tracker | Richard Bergoin | 2 years ago
  1. 0

    Hi, Just downloaded And patched client to replace the HttpGet variable : {code} HttpGet httpget = new HttpGet("https://raw.githubusercontent.com/test"); {code} From the first example : https://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientWithResponseHandler.java Compiled it with : {code} javac -cp .:httpcomponents-client-4.4.1/lib/httpclient-4.4.1.jar:httpcomponents-core-4.4.1/lib/httpcore-4.4.1.jar ClientWithResponseHandler.java {code} Run it and get error : {code} java -cp .:./httpcomponents-client-4.4.1/lib/httpclient-4.4.1.jar:./httpcomponents-core-4.4.1/lib/httpcore-4.4.1.jar:./httpcomponents-client-4.4.1/lib/commons-logging-1.2.jar ClientWithResponseHandler Executing request GET https://raw.githubusercontent.com/test HTTP/1.1 Exception in thread "main" javax.net.ssl.SSLPeerUnverifiedException: Host name 'raw.githubusercontent.com' does not match the certificate subject provided by the peer (CN=www.github.com, O="Fastly, Inc.", ST=California, L=San Francisco, C=US) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.verifyHostname(SSLConnectionSocketFactory.java:465) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:395) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:220) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:139) at ClientWithResponseHandler.main(ClientWithResponseHandler.java:69) {code} Of course, access to https://raw.githubusercontent.com/test works in Chrome 40 and Firefox 37. The certificate has many hosts : {code} Non critique Nom DNS: www.github.com Nom DNS: github.com Nom DNS: *.github.com Nom DNS: *.github.io Nom DNS: github.io Nom DNS: *.githubusercontent.com Nom DNS: githubusercontent.com {code} Maybe some few unit tests might be added to https://github.com/apache/httpclient/blob/a0b31445afb3da5aa91822535ab23f5713162a5e/httpclient/src/test/java/org/apache/http/conn/ssl/TestDefaultHostnameVerifier.java

    Apache's JIRA Issue Tracker | 2 years ago | Richard Bergoin
    javax.net.ssl.SSLPeerUnverifiedException: Host name 'raw.githubusercontent.com' does not match the certificate subject provided by the peer (CN=www.github.com, O="Fastly, Inc.", ST=California, L=San Francisco, C=US)
  2. 0

    Host verification fails for https://www.apis.google.com/ in spring social

    Stack Overflow | 2 years ago | Balaban Mario
    javax.net.ssl.SSLPeerUnverifiedException: Host name 'www.googleapis.com' does not match the certificate subject provided by the peer (CN=*.storage.googleapis.com, O=Google Inc, L=Mountain View, ST=California, C=US) This is the stack trace: Caused by: javax.net.ssl.SSLPeerUnverifiedException: Host name 'www.googleapis.com' does not match the certificate subject provided by the peer (CN=*.storage.googleapis.com, O=Google Inc, L=Mountain View, ST=California, C=US)
  3. 0

    javax.net.ssl.SSLPeerUnverifiedException: Host name does not match the certificate subject provided by the peer

    Stack Overflow | 11 months ago
    javax.net.ssl.SSLPeerUnverifiedException: Host name 'XXXXXXXXX' does not match the certificate subject provided by the peer (CN=localhost, O=WSO2, L=Mountain View, ST=CA, C=US)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Can't call EWS service with API Java SSL and certificates

    Stack Overflow | 1 year ago | alibenmessaoud
    microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException: The request failed. The request failed. Host name '192.168.1.59' does not match the certificate subject provided by the peer (CN=WIN-NS09AI4QBB8)
  6. 0

    The request failed.Host name does not match the certificate subject provided by the peer

    GitHub | 1 year ago | 805728578
    com.wafersystems.exchange.core.exception.service.remote.ServiceRequestException: The request failed. The request failed. Host name '192.168.0.168' does not match the certificate subject provided by the peer (CN=exchange)

  1. Arne Jans 1 times, last 9 months ago
2 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. javax.net.ssl.SSLPeerUnverifiedException

    Host name 'raw.githubusercontent.com' does not match the certificate subject provided by the peer (CN=www.github.com, O="Fastly, Inc.", ST=California, L=San Francisco, C=US)

    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.verifyHostname()
  2. Apache HttpClient
    CloseableHttpClient.execute
    1. org.apache.http.conn.ssl.SSLConnectionSocketFactory.verifyHostname(SSLConnectionSocketFactory.java:465)
    2. org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:395)
    3. org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
    4. org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
    5. org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
    6. org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
    7. org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
    8. org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
    9. org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
    10. org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    11. org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    12. org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
    13. org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:220)
    14. org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164)
    15. org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:139)
    15 frames
  3. Unknown
    ClientWithResponseHandler.main
    1. ClientWithResponseHandler.main(ClientWithResponseHandler.java:69)
    1 frame