hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject HttpCore NIO, NHttpReverseProxy and diagnosing an SSL handshake_failure
Date Wed, 30 Aug 2017 20:57:53 GMT
Hi All:

To diagnose a problem I am seeing in my custom HC-NIO proxy, I run our
example NHttpReverseProxy with the command line arguments:

https://jsonplaceholder.typicode.com:443/ 33000 TrustSelfSignedStrategy

(with or without TrustSelfSignedStrategy)

Then I get a handshake_failure trying to access it:

$ curl http://localhost:33000/posts
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
 Current
                                 Dload  Upload   Total   Spent    Left
 Speed
100    39  100    39    0     0     39      0  0:00:01 --:--:--  0:00:01
207Received fatal alert: handshake_failure

NHttpReverseProxy prints:

Using TrustSelfSignedStrategy (not for production)
Reverse proxy to https://jsonplaceholder.typicode.com:443
[client->proxy] connection open
0:0:0:0:0:0:0:1:33000<->0:0:0:0:0:0:0:1:55252
[client->proxy] 00000001 GET /posts HTTP/1.1
[client->proxy] 00000001 request completed
[proxy->origin] connection open 192.168.0.92:55254<->104.31.87.157:443
[proxy->origin] 00000001 GET /posts HTTP/1.1
[proxy->origin] 00000001 request completed
[client<-proxy] 00000001 javax.net.ssl.SSLException: Received fatal alert:
handshake_failure
[proxy->origin] connection released 0.0.0.0:55254<->104.31.87.157:443
[proxy->origin] [total kept alive: 0; total allocated: 0 of 100]
[proxy->origin] connection closed 0.0.0.0:55254<->104.31.87.157:443
[client->proxy] connection closed 0.0.0.0:33000<->0:0:0:0:0:0:0:1:55252

HttpClient works fine with:

public class HttpsClientSanityTest {

    private void executeHttpsGetPosts(final CloseableHttpClient client)
throws IOException, ClientProtocolException {
        try (final CloseableHttpResponse reponse = client.execute(new
HttpGet("https://jsonplaceholder.typicode.com/posts"))) {
            final String string = EntityUtils.toString(reponse.getEntity());
            Assert.assertNotNull(string);
            // System.out.println(string);
        }
    }

    @Test
    public void test_typicode_com() throws KeyManagementException,
NoSuchAlgorithmException, ClientProtocolException, IOException {
        try (final CloseableHttpClient client =
HttpClients.createDefault()) {
            executeHttpsGetPosts(client);
        }
    }
}

curl works fine with 'curl https://jsonplaceholder.typicode.com/posts' and
returns a JSON document.

Any hints as to what is missing from NHttpReverseProxy?

Thank you,
Gary

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message