You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Petar Tahchiev <pa...@gmail.com> on 2023/08/10 19:13:41 UTC

How Do I Set SNI(Server Name Indentification)

Hello,

I am facing a very weird issue. I have a project that uses HttpClient4 to
make a simple GET request to Apache Tomcat. It was all working fine.

Now I need to upgrade to HttpClient5. I managed to upgrade very easy - just
a small package renames. However when I make the same request the tomcat
never responds so eventually the HttpClient throws SocketTimeout exception.

I enabled the tomcat server logs and then I tried CURL - works fine and I
see this line in the tomcat logs:

 2023-08-10 21:34:05,101 org.apache.tomcat.util.net.SecureNioChannel
[https-jsse-nio-0.0.0.0-8112-exec-2] DEBUG: The SNI host name extracted for
connection [java.nio.channels.SocketChannel[connected local=/127.0.0.1:8112
remote=/127.0.0.1:55478]] was [localhost]


when I run it with HttpClient5 I see the SNI host name is null and that
seems to me like the only difference.
I found this gist which tells how to provide a SNI:

https://gist.github.com/jkuipers/e0b35c21c466a9b4d88a

but it is for HttpClient4 and I am unable to migrate the code to
HttpClient5.

So my question is: Is there a way to provide a SNI host name?

Thank you
-- 
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611

Re: How Do I Set SNI(Server Name Indentification)

Posted by Gary Gregory <ga...@gmail.com>.
Hi Peter,

If we can improve our migration guide, then I'm all for it. I'm not sure
how to condense this into a simple before and after example though.

Gary

On Fri, Aug 11, 2023, 8:01 AM Petar Tahchiev <pa...@gmail.com> wrote:

> Hi Oleg,
> sorry but I am new with this. "This, of course, is not going to work" -
> what is not going to work and why not?
>
> "You need to pass HttpHost with the IP address of the physical endpoint.
> This cannot be done with Simple* messages. They are simple for a reason." -
> I don't understand this. Where do I need to pass the HttpHost? And why? The
> documentation here says nothing about HttpHost:
>
> https://hc.apache.org/httpcomponents-client-5.2.x/migration-guide/migration-to-async-simple.html
>
> На пт, 11.08.2023 г. в 13:48 ч. Oleg Kalnichevski <ol...@apache.org>
> написа:
>
> > On Fri, 2023-08-11 at 13:08 +0300, Petar Tahchiev wrote:
> > > Hello,
> > >
> > > so I'm getting closer. Because I was
> > > using PoolingAsyncClientConnectionManager I decided to replace it
> > > with PoolingHttpClientConnectionManager and it worked. So the problem
> > > is
> > > not in the SNI but in the PoolingAsyncClientConnectionManager. I am
> > > following this guide exactly:
> > >
> >
> https://hc.apache.org/httpcomponents-client-5.2.x/migration-guide/migration-to-async-simple.html
> > >
> > > and I don't know what to do - I always get
> > > org.apache.hc.core5.util.TimeoutValueException.
> > >
> > > This is my code:
> >
> > This, of course, is not going to work. You need to pass HttpHost with
> > the IP address of the physical endpoint. This cannot be done with
> > Simple* messages. They are simple for a reason.
> >
> > Oleg
> >
> >
> >
> > > ---------------------------------------------------------------------
> > > ---------------------------------------------------------------------
> > > ----------
> > > try {
> > >             final SSLContext sslcontext =
> > > SSLContexts.custom().loadTrustMaterial((chain, authType) ->
> > > true).build();
> > >
> > >             int timeout = 15;
> > >
> > >             PoolingAsyncClientConnectionManager ccm =
> > > PoolingAsyncClientConnectionManagerBuilder.create().setTlsStrategy(Cl
> > > ientTlsStrategyBuilder.create()
> > >                     .setSslContext(sslcontext)
> > >                     .setTlsVersions(TLS.V_1_2)
> > >                     .setHostnameVerifier(
> > >                         NoopHostnameVerifier.INSTANCE)
> > >                     .build())
> > >
> > > .setConnectionTimeToLive(TimeValue.ofMinutes(1L)).build();
> > >
> > >             try (CloseableHttpAsyncClient httpclient =
> > > HttpAsyncClients.custom().setConnectionManager(ccm).setDefaultRequest
> > > Config(
> > >
> > > RequestConfig.custom().setConnectTimeout(Timeout.ofSeconds(timeout)).
> > > setResponseTimeout(Timeout.ofSeconds(timeout))
> > >
> > > .setCookieSpec("STANDARD_STRICT").build()).setVersionPolicy(HttpVersi
> > > onPolicy.NEGOTIATE).build())
> > > {
> > >
> > >                 httpclient.start();
> > >
> > >                 SimpleHttpRequest httpGet =
> > > SimpleHttpRequests.get(new
> > > URI(restBaseUrl + "auth"));
> > >                 httpGet.setHeader("X-Nemesis-Username", username);
> > >                 httpGet.setHeader("X-Nemesis-Password", password);
> > >
> > >                 Future<SimpleHttpResponse> future =
> > > httpclient.execute(httpGet, null);
> > >
> > >                 SimpleHttpResponse response = future.get(timeout,
> > > TimeUnit.SECONDS);
> > >
> > >                 final String responseText =
> > > response.getBody().getBodyText();
> > > ---------------------------------------------------------------------
> > > ---------------------------------------------------------------------
> > > ----------
> > > and the worst part is I don't know how to debug it.
> > > Here's the log:
> > >
> > > =====================================================================
> > > ================
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > ex-00000002: preparing request execution
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > Cookie
> > > spec selected: STANDARD_STRICT
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > Unsupported cookie spec: STANDARD_STRICT
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > Auth
> > > cache not set in the context
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > ex-00000002: target auth state: UNCHALLENGED
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > ex-00000002: proxy auth state: UNCHALLENGED
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > ex-00000002: acquiring connection with route {s}-
> > > >https://localhost:8112
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > ex-00000002: acquiring endpoint (3 MINUTES)
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > ex-00000002: endpoint lease request (3 MINUTES) [route:
> > > {s}->https://localhost:8112][total available: 0; route allocated: 0
> > > of 5;
> > > total allocated: 0 of 25]
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > ex-00000002: endpoint leased [route: {s}-
> > > >https://localhost:8112][total
> > > available: 0; route allocated: 1 of 5; total allocated: 1 of 25]
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > ex-00000002: acquired ep-00000001
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > ex-00000002: acquired endpoint ep-00000001
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > ep-00000001: connecting endpoint (15 SECONDS)
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > ep-00000001: connecting endpoint to https://localhost:8112 (15
> > > SECONDS)
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > https://localhost:8112: resolving remote address
> > > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > https://localhost:8112: resolved to [localhost/127.0.0.1]
> > > 2023-08-11 13:07:14,877 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > https://localhost:8112: connecting null to localhost/127.0.0.1:8112
> > > (15
> > > SECONDS)
> > > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG:
> > > https://localhost:8112: connected c-0000000001 /127.0.0.1:52420-
> > > >localhost/
> > > 127.0.0.1:8112
> > > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: c-0000000001:
> > > start
> > > TLS
> > > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > > connected c-0000000001
> > > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > > endpoint connected
> > > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
> > > connected to target
> > > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
> > > route
> > > fully established
> > > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
> > > executing GET /storefront/rest/auth HTTP/1.1
> > > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > > start
> > > execution ex-00000002
> > > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > > executing exchange ex-00000002 over c-0000000001
> > > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: c-0000000001:
> > > RequestExecutionCommand with NORMAL priority
> > > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG:
> > > c-0000000001[ACTIVE][rwc:c][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]
> > > Enqueued
> > > RequestExecutionCommand with priority IMMEDIATE
> > > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > c-0000000001[ACTIVE][rw:c][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]:
> > > Event
> > > cleared [c]
> > > 2023-08-11 13:07:14,878 [httpclient-dispatch-1] DEBUG: Enabled
> > > protocols:
> > > [TLSv1.2]
> > > 2023-08-11 13:07:14,878 [httpclient-dispatch-1] DEBUG: Enabled cipher
> > > suites:[TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256,
> > > TLS_CHACHA20_POLY1305_SHA256,
> > > TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
> > > TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
> > > TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,
> > > TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
> > > TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
> > > TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
> > > TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,
> > > TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
> > > TLS_DHE_DSS_WITH_AES_256_GCM_SHA384,
> > > TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,
> > > TLS_DHE_DSS_WITH_AES_128_GCM_SHA256,
> > > TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,
> > > TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,
> > > TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
> > > TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
> > > TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,
> > > TLS_DHE_DSS_WITH_AES_256_CBC_SHA256,
> > > TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,
> > > TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,
> > > TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,
> > > TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384,
> > > TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,
> > > TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256,
> > > TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384,
> > > TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384,
> > > TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256,
> > > TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256,
> > > TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
> > > TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
> > > TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
> > > TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA,
> > > TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
> > > TLS_DHE_DSS_WITH_AES_128_CBC_SHA,
> > > TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
> > > TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,
> > > TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
> > > TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384,
> > > TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256,
> > > TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA,
> > > TLS_RSA_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
> > > 2023-08-11 13:07:14,898 [httpclient-dispatch-1] DEBUG: Secure session
> > > established
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  negotiated
> > > protocol: TLSv1.2
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  negotiated
> > > cipher
> > > suite: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  peer
> > > principal:
> > > CN=Nemesis Software, OU=Development, O=Nemesis Software, L=Sofia,
> > > ST=Sofia,
> > > C=BG
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  peer
> > > alternative
> > > names: [localhost, 127.0.0.1]
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  issuer
> > > principal:
> > > CN=Nemesis Software, OU=Development, O=Nemesis Software, L=Sofia,
> > > ST=Sofia,
> > > C=BG
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: ex-00000002:
> > > send
> > > request GET /storefront/rest/auth HTTP/1.1, null entity
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > >> GET
> > > /storefront/rest/auth HTTP/1.1
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > >>
> > > X-Nemesis-Username: admin
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > >>
> > > X-Nemesis-Password: nimda
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > >>
> > > User-Agent: Apache-HttpAsyncClient/5.0.2 (Java/17)
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > >>
> > > Host: localhost:8112
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > >>
> > > Connection: keep-alive
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > c-0000000001[ACTIVE][r:r][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]: 190
> > > bytes
> > > written
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > >> "GET
> > > /storefront/rest/auth HTTP/1.1[\r][\n]"
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > >>
> > > "X-Nemesis-Username: admin[\r][\n]"
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > >>
> > > "X-Nemesis-Password: nimda[\r][\n]"
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > >>
> > > "User-Agent: Apache-HttpAsyncClient/5.0.2 (Java/17)[\r][\n]"
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > >>
> > > "Host: localhost:8112[\r][\n]"
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > >>
> > > "Connection: keep-alive[\r][\n]"
> > > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > >>
> > > "[\r][\n]"
> > > 2023-08-11 13:07:14,900 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > c-0000000001[ACTIVE][rw:r][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]:
> > > Event set
> > > [w]
> > > 2023-08-11 13:07:14,900 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > c-0000000001[ACTIVE][r:r][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Event
> > > cleared [w]
> > > 2023-08-11 13:07:14,900 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > c-0000000001[ACTIVE][r:r][ACTIVE][r][NOT_HANDSHAKING][44][15][0]: 0
> > > bytes
> > > read
> > > 2023-08-11 13:07:29,877 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > Shutdown GRACEFUL
> > > 2023-08-11 13:07:29,877 [httpclient-dispatch-1] DEBUG:
> > > c-0000000001[ACTIVE][rw:r][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]
> > > Enqueued
> > > ShutdownCommand with priority IMMEDIATE
> > > 2023-08-11 13:07:29,877 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > c-0000000001[ACTIVE][r:w][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Event
> > > cleared [w]
> > > 2023-08-11 13:07:29,877 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > c-0000000001[ACTIVE][rw:w][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]:
> > > Event set
> > > [w]
> > > 2023-08-11 13:07:29,878 [httpclient-dispatch-1] DEBUG: c-0000000001
> > > c-0000000001[ACTIVE][r:w][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Event
> > > cleared [w]
> > > 2023-08-11 13:07:34,877 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > c-0000000001
> > > c-0000000001[ACTIVE][r:w][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Close
> > > GRACEFUL
> > > 2023-08-11 13:07:34,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
> > > execution failed: Connection is closed
> > > 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > Shutdown connection pool GRACEFUL
> > > 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ex-00000002:
> > > request
> > > failed: Connection is closed
> > > 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > c-0000000001: Shutdown connection GRACEFUL
> > > 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > > close
> > > IMMEDIATE
> > > 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > > Connection pool shut down
> > > 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > > endpoint closed
> > > 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > > discarding endpoint
> > > 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > > releasing endpoint
> > > 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > > connection released [route: {s}-
> > > >https://localhost:8112][total available:
> > > 0; route allocated: 0 of 5; total allocated: 0 of 25]
> > > 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] ERROR:
> > > Timeout
> > > deadline: 15000 MILLISECONDS, actual: 15000 MILLISECONDS
> > > org.apache.hc.core5.util.TimeoutValueException: Timeout deadline:
> > > 15000
> > > MILLISECONDS, actual: 15000 MILLISECONDS
> > > at
> > > org.apache.hc.core5.util.TimeoutValueException.fromMilliseconds(Timeo
> > > utValueException.java:49)
> > > at
> > > org.apache.hc.core5.concurrent.BasicFuture.get(BasicFuture.java:107)
> > > at
> > > io.nemesis.console.backend.storefront.DefaultRestAuthenticationProvid
> > > er.authenticate(DefaultRestAuthenticationProvider.java:114)
> > > at
> > > org.springframework.security.authentication.ProviderManager.authentic
> > > ate(ProviderManager.java:182)
> > > at
> > > org.springframework.security.authentication.ProviderManager.authentic
> > > ate(ProviderManager.java:201)
> > > at
> > > org.springframework.security.web.authentication.UsernamePasswordAuthe
> > > nticationFilter.attemptAuthentication(UsernamePasswordAuthenticationF
> > > ilter.java:85)
> > > at
> > > org.springframework.security.web.authentication.AbstractAuthenticatio
> > > nProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.jav
> > > a:231)
> > > at
> > > org.springframework.security.web.authentication.AbstractAuthenticatio
> > > nProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.jav
> > > a:221)
> > > at
> > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > > doFilter(FilterChainProxy.java:361)
> > > at
> > > org.springframework.security.web.authentication.logout.LogoutFilter.d
> > > oFilter(LogoutFilter.java:107)
> > > at
> > > org.springframework.security.web.authentication.logout.LogoutFilter.d
> > > oFilter(LogoutFilter.java:93)
> > > at
> > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > > doFilter(FilterChainProxy.java:361)
> > > at
> > > org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(Csr
> > > fFilter.java:132)
> > > at
> > > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > > equestFilter.java:117)
> > > at
> > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > > doFilter(FilterChainProxy.java:361)
> > > at
> > > org.springframework.security.web.context.SecurityContextPersistenceFi
> > > lter.doFilter(SecurityContextPersistenceFilter.java:117)
> > > at
> > > org.springframework.security.web.context.SecurityContextPersistenceFi
> > > lter.doFilter(SecurityContextPersistenceFilter.java:87)
> > > at
> > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > > doFilter(FilterChainProxy.java:361)
> > > at
> > > org.springframework.security.web.context.request.async.WebAsyncManage
> > > rIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.
> > > java:62)
> > > at
> > > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > > equestFilter.java:117)
> > > at
> > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > > doFilter(FilterChainProxy.java:361)
> > > at
> > > org.springframework.security.web.session.DisableEncodeUrlFilter.doFil
> > > terInternal(DisableEncodeUrlFilter.java:42)
> > > at
> > > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > > equestFilter.java:117)
> > > at
> > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > > doFilter(FilterChainProxy.java:361)
> > > at
> > > org.springframework.security.web.FilterChainProxy.doFilterInternal(Fi
> > > lterChainProxy.java:225)
> > > at
> > > org.springframework.security.web.FilterChainProxy.doFilter(FilterChai
> > > nProxy.java:190)
> > > at
> > > org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(D
> > > elegatingFilterProxy.java:354)
> > > at
> > > org.springframework.web.filter.DelegatingFilterProxy.doFilter(Delegat
> > > ingFilterProxy.java:267)
> > > at
> > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> > > icationFilterChain.java:189)
> > > at
> > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> > > ilterChain.java:162)
> > > at
> > > org.springframework.web.filter.CharacterEncodingFilter.doFilterIntern
> > > al(CharacterEncodingFilter.java:201)
> > > at
> > > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > > equestFilter.java:117)
> > > at
> > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> > > icationFilterChain.java:189)
> > > at
> > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> > > ilterChain.java:162)
> > > at
> > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
> > > alve.java:177)
> > > at
> > > org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
> > > alve.java:97)
> > > at
> > > org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
> > > torBase.java:541)
> > > at
> > > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
> > > ava:135)
> > > at
> > > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
> > > ava:92)
> > > at
> > > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
> > > ve.java:78)
> > > at
> > > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
> > > a:360)
> > > at
> > > org.apache.coyote.http11.Http11Processor.service(Http11Processor.java
> > > :399)
> > > at
> > > org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLig
> > > ht.java:65)
> > > at
> > > org.apache.coyote.AbstractProtocol$ConnectionHandler.process(Abstract
> > > Protocol.java:891)
> > > at
> > > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpo
> > > int.java:1784)
> > > at
> > > org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBas
> > > e.java:49)
> > > at
> > > org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoo
> > > lExecutor.java:1191)
> > > at
> > > org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPo
> > > olExecutor.java:659)
> > > at
> > > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh
> > > read.java:61)
> > > at java.base/java.lang.Thread.run(Thread.java:833)
> > > 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] ERROR:
> > > An
> > > internal error occurred while trying to authenticate the user.
> > > org.springframework.security.authentication.InternalAuthenticationSer
> > > viceException:
> > > Timeout deadline: 15000 MILLISECONDS, actual: 15000 MILLISECONDS
> > > at
> > > io.nemesis.console.backend.storefront.DefaultRestAuthenticationProvid
> > > er.authenticate(DefaultRestAuthenticationProvider.java:137)
> > > at
> > > org.springframework.security.authentication.ProviderManager.authentic
> > > ate(ProviderManager.java:182)
> > > at
> > > org.springframework.security.authentication.ProviderManager.authentic
> > > ate(ProviderManager.java:201)
> > > at
> > > org.springframework.security.web.authentication.UsernamePasswordAuthe
> > > nticationFilter.attemptAuthentication(UsernamePasswordAuthenticationF
> > > ilter.java:85)
> > > at
> > > org.springframework.security.web.authentication.AbstractAuthenticatio
> > > nProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.jav
> > > a:231)
> > > at
> > > org.springframework.security.web.authentication.AbstractAuthenticatio
> > > nProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.jav
> > > a:221)
> > > at
> > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > > doFilter(FilterChainProxy.java:361)
> > > at
> > > org.springframework.security.web.authentication.logout.LogoutFilter.d
> > > oFilter(LogoutFilter.java:107)
> > > at
> > > org.springframework.security.web.authentication.logout.LogoutFilter.d
> > > oFilter(LogoutFilter.java:93)
> > > at
> > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > > doFilter(FilterChainProxy.java:361)
> > > at
> > > org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(Csr
> > > fFilter.java:132)
> > > at
> > > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > > equestFilter.java:117)
> > > at
> > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > > doFilter(FilterChainProxy.java:361)
> > > at
> > > org.springframework.security.web.context.SecurityContextPersistenceFi
> > > lter.doFilter(SecurityContextPersistenceFilter.java:117)
> > > at
> > > org.springframework.security.web.context.SecurityContextPersistenceFi
> > > lter.doFilter(SecurityContextPersistenceFilter.java:87)
> > > at
> > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > > doFilter(FilterChainProxy.java:361)
> > > at
> > > org.springframework.security.web.context.request.async.WebAsyncManage
> > > rIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.
> > > java:62)
> > > at
> > > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > > equestFilter.java:117)
> > > at
> > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > > doFilter(FilterChainProxy.java:361)
> > > at
> > > org.springframework.security.web.session.DisableEncodeUrlFilter.doFil
> > > terInternal(DisableEncodeUrlFilter.java:42)
> > > at
> > > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > > equestFilter.java:117)
> > > at
> > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > > doFilter(FilterChainProxy.java:361)
> > > at
> > > org.springframework.security.web.FilterChainProxy.doFilterInternal(Fi
> > > lterChainProxy.java:225)
> > > at
> > > org.springframework.security.web.FilterChainProxy.doFilter(FilterChai
> > > nProxy.java:190)
> > > at
> > > org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(D
> > > elegatingFilterProxy.java:354)
> > > at
> > > org.springframework.web.filter.DelegatingFilterProxy.doFilter(Delegat
> > > ingFilterProxy.java:267)
> > > at
> > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> > > icationFilterChain.java:189)
> > > at
> > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> > > ilterChain.java:162)
> > > at
> > > org.springframework.web.filter.CharacterEncodingFilter.doFilterIntern
> > > al(CharacterEncodingFilter.java:201)
> > > at
> > > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > > equestFilter.java:117)
> > > at
> > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> > > icationFilterChain.java:189)
> > > at
> > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> > > ilterChain.java:162)
> > > at
> > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
> > > alve.java:177)
> > > at
> > > org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
> > > alve.java:97)
> > > at
> > > org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
> > > torBase.java:541)
> > > at
> > > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
> > > ava:135)
> > > at
> > > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
> > > ava:92)
> > > at
> > > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
> > > ve.java:78)
> > > at
> > > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
> > > a:360)
> > > at
> > > org.apache.coyote.http11.Http11Processor.service(Http11Processor.java
> > > :399)
> > > at
> > > org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLig
> > > ht.java:65)
> > > at
> > > org.apache.coyote.AbstractProtocol$ConnectionHandler.process(Abstract
> > > Protocol.java:891)
> > > at
> > > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpo
> > > int.java:1784)
> > > at
> > > org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBas
> > > e.java:49)
> > > at
> > > org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoo
> > > lExecutor.java:1191)
> > > at
> > > org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPo
> > > olExecutor.java:659)
> > > at
> > > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh
> > > read.java:61)
> > > at java.base/java.lang.Thread.run(Thread.java:833)
> > > =====================================================================
> > > ================
> > >
> > >
> > > На пт, 11.08.2023 г. в 10:58 ч. Oleg Kalnichevski <ol...@apache.org>
> > > написа:
> > >
> > > > On Thu, 2023-08-10 at 22:40 +0300, Petar Tahchiev wrote:
> > > > > Hmm,
> > > > >
> > > > > I tried now setting the Host header:
> > > > >
> > > > >
> > > > > httpGet.setHeader("Host", "localhost");
> > > > >
> > > > >
> > > >
> > > > This is wrong. You should not be doing that. You should let
> > > > HttpClient
> > > > generate the Host header when appropriate. HttpClient will also
> > > > automatically take care of SNI for you.
> > > >
> > > > Oleg
> > > >
> > > >
> > > > -------------------------------------------------------------------
> > > > --
> > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > > For additional commands, e-mail:
> > > > httpclient-users-help@hc.apache.org
> > > >
> > > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
> >
>
> --
> Regards, Petar!
> Karlovo, Bulgaria.
> ---
> Public PGP Key at:
> http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611
> Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
>

Re: How Do I Set SNI(Server Name Indentification)

Posted by Petar Tahchiev <pa...@gmail.com>.
Hi Oleg,
sorry but I am new with this. "This, of course, is not going to work" -
what is not going to work and why not?

"You need to pass HttpHost with the IP address of the physical endpoint.
This cannot be done with Simple* messages. They are simple for a reason." -
I don't understand this. Where do I need to pass the HttpHost? And why? The
documentation here says nothing about HttpHost:
https://hc.apache.org/httpcomponents-client-5.2.x/migration-guide/migration-to-async-simple.html

На пт, 11.08.2023 г. в 13:48 ч. Oleg Kalnichevski <ol...@apache.org> написа:

> On Fri, 2023-08-11 at 13:08 +0300, Petar Tahchiev wrote:
> > Hello,
> >
> > so I'm getting closer. Because I was
> > using PoolingAsyncClientConnectionManager I decided to replace it
> > with PoolingHttpClientConnectionManager and it worked. So the problem
> > is
> > not in the SNI but in the PoolingAsyncClientConnectionManager. I am
> > following this guide exactly:
> >
> https://hc.apache.org/httpcomponents-client-5.2.x/migration-guide/migration-to-async-simple.html
> >
> > and I don't know what to do - I always get
> > org.apache.hc.core5.util.TimeoutValueException.
> >
> > This is my code:
>
> This, of course, is not going to work. You need to pass HttpHost with
> the IP address of the physical endpoint. This cannot be done with
> Simple* messages. They are simple for a reason.
>
> Oleg
>
>
>
> > ---------------------------------------------------------------------
> > ---------------------------------------------------------------------
> > ----------
> > try {
> >             final SSLContext sslcontext =
> > SSLContexts.custom().loadTrustMaterial((chain, authType) ->
> > true).build();
> >
> >             int timeout = 15;
> >
> >             PoolingAsyncClientConnectionManager ccm =
> > PoolingAsyncClientConnectionManagerBuilder.create().setTlsStrategy(Cl
> > ientTlsStrategyBuilder.create()
> >                     .setSslContext(sslcontext)
> >                     .setTlsVersions(TLS.V_1_2)
> >                     .setHostnameVerifier(
> >                         NoopHostnameVerifier.INSTANCE)
> >                     .build())
> >
> > .setConnectionTimeToLive(TimeValue.ofMinutes(1L)).build();
> >
> >             try (CloseableHttpAsyncClient httpclient =
> > HttpAsyncClients.custom().setConnectionManager(ccm).setDefaultRequest
> > Config(
> >
> > RequestConfig.custom().setConnectTimeout(Timeout.ofSeconds(timeout)).
> > setResponseTimeout(Timeout.ofSeconds(timeout))
> >
> > .setCookieSpec("STANDARD_STRICT").build()).setVersionPolicy(HttpVersi
> > onPolicy.NEGOTIATE).build())
> > {
> >
> >                 httpclient.start();
> >
> >                 SimpleHttpRequest httpGet =
> > SimpleHttpRequests.get(new
> > URI(restBaseUrl + "auth"));
> >                 httpGet.setHeader("X-Nemesis-Username", username);
> >                 httpGet.setHeader("X-Nemesis-Password", password);
> >
> >                 Future<SimpleHttpResponse> future =
> > httpclient.execute(httpGet, null);
> >
> >                 SimpleHttpResponse response = future.get(timeout,
> > TimeUnit.SECONDS);
> >
> >                 final String responseText =
> > response.getBody().getBodyText();
> > ---------------------------------------------------------------------
> > ---------------------------------------------------------------------
> > ----------
> > and the worst part is I don't know how to debug it.
> > Here's the log:
> >
> > =====================================================================
> > ================
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > ex-00000002: preparing request execution
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > Cookie
> > spec selected: STANDARD_STRICT
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > Unsupported cookie spec: STANDARD_STRICT
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > Auth
> > cache not set in the context
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > ex-00000002: target auth state: UNCHALLENGED
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > ex-00000002: proxy auth state: UNCHALLENGED
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > ex-00000002: acquiring connection with route {s}-
> > >https://localhost:8112
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > ex-00000002: acquiring endpoint (3 MINUTES)
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > ex-00000002: endpoint lease request (3 MINUTES) [route:
> > {s}->https://localhost:8112][total available: 0; route allocated: 0
> > of 5;
> > total allocated: 0 of 25]
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > ex-00000002: endpoint leased [route: {s}-
> > >https://localhost:8112][total
> > available: 0; route allocated: 1 of 5; total allocated: 1 of 25]
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > ex-00000002: acquired ep-00000001
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > ex-00000002: acquired endpoint ep-00000001
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > ep-00000001: connecting endpoint (15 SECONDS)
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > ep-00000001: connecting endpoint to https://localhost:8112 (15
> > SECONDS)
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > https://localhost:8112: resolving remote address
> > 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > https://localhost:8112: resolved to [localhost/127.0.0.1]
> > 2023-08-11 13:07:14,877 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > https://localhost:8112: connecting null to localhost/127.0.0.1:8112
> > (15
> > SECONDS)
> > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG:
> > https://localhost:8112: connected c-0000000001 /127.0.0.1:52420-
> > >localhost/
> > 127.0.0.1:8112
> > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: c-0000000001:
> > start
> > TLS
> > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > connected c-0000000001
> > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > endpoint connected
> > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
> > connected to target
> > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
> > route
> > fully established
> > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
> > executing GET /storefront/rest/auth HTTP/1.1
> > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > start
> > execution ex-00000002
> > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > executing exchange ex-00000002 over c-0000000001
> > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: c-0000000001:
> > RequestExecutionCommand with NORMAL priority
> > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG:
> > c-0000000001[ACTIVE][rwc:c][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]
> > Enqueued
> > RequestExecutionCommand with priority IMMEDIATE
> > 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: c-0000000001
> > c-0000000001[ACTIVE][rw:c][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]:
> > Event
> > cleared [c]
> > 2023-08-11 13:07:14,878 [httpclient-dispatch-1] DEBUG: Enabled
> > protocols:
> > [TLSv1.2]
> > 2023-08-11 13:07:14,878 [httpclient-dispatch-1] DEBUG: Enabled cipher
> > suites:[TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256,
> > TLS_CHACHA20_POLY1305_SHA256,
> > TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
> > TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
> > TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,
> > TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
> > TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
> > TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
> > TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,
> > TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
> > TLS_DHE_DSS_WITH_AES_256_GCM_SHA384,
> > TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,
> > TLS_DHE_DSS_WITH_AES_128_GCM_SHA256,
> > TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,
> > TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,
> > TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
> > TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
> > TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,
> > TLS_DHE_DSS_WITH_AES_256_CBC_SHA256,
> > TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,
> > TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,
> > TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,
> > TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384,
> > TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,
> > TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256,
> > TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384,
> > TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384,
> > TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256,
> > TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256,
> > TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
> > TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
> > TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
> > TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA,
> > TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
> > TLS_DHE_DSS_WITH_AES_128_CBC_SHA,
> > TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
> > TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,
> > TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
> > TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384,
> > TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256,
> > TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA,
> > TLS_RSA_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
> > 2023-08-11 13:07:14,898 [httpclient-dispatch-1] DEBUG: Secure session
> > established
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  negotiated
> > protocol: TLSv1.2
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  negotiated
> > cipher
> > suite: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  peer
> > principal:
> > CN=Nemesis Software, OU=Development, O=Nemesis Software, L=Sofia,
> > ST=Sofia,
> > C=BG
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  peer
> > alternative
> > names: [localhost, 127.0.0.1]
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  issuer
> > principal:
> > CN=Nemesis Software, OU=Development, O=Nemesis Software, L=Sofia,
> > ST=Sofia,
> > C=BG
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: ex-00000002:
> > send
> > request GET /storefront/rest/auth HTTP/1.1, null entity
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > >> GET
> > /storefront/rest/auth HTTP/1.1
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > >>
> > X-Nemesis-Username: admin
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > >>
> > X-Nemesis-Password: nimda
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > >>
> > User-Agent: Apache-HttpAsyncClient/5.0.2 (Java/17)
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > >>
> > Host: localhost:8112
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > >>
> > Connection: keep-alive
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > c-0000000001[ACTIVE][r:r][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]: 190
> > bytes
> > written
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > >> "GET
> > /storefront/rest/auth HTTP/1.1[\r][\n]"
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > >>
> > "X-Nemesis-Username: admin[\r][\n]"
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > >>
> > "X-Nemesis-Password: nimda[\r][\n]"
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > >>
> > "User-Agent: Apache-HttpAsyncClient/5.0.2 (Java/17)[\r][\n]"
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > >>
> > "Host: localhost:8112[\r][\n]"
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > >>
> > "Connection: keep-alive[\r][\n]"
> > 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> > >>
> > "[\r][\n]"
> > 2023-08-11 13:07:14,900 [httpclient-dispatch-1] DEBUG: c-0000000001
> > c-0000000001[ACTIVE][rw:r][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]:
> > Event set
> > [w]
> > 2023-08-11 13:07:14,900 [httpclient-dispatch-1] DEBUG: c-0000000001
> > c-0000000001[ACTIVE][r:r][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Event
> > cleared [w]
> > 2023-08-11 13:07:14,900 [httpclient-dispatch-1] DEBUG: c-0000000001
> > c-0000000001[ACTIVE][r:r][ACTIVE][r][NOT_HANDSHAKING][44][15][0]: 0
> > bytes
> > read
> > 2023-08-11 13:07:29,877 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > Shutdown GRACEFUL
> > 2023-08-11 13:07:29,877 [httpclient-dispatch-1] DEBUG:
> > c-0000000001[ACTIVE][rw:r][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]
> > Enqueued
> > ShutdownCommand with priority IMMEDIATE
> > 2023-08-11 13:07:29,877 [httpclient-dispatch-1] DEBUG: c-0000000001
> > c-0000000001[ACTIVE][r:w][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Event
> > cleared [w]
> > 2023-08-11 13:07:29,877 [httpclient-dispatch-1] DEBUG: c-0000000001
> > c-0000000001[ACTIVE][rw:w][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]:
> > Event set
> > [w]
> > 2023-08-11 13:07:29,878 [httpclient-dispatch-1] DEBUG: c-0000000001
> > c-0000000001[ACTIVE][r:w][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Event
> > cleared [w]
> > 2023-08-11 13:07:34,877 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > c-0000000001
> > c-0000000001[ACTIVE][r:w][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Close
> > GRACEFUL
> > 2023-08-11 13:07:34,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
> > execution failed: Connection is closed
> > 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > Shutdown connection pool GRACEFUL
> > 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ex-00000002:
> > request
> > failed: Connection is closed
> > 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > c-0000000001: Shutdown connection GRACEFUL
> > 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > close
> > IMMEDIATE
> > 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> > Connection pool shut down
> > 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > endpoint closed
> > 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > discarding endpoint
> > 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > releasing endpoint
> > 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> > connection released [route: {s}-
> > >https://localhost:8112][total available:
> > 0; route allocated: 0 of 5; total allocated: 0 of 25]
> > 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] ERROR:
> > Timeout
> > deadline: 15000 MILLISECONDS, actual: 15000 MILLISECONDS
> > org.apache.hc.core5.util.TimeoutValueException: Timeout deadline:
> > 15000
> > MILLISECONDS, actual: 15000 MILLISECONDS
> > at
> > org.apache.hc.core5.util.TimeoutValueException.fromMilliseconds(Timeo
> > utValueException.java:49)
> > at
> > org.apache.hc.core5.concurrent.BasicFuture.get(BasicFuture.java:107)
> > at
> > io.nemesis.console.backend.storefront.DefaultRestAuthenticationProvid
> > er.authenticate(DefaultRestAuthenticationProvider.java:114)
> > at
> > org.springframework.security.authentication.ProviderManager.authentic
> > ate(ProviderManager.java:182)
> > at
> > org.springframework.security.authentication.ProviderManager.authentic
> > ate(ProviderManager.java:201)
> > at
> > org.springframework.security.web.authentication.UsernamePasswordAuthe
> > nticationFilter.attemptAuthentication(UsernamePasswordAuthenticationF
> > ilter.java:85)
> > at
> > org.springframework.security.web.authentication.AbstractAuthenticatio
> > nProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.jav
> > a:231)
> > at
> > org.springframework.security.web.authentication.AbstractAuthenticatio
> > nProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.jav
> > a:221)
> > at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > doFilter(FilterChainProxy.java:361)
> > at
> > org.springframework.security.web.authentication.logout.LogoutFilter.d
> > oFilter(LogoutFilter.java:107)
> > at
> > org.springframework.security.web.authentication.logout.LogoutFilter.d
> > oFilter(LogoutFilter.java:93)
> > at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > doFilter(FilterChainProxy.java:361)
> > at
> > org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(Csr
> > fFilter.java:132)
> > at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > equestFilter.java:117)
> > at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > doFilter(FilterChainProxy.java:361)
> > at
> > org.springframework.security.web.context.SecurityContextPersistenceFi
> > lter.doFilter(SecurityContextPersistenceFilter.java:117)
> > at
> > org.springframework.security.web.context.SecurityContextPersistenceFi
> > lter.doFilter(SecurityContextPersistenceFilter.java:87)
> > at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > doFilter(FilterChainProxy.java:361)
> > at
> > org.springframework.security.web.context.request.async.WebAsyncManage
> > rIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.
> > java:62)
> > at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > equestFilter.java:117)
> > at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > doFilter(FilterChainProxy.java:361)
> > at
> > org.springframework.security.web.session.DisableEncodeUrlFilter.doFil
> > terInternal(DisableEncodeUrlFilter.java:42)
> > at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > equestFilter.java:117)
> > at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > doFilter(FilterChainProxy.java:361)
> > at
> > org.springframework.security.web.FilterChainProxy.doFilterInternal(Fi
> > lterChainProxy.java:225)
> > at
> > org.springframework.security.web.FilterChainProxy.doFilter(FilterChai
> > nProxy.java:190)
> > at
> > org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(D
> > elegatingFilterProxy.java:354)
> > at
> > org.springframework.web.filter.DelegatingFilterProxy.doFilter(Delegat
> > ingFilterProxy.java:267)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> > icationFilterChain.java:189)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> > ilterChain.java:162)
> > at
> > org.springframework.web.filter.CharacterEncodingFilter.doFilterIntern
> > al(CharacterEncodingFilter.java:201)
> > at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > equestFilter.java:117)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> > icationFilterChain.java:189)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> > ilterChain.java:162)
> > at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
> > alve.java:177)
> > at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
> > alve.java:97)
> > at
> > org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
> > torBase.java:541)
> > at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
> > ava:135)
> > at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
> > ava:92)
> > at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
> > ve.java:78)
> > at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
> > a:360)
> > at
> > org.apache.coyote.http11.Http11Processor.service(Http11Processor.java
> > :399)
> > at
> > org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLig
> > ht.java:65)
> > at
> > org.apache.coyote.AbstractProtocol$ConnectionHandler.process(Abstract
> > Protocol.java:891)
> > at
> > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpo
> > int.java:1784)
> > at
> > org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBas
> > e.java:49)
> > at
> > org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoo
> > lExecutor.java:1191)
> > at
> > org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPo
> > olExecutor.java:659)
> > at
> > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh
> > read.java:61)
> > at java.base/java.lang.Thread.run(Thread.java:833)
> > 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] ERROR:
> > An
> > internal error occurred while trying to authenticate the user.
> > org.springframework.security.authentication.InternalAuthenticationSer
> > viceException:
> > Timeout deadline: 15000 MILLISECONDS, actual: 15000 MILLISECONDS
> > at
> > io.nemesis.console.backend.storefront.DefaultRestAuthenticationProvid
> > er.authenticate(DefaultRestAuthenticationProvider.java:137)
> > at
> > org.springframework.security.authentication.ProviderManager.authentic
> > ate(ProviderManager.java:182)
> > at
> > org.springframework.security.authentication.ProviderManager.authentic
> > ate(ProviderManager.java:201)
> > at
> > org.springframework.security.web.authentication.UsernamePasswordAuthe
> > nticationFilter.attemptAuthentication(UsernamePasswordAuthenticationF
> > ilter.java:85)
> > at
> > org.springframework.security.web.authentication.AbstractAuthenticatio
> > nProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.jav
> > a:231)
> > at
> > org.springframework.security.web.authentication.AbstractAuthenticatio
> > nProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.jav
> > a:221)
> > at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > doFilter(FilterChainProxy.java:361)
> > at
> > org.springframework.security.web.authentication.logout.LogoutFilter.d
> > oFilter(LogoutFilter.java:107)
> > at
> > org.springframework.security.web.authentication.logout.LogoutFilter.d
> > oFilter(LogoutFilter.java:93)
> > at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > doFilter(FilterChainProxy.java:361)
> > at
> > org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(Csr
> > fFilter.java:132)
> > at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > equestFilter.java:117)
> > at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > doFilter(FilterChainProxy.java:361)
> > at
> > org.springframework.security.web.context.SecurityContextPersistenceFi
> > lter.doFilter(SecurityContextPersistenceFilter.java:117)
> > at
> > org.springframework.security.web.context.SecurityContextPersistenceFi
> > lter.doFilter(SecurityContextPersistenceFilter.java:87)
> > at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > doFilter(FilterChainProxy.java:361)
> > at
> > org.springframework.security.web.context.request.async.WebAsyncManage
> > rIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.
> > java:62)
> > at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > equestFilter.java:117)
> > at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > doFilter(FilterChainProxy.java:361)
> > at
> > org.springframework.security.web.session.DisableEncodeUrlFilter.doFil
> > terInternal(DisableEncodeUrlFilter.java:42)
> > at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > equestFilter.java:117)
> > at
> > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> > doFilter(FilterChainProxy.java:361)
> > at
> > org.springframework.security.web.FilterChainProxy.doFilterInternal(Fi
> > lterChainProxy.java:225)
> > at
> > org.springframework.security.web.FilterChainProxy.doFilter(FilterChai
> > nProxy.java:190)
> > at
> > org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(D
> > elegatingFilterProxy.java:354)
> > at
> > org.springframework.web.filter.DelegatingFilterProxy.doFilter(Delegat
> > ingFilterProxy.java:267)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> > icationFilterChain.java:189)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> > ilterChain.java:162)
> > at
> > org.springframework.web.filter.CharacterEncodingFilter.doFilterIntern
> > al(CharacterEncodingFilter.java:201)
> > at
> > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> > equestFilter.java:117)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> > icationFilterChain.java:189)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> > ilterChain.java:162)
> > at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
> > alve.java:177)
> > at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
> > alve.java:97)
> > at
> > org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
> > torBase.java:541)
> > at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
> > ava:135)
> > at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
> > ava:92)
> > at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
> > ve.java:78)
> > at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
> > a:360)
> > at
> > org.apache.coyote.http11.Http11Processor.service(Http11Processor.java
> > :399)
> > at
> > org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLig
> > ht.java:65)
> > at
> > org.apache.coyote.AbstractProtocol$ConnectionHandler.process(Abstract
> > Protocol.java:891)
> > at
> > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpo
> > int.java:1784)
> > at
> > org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBas
> > e.java:49)
> > at
> > org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoo
> > lExecutor.java:1191)
> > at
> > org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPo
> > olExecutor.java:659)
> > at
> > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh
> > read.java:61)
> > at java.base/java.lang.Thread.run(Thread.java:833)
> > =====================================================================
> > ================
> >
> >
> > На пт, 11.08.2023 г. в 10:58 ч. Oleg Kalnichevski <ol...@apache.org>
> > написа:
> >
> > > On Thu, 2023-08-10 at 22:40 +0300, Petar Tahchiev wrote:
> > > > Hmm,
> > > >
> > > > I tried now setting the Host header:
> > > >
> > > >
> > > > httpGet.setHeader("Host", "localhost");
> > > >
> > > >
> > >
> > > This is wrong. You should not be doing that. You should let
> > > HttpClient
> > > generate the Host header when appropriate. HttpClient will also
> > > automatically take care of SNI for you.
> > >
> > > Oleg
> > >
> > >
> > > -------------------------------------------------------------------
> > > --
> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail:
> > > httpclient-users-help@hc.apache.org
> > >
> > >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

-- 
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611

Re: How Do I Set SNI(Server Name Indentification)

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2023-08-11 at 13:08 +0300, Petar Tahchiev wrote:
> Hello,
> 
> so I'm getting closer. Because I was
> using PoolingAsyncClientConnectionManager I decided to replace it
> with PoolingHttpClientConnectionManager and it worked. So the problem
> is
> not in the SNI but in the PoolingAsyncClientConnectionManager. I am
> following this guide exactly:
> https://hc.apache.org/httpcomponents-client-5.2.x/migration-guide/migration-to-async-simple.html
> 
> and I don't know what to do - I always get
> org.apache.hc.core5.util.TimeoutValueException.
> 
> This is my code:

This, of course, is not going to work. You need to pass HttpHost with
the IP address of the physical endpoint. This cannot be done with
Simple* messages. They are simple for a reason.

Oleg



> ---------------------------------------------------------------------
> ---------------------------------------------------------------------
> ----------
> try {
>             final SSLContext sslcontext =
> SSLContexts.custom().loadTrustMaterial((chain, authType) ->
> true).build();
> 
>             int timeout = 15;
> 
>             PoolingAsyncClientConnectionManager ccm =
> PoolingAsyncClientConnectionManagerBuilder.create().setTlsStrategy(Cl
> ientTlsStrategyBuilder.create()
>                     .setSslContext(sslcontext)
>                     .setTlsVersions(TLS.V_1_2)
>                     .setHostnameVerifier(
>                         NoopHostnameVerifier.INSTANCE)
>                     .build())
>                
> .setConnectionTimeToLive(TimeValue.ofMinutes(1L)).build();
> 
>             try (CloseableHttpAsyncClient httpclient =
> HttpAsyncClients.custom().setConnectionManager(ccm).setDefaultRequest
> Config(
> 
> RequestConfig.custom().setConnectTimeout(Timeout.ofSeconds(timeout)).
> setResponseTimeout(Timeout.ofSeconds(timeout))
> 
> .setCookieSpec("STANDARD_STRICT").build()).setVersionPolicy(HttpVersi
> onPolicy.NEGOTIATE).build())
> {
> 
>                 httpclient.start();
> 
>                 SimpleHttpRequest httpGet =
> SimpleHttpRequests.get(new
> URI(restBaseUrl + "auth"));
>                 httpGet.setHeader("X-Nemesis-Username", username);
>                 httpGet.setHeader("X-Nemesis-Password", password);
> 
>                 Future<SimpleHttpResponse> future =
> httpclient.execute(httpGet, null);
> 
>                 SimpleHttpResponse response = future.get(timeout,
> TimeUnit.SECONDS);
> 
>                 final String responseText =
> response.getBody().getBodyText();
> ---------------------------------------------------------------------
> ---------------------------------------------------------------------
> ----------
> and the worst part is I don't know how to debug it.
> Here's the log:
> 
> =====================================================================
> ================
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> ex-00000002: preparing request execution
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> Cookie
> spec selected: STANDARD_STRICT
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> Unsupported cookie spec: STANDARD_STRICT
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> Auth
> cache not set in the context
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> ex-00000002: target auth state: UNCHALLENGED
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> ex-00000002: proxy auth state: UNCHALLENGED
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> ex-00000002: acquiring connection with route {s}-
> >https://localhost:8112
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> ex-00000002: acquiring endpoint (3 MINUTES)
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> ex-00000002: endpoint lease request (3 MINUTES) [route:
> {s}->https://localhost:8112][total available: 0; route allocated: 0
> of 5;
> total allocated: 0 of 25]
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> ex-00000002: endpoint leased [route: {s}-
> >https://localhost:8112][total
> available: 0; route allocated: 1 of 5; total allocated: 1 of 25]
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> ex-00000002: acquired ep-00000001
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> ex-00000002: acquired endpoint ep-00000001
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> ep-00000001: connecting endpoint (15 SECONDS)
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> ep-00000001: connecting endpoint to https://localhost:8112 (15
> SECONDS)
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> https://localhost:8112: resolving remote address
> 2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> https://localhost:8112: resolved to [localhost/127.0.0.1]
> 2023-08-11 13:07:14,877 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> https://localhost:8112: connecting null to localhost/127.0.0.1:8112
> (15
> SECONDS)
> 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG:
> https://localhost:8112: connected c-0000000001 /127.0.0.1:52420-
> >localhost/
> 127.0.0.1:8112
> 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: c-0000000001:
> start
> TLS
> 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
> connected c-0000000001
> 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
> endpoint connected
> 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
> connected to target
> 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
> route
> fully established
> 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
> executing GET /storefront/rest/auth HTTP/1.1
> 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
> start
> execution ex-00000002
> 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
> executing exchange ex-00000002 over c-0000000001
> 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: c-0000000001:
> RequestExecutionCommand with NORMAL priority
> 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG:
> c-0000000001[ACTIVE][rwc:c][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]
> Enqueued
> RequestExecutionCommand with priority IMMEDIATE
> 2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: c-0000000001
> c-0000000001[ACTIVE][rw:c][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]:
> Event
> cleared [c]
> 2023-08-11 13:07:14,878 [httpclient-dispatch-1] DEBUG: Enabled
> protocols:
> [TLSv1.2]
> 2023-08-11 13:07:14,878 [httpclient-dispatch-1] DEBUG: Enabled cipher
> suites:[TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256,
> TLS_CHACHA20_POLY1305_SHA256,
> TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
> TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
> TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,
> TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
> TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
> TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
> TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,
> TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
> TLS_DHE_DSS_WITH_AES_256_GCM_SHA384,
> TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,
> TLS_DHE_DSS_WITH_AES_128_GCM_SHA256,
> TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,
> TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,
> TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
> TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
> TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,
> TLS_DHE_DSS_WITH_AES_256_CBC_SHA256,
> TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,
> TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,
> TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,
> TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384,
> TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,
> TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256,
> TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384,
> TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384,
> TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256,
> TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256,
> TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
> TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
> TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
> TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA,
> TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
> TLS_DHE_DSS_WITH_AES_128_CBC_SHA,
> TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
> TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,
> TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
> TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384,
> TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256,
> TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA,
> TLS_RSA_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
> 2023-08-11 13:07:14,898 [httpclient-dispatch-1] DEBUG: Secure session
> established
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  negotiated
> protocol: TLSv1.2
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  negotiated
> cipher
> suite: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  peer
> principal:
> CN=Nemesis Software, OU=Development, O=Nemesis Software, L=Sofia,
> ST=Sofia,
> C=BG
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  peer
> alternative
> names: [localhost, 127.0.0.1]
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  issuer
> principal:
> CN=Nemesis Software, OU=Development, O=Nemesis Software, L=Sofia,
> ST=Sofia,
> C=BG
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: ex-00000002:
> send
> request GET /storefront/rest/auth HTTP/1.1, null entity
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> >> GET
> /storefront/rest/auth HTTP/1.1
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> >>
> X-Nemesis-Username: admin
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> >>
> X-Nemesis-Password: nimda
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> >>
> User-Agent: Apache-HttpAsyncClient/5.0.2 (Java/17)
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> >>
> Host: localhost:8112
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> >>
> Connection: keep-alive
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> c-0000000001[ACTIVE][r:r][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]: 190
> bytes
> written
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> >> "GET
> /storefront/rest/auth HTTP/1.1[\r][\n]"
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> >>
> "X-Nemesis-Username: admin[\r][\n]"
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> >>
> "X-Nemesis-Password: nimda[\r][\n]"
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> >>
> "User-Agent: Apache-HttpAsyncClient/5.0.2 (Java/17)[\r][\n]"
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> >>
> "Host: localhost:8112[\r][\n]"
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> >>
> "Connection: keep-alive[\r][\n]"
> 2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
> >>
> "[\r][\n]"
> 2023-08-11 13:07:14,900 [httpclient-dispatch-1] DEBUG: c-0000000001
> c-0000000001[ACTIVE][rw:r][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]:
> Event set
> [w]
> 2023-08-11 13:07:14,900 [httpclient-dispatch-1] DEBUG: c-0000000001
> c-0000000001[ACTIVE][r:r][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Event
> cleared [w]
> 2023-08-11 13:07:14,900 [httpclient-dispatch-1] DEBUG: c-0000000001
> c-0000000001[ACTIVE][r:r][ACTIVE][r][NOT_HANDSHAKING][44][15][0]: 0
> bytes
> read
> 2023-08-11 13:07:29,877 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> Shutdown GRACEFUL
> 2023-08-11 13:07:29,877 [httpclient-dispatch-1] DEBUG:
> c-0000000001[ACTIVE][rw:r][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]
> Enqueued
> ShutdownCommand with priority IMMEDIATE
> 2023-08-11 13:07:29,877 [httpclient-dispatch-1] DEBUG: c-0000000001
> c-0000000001[ACTIVE][r:w][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Event
> cleared [w]
> 2023-08-11 13:07:29,877 [httpclient-dispatch-1] DEBUG: c-0000000001
> c-0000000001[ACTIVE][rw:w][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]:
> Event set
> [w]
> 2023-08-11 13:07:29,878 [httpclient-dispatch-1] DEBUG: c-0000000001
> c-0000000001[ACTIVE][r:w][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Event
> cleared [w]
> 2023-08-11 13:07:34,877 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> c-0000000001
> c-0000000001[ACTIVE][r:w][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Close
> GRACEFUL
> 2023-08-11 13:07:34,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
> execution failed: Connection is closed
> 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> Shutdown connection pool GRACEFUL
> 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ex-00000002:
> request
> failed: Connection is closed
> 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> c-0000000001: Shutdown connection GRACEFUL
> 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> close
> IMMEDIATE
> 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
> Connection pool shut down
> 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> endpoint closed
> 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> discarding endpoint
> 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> releasing endpoint
> 2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
> connection released [route: {s}-
> >https://localhost:8112][total available:
> 0; route allocated: 0 of 5; total allocated: 0 of 25]
> 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] ERROR:
> Timeout
> deadline: 15000 MILLISECONDS, actual: 15000 MILLISECONDS
> org.apache.hc.core5.util.TimeoutValueException: Timeout deadline:
> 15000
> MILLISECONDS, actual: 15000 MILLISECONDS
> at
> org.apache.hc.core5.util.TimeoutValueException.fromMilliseconds(Timeo
> utValueException.java:49)
> at
> org.apache.hc.core5.concurrent.BasicFuture.get(BasicFuture.java:107)
> at
> io.nemesis.console.backend.storefront.DefaultRestAuthenticationProvid
> er.authenticate(DefaultRestAuthenticationProvider.java:114)
> at
> org.springframework.security.authentication.ProviderManager.authentic
> ate(ProviderManager.java:182)
> at
> org.springframework.security.authentication.ProviderManager.authentic
> ate(ProviderManager.java:201)
> at
> org.springframework.security.web.authentication.UsernamePasswordAuthe
> nticationFilter.attemptAuthentication(UsernamePasswordAuthenticationF
> ilter.java:85)
> at
> org.springframework.security.web.authentication.AbstractAuthenticatio
> nProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.jav
> a:231)
> at
> org.springframework.security.web.authentication.AbstractAuthenticatio
> nProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.jav
> a:221)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> doFilter(FilterChainProxy.java:361)
> at
> org.springframework.security.web.authentication.logout.LogoutFilter.d
> oFilter(LogoutFilter.java:107)
> at
> org.springframework.security.web.authentication.logout.LogoutFilter.d
> oFilter(LogoutFilter.java:93)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> doFilter(FilterChainProxy.java:361)
> at
> org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(Csr
> fFilter.java:132)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> equestFilter.java:117)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> doFilter(FilterChainProxy.java:361)
> at
> org.springframework.security.web.context.SecurityContextPersistenceFi
> lter.doFilter(SecurityContextPersistenceFilter.java:117)
> at
> org.springframework.security.web.context.SecurityContextPersistenceFi
> lter.doFilter(SecurityContextPersistenceFilter.java:87)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> doFilter(FilterChainProxy.java:361)
> at
> org.springframework.security.web.context.request.async.WebAsyncManage
> rIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.
> java:62)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> equestFilter.java:117)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> doFilter(FilterChainProxy.java:361)
> at
> org.springframework.security.web.session.DisableEncodeUrlFilter.doFil
> terInternal(DisableEncodeUrlFilter.java:42)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> equestFilter.java:117)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> doFilter(FilterChainProxy.java:361)
> at
> org.springframework.security.web.FilterChainProxy.doFilterInternal(Fi
> lterChainProxy.java:225)
> at
> org.springframework.security.web.FilterChainProxy.doFilter(FilterChai
> nProxy.java:190)
> at
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(D
> elegatingFilterProxy.java:354)
> at
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(Delegat
> ingFilterProxy.java:267)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:189)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:162)
> at
> org.springframework.web.filter.CharacterEncodingFilter.doFilterIntern
> al(CharacterEncodingFilter.java:201)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> equestFilter.java:117)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:189)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:162)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
> alve.java:177)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
> alve.java:97)
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
> torBase.java:541)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
> ava:135)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
> ava:92)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
> ve.java:78)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
> a:360)
> at
> org.apache.coyote.http11.Http11Processor.service(Http11Processor.java
> :399)
> at
> org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLig
> ht.java:65)
> at
> org.apache.coyote.AbstractProtocol$ConnectionHandler.process(Abstract
> Protocol.java:891)
> at
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpo
> int.java:1784)
> at
> org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBas
> e.java:49)
> at
> org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoo
> lExecutor.java:1191)
> at
> org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPo
> olExecutor.java:659)
> at
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh
> read.java:61)
> at java.base/java.lang.Thread.run(Thread.java:833)
> 2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] ERROR:
> An
> internal error occurred while trying to authenticate the user.
> org.springframework.security.authentication.InternalAuthenticationSer
> viceException:
> Timeout deadline: 15000 MILLISECONDS, actual: 15000 MILLISECONDS
> at
> io.nemesis.console.backend.storefront.DefaultRestAuthenticationProvid
> er.authenticate(DefaultRestAuthenticationProvider.java:137)
> at
> org.springframework.security.authentication.ProviderManager.authentic
> ate(ProviderManager.java:182)
> at
> org.springframework.security.authentication.ProviderManager.authentic
> ate(ProviderManager.java:201)
> at
> org.springframework.security.web.authentication.UsernamePasswordAuthe
> nticationFilter.attemptAuthentication(UsernamePasswordAuthenticationF
> ilter.java:85)
> at
> org.springframework.security.web.authentication.AbstractAuthenticatio
> nProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.jav
> a:231)
> at
> org.springframework.security.web.authentication.AbstractAuthenticatio
> nProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.jav
> a:221)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> doFilter(FilterChainProxy.java:361)
> at
> org.springframework.security.web.authentication.logout.LogoutFilter.d
> oFilter(LogoutFilter.java:107)
> at
> org.springframework.security.web.authentication.logout.LogoutFilter.d
> oFilter(LogoutFilter.java:93)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> doFilter(FilterChainProxy.java:361)
> at
> org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(Csr
> fFilter.java:132)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> equestFilter.java:117)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> doFilter(FilterChainProxy.java:361)
> at
> org.springframework.security.web.context.SecurityContextPersistenceFi
> lter.doFilter(SecurityContextPersistenceFilter.java:117)
> at
> org.springframework.security.web.context.SecurityContextPersistenceFi
> lter.doFilter(SecurityContextPersistenceFilter.java:87)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> doFilter(FilterChainProxy.java:361)
> at
> org.springframework.security.web.context.request.async.WebAsyncManage
> rIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.
> java:62)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> equestFilter.java:117)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> doFilter(FilterChainProxy.java:361)
> at
> org.springframework.security.web.session.DisableEncodeUrlFilter.doFil
> terInternal(DisableEncodeUrlFilter.java:42)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> equestFilter.java:117)
> at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.
> doFilter(FilterChainProxy.java:361)
> at
> org.springframework.security.web.FilterChainProxy.doFilterInternal(Fi
> lterChainProxy.java:225)
> at
> org.springframework.security.web.FilterChainProxy.doFilter(FilterChai
> nProxy.java:190)
> at
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(D
> elegatingFilterProxy.java:354)
> at
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(Delegat
> ingFilterProxy.java:267)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:189)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:162)
> at
> org.springframework.web.filter.CharacterEncodingFilter.doFilterIntern
> al(CharacterEncodingFilter.java:201)
> at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
> equestFilter.java:117)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:189)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:162)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
> alve.java:177)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
> alve.java:97)
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
> torBase.java:541)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
> ava:135)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
> ava:92)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
> ve.java:78)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
> a:360)
> at
> org.apache.coyote.http11.Http11Processor.service(Http11Processor.java
> :399)
> at
> org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLig
> ht.java:65)
> at
> org.apache.coyote.AbstractProtocol$ConnectionHandler.process(Abstract
> Protocol.java:891)
> at
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpo
> int.java:1784)
> at
> org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBas
> e.java:49)
> at
> org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoo
> lExecutor.java:1191)
> at
> org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPo
> olExecutor.java:659)
> at
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh
> read.java:61)
> at java.base/java.lang.Thread.run(Thread.java:833)
> =====================================================================
> ================
> 
> 
> На пт, 11.08.2023 г. в 10:58 ч. Oleg Kalnichevski <ol...@apache.org>
> написа:
> 
> > On Thu, 2023-08-10 at 22:40 +0300, Petar Tahchiev wrote:
> > > Hmm,
> > > 
> > > I tried now setting the Host header:
> > > 
> > > 
> > > httpGet.setHeader("Host", "localhost");
> > > 
> > > 
> > 
> > This is wrong. You should not be doing that. You should let
> > HttpClient
> > generate the Host header when appropriate. HttpClient will also
> > automatically take care of SNI for you.
> > 
> > Oleg
> > 
> > 
> > -------------------------------------------------------------------
> > --
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail:
> > httpclient-users-help@hc.apache.org
> > 
> > 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: How Do I Set SNI(Server Name Indentification)

Posted by Petar Tahchiev <pa...@gmail.com>.
Hello,

so I'm getting closer. Because I was
using PoolingAsyncClientConnectionManager I decided to replace it
with PoolingHttpClientConnectionManager and it worked. So the problem is
not in the SNI but in the PoolingAsyncClientConnectionManager. I am
following this guide exactly:
https://hc.apache.org/httpcomponents-client-5.2.x/migration-guide/migration-to-async-simple.html

and I don't know what to do - I always get
org.apache.hc.core5.util.TimeoutValueException.

This is my code:
----------------------------------------------------------------------------------------------------------------------------------------------------
try {
            final SSLContext sslcontext =
SSLContexts.custom().loadTrustMaterial((chain, authType) -> true).build();

            int timeout = 15;

            PoolingAsyncClientConnectionManager ccm =
PoolingAsyncClientConnectionManagerBuilder.create().setTlsStrategy(ClientTlsStrategyBuilder.create()
                    .setSslContext(sslcontext)
                    .setTlsVersions(TLS.V_1_2)
                    .setHostnameVerifier(
                        NoopHostnameVerifier.INSTANCE)
                    .build())
                .setConnectionTimeToLive(TimeValue.ofMinutes(1L)).build();

            try (CloseableHttpAsyncClient httpclient =
HttpAsyncClients.custom().setConnectionManager(ccm).setDefaultRequestConfig(

RequestConfig.custom().setConnectTimeout(Timeout.ofSeconds(timeout)).setResponseTimeout(Timeout.ofSeconds(timeout))

.setCookieSpec("STANDARD_STRICT").build()).setVersionPolicy(HttpVersionPolicy.NEGOTIATE).build())
{

                httpclient.start();

                SimpleHttpRequest httpGet = SimpleHttpRequests.get(new
URI(restBaseUrl + "auth"));
                httpGet.setHeader("X-Nemesis-Username", username);
                httpGet.setHeader("X-Nemesis-Password", password);

                Future<SimpleHttpResponse> future =
httpclient.execute(httpGet, null);

                SimpleHttpResponse response = future.get(timeout,
TimeUnit.SECONDS);

                final String responseText =
response.getBody().getBodyText();
----------------------------------------------------------------------------------------------------------------------------------------------------
and the worst part is I don't know how to debug it.
Here's the log:

=====================================================================================
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
ex-00000002: preparing request execution
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG: Cookie
spec selected: STANDARD_STRICT
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
Unsupported cookie spec: STANDARD_STRICT
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG: Auth
cache not set in the context
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
ex-00000002: target auth state: UNCHALLENGED
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
ex-00000002: proxy auth state: UNCHALLENGED
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
ex-00000002: acquiring connection with route {s}->https://localhost:8112
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
ex-00000002: acquiring endpoint (3 MINUTES)
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
ex-00000002: endpoint lease request (3 MINUTES) [route:
{s}->https://localhost:8112][total available: 0; route allocated: 0 of 5;
total allocated: 0 of 25]
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
ex-00000002: endpoint leased [route: {s}->https://localhost:8112][total
available: 0; route allocated: 1 of 5; total allocated: 1 of 25]
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
ex-00000002: acquired ep-00000001
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
ex-00000002: acquired endpoint ep-00000001
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
ep-00000001: connecting endpoint (15 SECONDS)
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
ep-00000001: connecting endpoint to https://localhost:8112 (15 SECONDS)
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
https://localhost:8112: resolving remote address
2023-08-11 13:07:14,876 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
https://localhost:8112: resolved to [localhost/127.0.0.1]
2023-08-11 13:07:14,877 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
https://localhost:8112: connecting null to localhost/127.0.0.1:8112 (15
SECONDS)
2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG:
https://localhost:8112: connected c-0000000001 /127.0.0.1:52420->localhost/
127.0.0.1:8112
2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: c-0000000001: start
TLS
2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
connected c-0000000001
2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
endpoint connected
2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
connected to target
2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ex-00000002: route
fully established
2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
executing GET /storefront/rest/auth HTTP/1.1
2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001: start
execution ex-00000002
2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: ep-00000001:
executing exchange ex-00000002 over c-0000000001
2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: c-0000000001:
RequestExecutionCommand with NORMAL priority
2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG:
c-0000000001[ACTIVE][rwc:c][ACTIVE][rw][NOT_HANDSHAKING][0][0][0] Enqueued
RequestExecutionCommand with priority IMMEDIATE
2023-08-11 13:07:14,877 [httpclient-dispatch-1] DEBUG: c-0000000001
c-0000000001[ACTIVE][rw:c][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]: Event
cleared [c]
2023-08-11 13:07:14,878 [httpclient-dispatch-1] DEBUG: Enabled protocols:
[TLSv1.2]
2023-08-11 13:07:14,878 [httpclient-dispatch-1] DEBUG: Enabled cipher
suites:[TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256,
TLS_CHACHA20_POLY1305_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,
TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,
TLS_DHE_DSS_WITH_AES_128_GCM_SHA256,
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,
TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,
TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,
TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384,
TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,
TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256,
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384,
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384,
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256,
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA,
TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384,
TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256,
TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA,
TLS_RSA_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
2023-08-11 13:07:14,898 [httpclient-dispatch-1] DEBUG: Secure session
established
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  negotiated
protocol: TLSv1.2
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  negotiated cipher
suite: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  peer principal:
CN=Nemesis Software, OU=Development, O=Nemesis Software, L=Sofia, ST=Sofia,
C=BG
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  peer alternative
names: [localhost, 127.0.0.1]
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG:  issuer principal:
CN=Nemesis Software, OU=Development, O=Nemesis Software, L=Sofia, ST=Sofia,
C=BG
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: ex-00000002: send
request GET /storefront/rest/auth HTTP/1.1, null entity
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001 >> GET
/storefront/rest/auth HTTP/1.1
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001 >>
X-Nemesis-Username: admin
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001 >>
X-Nemesis-Password: nimda
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001 >>
User-Agent: Apache-HttpAsyncClient/5.0.2 (Java/17)
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001 >>
Host: localhost:8112
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001 >>
Connection: keep-alive
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001
c-0000000001[ACTIVE][r:r][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]: 190 bytes
written
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001 >> "GET
/storefront/rest/auth HTTP/1.1[\r][\n]"
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001 >>
"X-Nemesis-Username: admin[\r][\n]"
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001 >>
"X-Nemesis-Password: nimda[\r][\n]"
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001 >>
"User-Agent: Apache-HttpAsyncClient/5.0.2 (Java/17)[\r][\n]"
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001 >>
"Host: localhost:8112[\r][\n]"
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001 >>
"Connection: keep-alive[\r][\n]"
2023-08-11 13:07:14,899 [httpclient-dispatch-1] DEBUG: c-0000000001 >>
"[\r][\n]"
2023-08-11 13:07:14,900 [httpclient-dispatch-1] DEBUG: c-0000000001
c-0000000001[ACTIVE][rw:r][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]: Event set
[w]
2023-08-11 13:07:14,900 [httpclient-dispatch-1] DEBUG: c-0000000001
c-0000000001[ACTIVE][r:r][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Event
cleared [w]
2023-08-11 13:07:14,900 [httpclient-dispatch-1] DEBUG: c-0000000001
c-0000000001[ACTIVE][r:r][ACTIVE][r][NOT_HANDSHAKING][44][15][0]: 0 bytes
read
2023-08-11 13:07:29,877 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
Shutdown GRACEFUL
2023-08-11 13:07:29,877 [httpclient-dispatch-1] DEBUG:
c-0000000001[ACTIVE][rw:r][ACTIVE][rw][NOT_HANDSHAKING][0][0][0] Enqueued
ShutdownCommand with priority IMMEDIATE
2023-08-11 13:07:29,877 [httpclient-dispatch-1] DEBUG: c-0000000001
c-0000000001[ACTIVE][r:w][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Event
cleared [w]
2023-08-11 13:07:29,877 [httpclient-dispatch-1] DEBUG: c-0000000001
c-0000000001[ACTIVE][rw:w][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]: Event set
[w]
2023-08-11 13:07:29,878 [httpclient-dispatch-1] DEBUG: c-0000000001
c-0000000001[ACTIVE][r:w][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Event
cleared [w]
2023-08-11 13:07:34,877 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
c-0000000001
c-0000000001[ACTIVE][r:w][ACTIVE][r][NOT_HANDSHAKING][0][0][0]: Close
GRACEFUL
2023-08-11 13:07:34,877 [httpclient-dispatch-1] DEBUG: ex-00000002:
execution failed: Connection is closed
2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
Shutdown connection pool GRACEFUL
2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ex-00000002: request
failed: Connection is closed
2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
c-0000000001: Shutdown connection GRACEFUL
2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001: close
IMMEDIATE
2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] DEBUG:
Connection pool shut down
2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
endpoint closed
2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
discarding endpoint
2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
releasing endpoint
2023-08-11 13:07:34,878 [httpclient-dispatch-1] DEBUG: ep-00000001:
connection released [route: {s}->https://localhost:8112][total available:
0; route allocated: 0 of 5; total allocated: 0 of 25]
2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] ERROR: Timeout
deadline: 15000 MILLISECONDS, actual: 15000 MILLISECONDS
org.apache.hc.core5.util.TimeoutValueException: Timeout deadline: 15000
MILLISECONDS, actual: 15000 MILLISECONDS
at
org.apache.hc.core5.util.TimeoutValueException.fromMilliseconds(TimeoutValueException.java:49)
at org.apache.hc.core5.concurrent.BasicFuture.get(BasicFuture.java:107)
at
io.nemesis.console.backend.storefront.DefaultRestAuthenticationProvider.authenticate(DefaultRestAuthenticationProvider.java:114)
at
org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:182)
at
org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:201)
at
org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:85)
at
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:231)
at
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107)
at
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at
org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:132)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:117)
at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at
org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at
org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:225)
at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:190)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784)
at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at
org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at
org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:833)
2023-08-11 13:07:34,878 [https-jsse-nio-0.0.0.0-8443-exec-7] ERROR: An
internal error occurred while trying to authenticate the user.
org.springframework.security.authentication.InternalAuthenticationServiceException:
Timeout deadline: 15000 MILLISECONDS, actual: 15000 MILLISECONDS
at
io.nemesis.console.backend.storefront.DefaultRestAuthenticationProvider.authenticate(DefaultRestAuthenticationProvider.java:137)
at
org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:182)
at
org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:201)
at
org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:85)
at
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:231)
at
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107)
at
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at
org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:132)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:117)
at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at
org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at
org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)
at
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:225)
at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:190)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784)
at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at
org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at
org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:833)
=====================================================================================


На пт, 11.08.2023 г. в 10:58 ч. Oleg Kalnichevski <ol...@apache.org> написа:

> On Thu, 2023-08-10 at 22:40 +0300, Petar Tahchiev wrote:
> > Hmm,
> >
> > I tried now setting the Host header:
> >
> >
> > httpGet.setHeader("Host", "localhost");
> >
> >
>
> This is wrong. You should not be doing that. You should let HttpClient
> generate the Host header when appropriate. HttpClient will also
> automatically take care of SNI for you.
>
> Oleg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

-- 
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611

Re: How Do I Set SNI(Server Name Indentification)

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2023-08-10 at 22:40 +0300, Petar Tahchiev wrote:
> Hmm,
> 
> I tried now setting the Host header:
> 
> 
> httpGet.setHeader("Host", "localhost");
> 
> 

This is wrong. You should not be doing that. You should let HttpClient
generate the Host header when appropriate. HttpClient will also
automatically take care of SNI for you.

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: How Do I Set SNI(Server Name Indentification)

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2023-08-12 at 12:27 +0300, Petar Tahchiev wrote:
> Yes,
> like I already mentioned it is not a SNI problem.
> 
> Because I was using PoolingAsyncClientConnectionManager I decided to
> replace it with PoolingHttpClientConnectionManager and it worked. So
> the
> problem is not in the SNI but in the
> PoolingAsyncClientConnectionManager. I
> am following this guide exactly:
> https://hc.apache.org/httpcomponents-client-5.2.x/migration-guide/migration-to-async-simple.html
> 
> and I don't know what to do - I always get
> org.apache.hc.core5.util.TimeoutValueException.
> 
> 


Petar

No one, just no one here is going to debug your code for you. Please
start with something very simple, something straight out of the
migration guide, make sure it works, and gradually make it more
complex, more specific to your particular application domain, step by
step. If at any point things stop working, you likely know what the
possible cause may be.

Oleg   


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: How Do I Set SNI(Server Name Indentification)

Posted by Petar Tahchiev <pa...@gmail.com>.
Yes,
like I already mentioned it is not a SNI problem.

Because I was using PoolingAsyncClientConnectionManager I decided to
replace it with PoolingHttpClientConnectionManager and it worked. So the
problem is not in the SNI but in the PoolingAsyncClientConnectionManager. I
am following this guide exactly:
https://hc.apache.org/httpcomponents-client-5.2.x/migration-guide/migration-to-async-simple.html

and I don't know what to do - I always get
org.apache.hc.core5.util.TimeoutValueException.


На сб, 12.08.2023 г. в 12:16 ч. Oleg Kalnichevski <ol...@apache.org> написа:

> I see no evidence of SNI not working:
>
> try (final CloseableHttpAsyncClient client = HttpAsyncClients.custom()
>         .build()) {
>
>     client.start();
>
>     final HttpHost endpoint = new HttpHost("https", InetAddress.getByName("
> www.google.com"), "www.google.ch", 443);
>     final HttpClientContext clientContext = HttpClientContext.create();
>
>     final SimpleHttpRequest request = SimpleRequestBuilder.get()
>             .setPath("/")
>             .build();
>
>     System.out.println("Executing request " + request);
>     final Future<SimpleHttpResponse> future = client.execute(
>             endpoint,
>             SimpleRequestProducer.create(request),
>             SimpleResponseConsumer.create(),
>             null,
>             clientContext,
>             new FutureCallback<SimpleHttpResponse>() {
>
>                 @Override
>                 public void completed(final SimpleHttpResponse response) {
>                     System.out.println(request + "->" + new
> StatusLine(response));
>                     final SSLSession sslSession =
> clientContext.getSSLSession();
>                     if (sslSession != null) {
>                         System.out.println("SSL protocol " +
> sslSession.getProtocol());
>                         System.out.println("SSL cipher suite " +
> sslSession.getCipherSuite());
>                     }
>                     System.out.println(response.getBody());
>                 }
>
>                 @Override
>                 public void failed(final Exception ex) {
>                     System.out.println(request + "->" + ex);
>                 }
>
>                 @Override
>                 public void cancelled() {
>                     System.out.println(request + " cancelled");
>                 }
>
>             });
>     future.get();
>
>     System.out.println("Shutting down");
>     client.close(CloseMode.GRACEFUL);
> }
>
> Executing request GET /
> 2023-08-12 11:11:53,809 DEBUG
> [main][org.apache.hc.client5.http.impl.async.InternalAbstractHttpAsyncClient]
> ex-0000000001 preparing request execution
> 2023-08-12 11:11:53,817 DEBUG
> [main][org.apache.hc.client5.http.impl.async.AsyncProtocolExec]
> ex-0000000001 target auth state: UNCHALLENGED
> 2023-08-12 11:11:53,817 DEBUG
> [main][org.apache.hc.client5.http.impl.async.AsyncProtocolExec]
> ex-0000000001 proxy auth state: UNCHALLENGED
> 2023-08-12 11:11:53,819 DEBUG
> [main][org.apache.hc.client5.http.impl.async.AsyncConnectExec]
> ex-0000000001 acquiring connection with route {s}->
> https://www.google.ch:443
> 2023-08-12 11:11:53,819 DEBUG
> [main][org.apache.hc.client5.http.impl.async.InternalHttpAsyncClient]
> ex-0000000001 acquiring endpoint (3 MINUTES)
> 2023-08-12 11:11:53,821 DEBUG
> [main][org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager]
> ex-0000000001 endpoint lease request (3 MINUTES) [route: {s}->
> https://www.google.ch:443][total available: 0; route allocated: 0 of 5;
> total allocated: 0 of 25]
> 2023-08-12 11:11:53,823 DEBUG
> [main][org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager]
> ex-0000000001 endpoint leased [route: {s}->https://www.google.ch:443][total
> available: 0; route allocated: 1 of 5; total allocated: 1 of 25]
> 2023-08-12 11:11:53,824 DEBUG
> [main][org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager]
> ex-0000000001 acquired ep-0000000001
> 2023-08-12 11:11:53,824 DEBUG
> [main][org.apache.hc.client5.http.impl.async.InternalHttpAsyncClient]
> ex-0000000001 acquired endpoint ep-0000000001
> 2023-08-12 11:11:53,824 DEBUG
> [main][org.apache.hc.client5.http.impl.async.InternalHttpAsyncClient]
> ep-0000000001 connecting endpoint (null)
> 2023-08-12 11:11:53,825 DEBUG
> [main][org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager]
> ep-0000000001 connecting endpoint to https://www.google.ch:443 (3 MINUTES)
> 2023-08-12 11:11:53,825 DEBUG
> [main][org.apache.hc.client5.http.impl.nio.MultihomeIOSessionRequester]
> www.google.ch:443 connecting null to www.google.com/142.250.184.68:443 (3
> MINUTES)
> 2023-08-12 11:11:53,890 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.impl.nio.DefaultManagedAsyncClientConnection]
> c-0000000000 start TLS
> 2023-08-12 11:11:53,904 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy]
> Enabled protocols: [TLSv1.2]
> 2023-08-12 11:11:53,904 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy]
> Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
> TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
> TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
> TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,
> TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,
> TLS_DHE_DSS_WITH_AES_128_GCM_SHA256,
> TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,
> TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,
> TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
> TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,
> TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,
> TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,
> TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,
> TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384,
> TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,
> TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256,
> TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384,
> TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384,
> TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256,
> TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
> TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
> TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA,
> TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
> TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
> TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
> TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384,
> TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256,
> TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA,
> TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,
> TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA,
> SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA,
> TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA,
> TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
> 2023-08-12 11:11:53,904 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy]
> Starting handshake (3 MINUTES)
> javax.net.ssl|FINE|0D|httpclient-dispatch-1|2023-08-12 11:11:53.917
> CEST|SSLExtensions.java:260|Ignore, context unavailable extension:
> status_request
> javax.net.ssl|WARNING|0D|httpclient-dispatch-1|2023-08-12 11:11:53.920
> CEST|SignatureScheme.java:297|Signature algorithm, ed25519, is not
> supported by the underlying providers
> javax.net.ssl|WARNING|0D|httpclient-dispatch-1|2023-08-12 11:11:53.920
> CEST|SignatureScheme.java:297|Signature algorithm, ed448, is not supported
> by the underlying providers
> javax.net.ssl|FINE|0D|httpclient-dispatch-1|2023-08-12 11:11:53.923
> CEST|SSLExtensions.java:260|Ignore, context unavailable extension:
> status_request_v2
> javax.net.ssl|FINE|0D|httpclient-dispatch-1|2023-08-12 11:11:53.923
> CEST|SSLExtensions.java:260|Ignore, context unavailable extension:
> renegotiation_info
> javax.net.ssl|FINE|0D|httpclient-dispatch-1|2023-08-12 11:11:53.925
> CEST|ClientHello.java:575|Produced ClientHello handshake message (
> "ClientHello": {
>   "client version"      : "TLSv1.2",
>   "random"              : "03 B9 1C 75 11 97 C0 7C A5 E2 C0 CB 37 B7 6A 27
> 15 B9 BB 64 62 0A 10 BE B2 47 A2 17 3A 0F 59 8C",
>   "session id"          : "",
>   "cipher suites"       :
> "[TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384(0xC02C),
> TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256(0xC02B),
> TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384(0xC030),
> TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256(0xC02F),
> TLS_DHE_RSA_WITH_AES_256_GCM_SHA384(0x009F),
> TLS_DHE_DSS_WITH_AES_256_GCM_SHA384(0x00A3),
> TLS_DHE_RSA_WITH_AES_128_GCM_SHA256(0x009E),
> TLS_DHE_DSS_WITH_AES_128_GCM_SHA256(0x00A2),
> TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384(0xC024),
> TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384(0xC028),
> TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256(0xC023),
> TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256(0xC027),
> TLS_DHE_RSA_WITH_AES_256_CBC_SHA256(0x006B),
> TLS_DHE_DSS_WITH_AES_256_CBC_SHA256(0x006A),
> TLS_DHE_RSA_WITH_AES_128_CBC_SHA256(0x0067),
> TLS_DHE_DSS_WITH_AES_128_CBC_SHA256(0x0040),
> TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384(0xC02E),
> TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384(0xC032),
> TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256(0xC02D),
> TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256(0xC031),
> TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384(0xC026),
> TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384(0xC02A),
> TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256(0xC025),
> TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256(0xC029),
> TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA(0xC00A),
> TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA(0xC014),
> TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA(0xC009),
> TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA(0xC013),
> TLS_DHE_RSA_WITH_AES_256_CBC_SHA(0x0039),
> TLS_DHE_DSS_WITH_AES_256_CBC_SHA(0x0038),
> TLS_DHE_RSA_WITH_AES_128_CBC_SHA(0x0033),
> TLS_DHE_DSS_WITH_AES_128_CBC_SHA(0x0032),
> TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA(0xC005),
> TLS_ECDH_RSA_WITH_AES_256_CBC_SHA(0xC00F),
> TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA(0xC004),
> TLS_ECDH_RSA_WITH_AES_128_CBC_SHA(0xC00E),
> TLS_RSA_WITH_AES_256_GCM_SHA384(0x009D),
> TLS_RSA_WITH_AES_128_GCM_SHA256(0x009C),
> TLS_RSA_WITH_AES_256_CBC_SHA256(0x003D),
> TLS_RSA_WITH_AES_128_CBC_SHA256(0x003C),
> TLS_RSA_WITH_AES_256_CBC_SHA(0x0035), TLS_RSA_WITH_AES_128_CBC_SHA(0x002F),
> TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA(0xC008),
> TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA(0xC012),
> SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA(0x0016),
> SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA(0x0013),
> TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA(0xC003),
> TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA(0xC00D),
> SSL_RSA_WITH_3DES_EDE_CBC_SHA(0x000A),
> TLS_EMPTY_RENEGOTIATION_INFO_SCSV(0x00FF)]",
>   "compression methods" : "00",
>   "extensions"          : [
>     "server_name (0)": {
>       type=host_name (0), value=www.google.ch
>     },
>
> ...
>
> 2023-08-12 11:11:54,166 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy]
> Secure session established
> 2023-08-12 11:11:54,166 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy]
> negotiated protocol: TLSv1.2
> 2023-08-12 11:11:54,166 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy]
> negotiated cipher suite: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
> 2023-08-12 11:11:54,166 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy]
> peer principal: CN=*.google.ch
> 2023-08-12 11:11:54,166 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy]
> peer alternative names: [*.google.ch, google.ch]
> 2023-08-12 11:11:54,166 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy]
> issuer principal: CN=GTS CA 1C3, O=Google Trust Services LLC, C=US
> 2023-08-12 11:11:54,168 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager]
> ep-0000000001 connected c-0000000000
> 2023-08-12 11:11:54,168 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.impl.async.InternalHttpAsyncClient]
> ep-0000000001 endpoint connected
> 2023-08-12 11:11:54,168 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.impl.async.AsyncConnectExec]
> ex-0000000001 connected to target
> 2023-08-12 11:11:54,168 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.impl.async.AsyncConnectExec]
> ex-0000000001 route fully established
> 2023-08-12 11:11:54,168 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.impl.async.HttpAsyncMainClientExec]
> ex-0000000001 executing GET / HTTP/1.1
> 2023-08-12 11:11:54,169 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.impl.async.InternalHttpAsyncClient]
> ep-0000000001 start execution ex-0000000001
> 2023-08-12 11:11:54,169 DEBUG
> [httpclient-dispatch-1][org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager]
> ep-0000000001 executing exchange ex-0000000001 over c-0000000000
>
>
>
>
>
>
> On Fri, 2023-08-11 at 18:50 -0600, Shawn Heisey wrote:
> > On 8/10/23 14:03, Petar Tahchiev wrote:
> > > Hi Jochen,
> > > I don't have 2 different SSL certificates.
> > > I have no idea what  SNI is but that seems to be the only
> > > difference in the
> > > log from curl and httpclient5.
> >
> > https://en.wikipedia.org/wiki/Server_Name_Indication
> >
> > Basically it's a feature of TLS that allows a client to send a hint
> > to a
> > server so it can decide which certificate to send.  With HTTPS, the
> > SNI
> > value is typically the same as the Host header value that is later
> > sent
> > over the encrypted channel.  With httpclient implementations, the SNI
> > value is usually extracted from the URL that has been requested.  So
> > a
> > request for "https://www.example.com/some/path" would set the SNI and
> > Host header to www.example.com.
> >
> > This issue seems to be a case where the SNI value is missing, or
> > maybe
> > sent or interpreted as the literal string "null".
> >
> > It seems odd that SNI could affect a server that doesn't have more
> > than
> > one certificate.  Unless the server is deciding to not proceed with
> > the
> > connection at all because it doesn't have a certificate that matches
> > the
> > missing or incorrect SNI value.
> >
> > I have seen that things can often get fuzzy with Java software and
> > TLS,
> > because Sun wrote their own implementation of TLS for Java, and it
> > sometimes does not behave exactly the same as other implementations.
> > I'm not trying to say that their implementation is wrong, but it does
> > behave differently than another implementation like openssl.
> >
> > I hope you can get the info you need to work around the difficulty.
> >
> > Thanks,
> > Shawn
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

-- 
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611

Re: How Do I Set SNI(Server Name Indentification)

Posted by Oleg Kalnichevski <ol...@apache.org>.
I see no evidence of SNI not working:

try (final CloseableHttpAsyncClient client = HttpAsyncClients.custom()
        .build()) {

    client.start();

    final HttpHost endpoint = new HttpHost("https", InetAddress.getByName("www.google.com"), "www.google.ch", 443);
    final HttpClientContext clientContext = HttpClientContext.create();

    final SimpleHttpRequest request = SimpleRequestBuilder.get()
            .setPath("/")
            .build();

    System.out.println("Executing request " + request);
    final Future<SimpleHttpResponse> future = client.execute(
            endpoint,
            SimpleRequestProducer.create(request),
            SimpleResponseConsumer.create(),
            null,
            clientContext,
            new FutureCallback<SimpleHttpResponse>() {

                @Override
                public void completed(final SimpleHttpResponse response) {
                    System.out.println(request + "->" + new StatusLine(response));
                    final SSLSession sslSession = clientContext.getSSLSession();
                    if (sslSession != null) {
                        System.out.println("SSL protocol " + sslSession.getProtocol());
                        System.out.println("SSL cipher suite " + sslSession.getCipherSuite());
                    }
                    System.out.println(response.getBody());
                }

                @Override
                public void failed(final Exception ex) {
                    System.out.println(request + "->" + ex);
                }

                @Override
                public void cancelled() {
                    System.out.println(request + " cancelled");
                }

            });
    future.get();

    System.out.println("Shutting down");
    client.close(CloseMode.GRACEFUL);
}

Executing request GET /
2023-08-12 11:11:53,809 DEBUG [main][org.apache.hc.client5.http.impl.async.InternalAbstractHttpAsyncClient] ex-0000000001 preparing request execution
2023-08-12 11:11:53,817 DEBUG [main][org.apache.hc.client5.http.impl.async.AsyncProtocolExec] ex-0000000001 target auth state: UNCHALLENGED
2023-08-12 11:11:53,817 DEBUG [main][org.apache.hc.client5.http.impl.async.AsyncProtocolExec] ex-0000000001 proxy auth state: UNCHALLENGED
2023-08-12 11:11:53,819 DEBUG [main][org.apache.hc.client5.http.impl.async.AsyncConnectExec] ex-0000000001 acquiring connection with route {s}->https://www.google.ch:443
2023-08-12 11:11:53,819 DEBUG [main][org.apache.hc.client5.http.impl.async.InternalHttpAsyncClient] ex-0000000001 acquiring endpoint (3 MINUTES)
2023-08-12 11:11:53,821 DEBUG [main][org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager] ex-0000000001 endpoint lease request (3 MINUTES) [route: {s}->https://www.google.ch:443][total available: 0; route allocated: 0 of 5; total allocated: 0 of 25]
2023-08-12 11:11:53,823 DEBUG [main][org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager] ex-0000000001 endpoint leased [route: {s}->https://www.google.ch:443][total available: 0; route allocated: 1 of 5; total allocated: 1 of 25]
2023-08-12 11:11:53,824 DEBUG [main][org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager] ex-0000000001 acquired ep-0000000001
2023-08-12 11:11:53,824 DEBUG [main][org.apache.hc.client5.http.impl.async.InternalHttpAsyncClient] ex-0000000001 acquired endpoint ep-0000000001
2023-08-12 11:11:53,824 DEBUG [main][org.apache.hc.client5.http.impl.async.InternalHttpAsyncClient] ep-0000000001 connecting endpoint (null)
2023-08-12 11:11:53,825 DEBUG [main][org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager] ep-0000000001 connecting endpoint to https://www.google.ch:443 (3 MINUTES)
2023-08-12 11:11:53,825 DEBUG [main][org.apache.hc.client5.http.impl.nio.MultihomeIOSessionRequester] www.google.ch:443 connecting null to www.google.com/142.250.184.68:443 (3 MINUTES)
2023-08-12 11:11:53,890 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.impl.nio.DefaultManagedAsyncClientConnection] c-0000000000 start TLS
2023-08-12 11:11:53,904 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy] Enabled protocols: [TLSv1.2]
2023-08-12 11:11:53,904 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy] Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
2023-08-12 11:11:53,904 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy] Starting handshake (3 MINUTES)
javax.net.ssl|FINE|0D|httpclient-dispatch-1|2023-08-12 11:11:53.917 CEST|SSLExtensions.java:260|Ignore, context unavailable extension: status_request
javax.net.ssl|WARNING|0D|httpclient-dispatch-1|2023-08-12 11:11:53.920 CEST|SignatureScheme.java:297|Signature algorithm, ed25519, is not supported by the underlying providers
javax.net.ssl|WARNING|0D|httpclient-dispatch-1|2023-08-12 11:11:53.920 CEST|SignatureScheme.java:297|Signature algorithm, ed448, is not supported by the underlying providers
javax.net.ssl|FINE|0D|httpclient-dispatch-1|2023-08-12 11:11:53.923 CEST|SSLExtensions.java:260|Ignore, context unavailable extension: status_request_v2
javax.net.ssl|FINE|0D|httpclient-dispatch-1|2023-08-12 11:11:53.923 CEST|SSLExtensions.java:260|Ignore, context unavailable extension: renegotiation_info
javax.net.ssl|FINE|0D|httpclient-dispatch-1|2023-08-12 11:11:53.925 CEST|ClientHello.java:575|Produced ClientHello handshake message (
"ClientHello": {
  "client version"      : "TLSv1.2",
  "random"              : "03 B9 1C 75 11 97 C0 7C A5 E2 C0 CB 37 B7 6A 27 15 B9 BB 64 62 0A 10 BE B2 47 A2 17 3A 0F 59 8C",
  "session id"          : "",
  "cipher suites"       : "[TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384(0xC02C), TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256(0xC02B), TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384(0xC030), TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256(0xC02F), TLS_DHE_RSA_WITH_AES_256_GCM_SHA384(0x009F), TLS_DHE_DSS_WITH_AES_256_GCM_SHA384(0x00A3), TLS_DHE_RSA_WITH_AES_128_GCM_SHA256(0x009E), TLS_DHE_DSS_WITH_AES_128_GCM_SHA256(0x00A2), TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384(0xC024), TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384(0xC028), TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256(0xC023), TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256(0xC027), TLS_DHE_RSA_WITH_AES_256_CBC_SHA256(0x006B), TLS_DHE_DSS_WITH_AES_256_CBC_SHA256(0x006A), TLS_DHE_RSA_WITH_AES_128_CBC_SHA256(0x0067), TLS_DHE_DSS_WITH_AES_128_CBC_SHA256(0x0040), TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384(0xC02E), TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384(0xC032), TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256(0xC02D), TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256(0xC031), TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384(0xC026), TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384(0xC02A), TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256(0xC025), TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256(0xC029), TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA(0xC00A), TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA(0xC014), TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA(0xC009), TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA(0xC013), TLS_DHE_RSA_WITH_AES_256_CBC_SHA(0x0039), TLS_DHE_DSS_WITH_AES_256_CBC_SHA(0x0038), TLS_DHE_RSA_WITH_AES_128_CBC_SHA(0x0033), TLS_DHE_DSS_WITH_AES_128_CBC_SHA(0x0032), TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA(0xC005), TLS_ECDH_RSA_WITH_AES_256_CBC_SHA(0xC00F), TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA(0xC004), TLS_ECDH_RSA_WITH_AES_128_CBC_SHA(0xC00E), TLS_RSA_WITH_AES_256_GCM_SHA384(0x009D), TLS_RSA_WITH_AES_128_GCM_SHA256(0x009C), TLS_RSA_WITH_AES_256_CBC_SHA256(0x003D), TLS_RSA_WITH_AES_128_CBC_SHA256(0x003C), TLS_RSA_WITH_AES_256_CBC_SHA(0x0035), TLS_RSA_WITH_AES_128_CBC_SHA(0x002F), TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA(0xC008), TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA(0xC012), SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA(0x0016), SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA(0x0013), TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA(0xC003), TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA(0xC00D), SSL_RSA_WITH_3DES_EDE_CBC_SHA(0x000A), TLS_EMPTY_RENEGOTIATION_INFO_SCSV(0x00FF)]",
  "compression methods" : "00",
  "extensions"          : [
    "server_name (0)": {
      type=host_name (0), value=www.google.ch
    },

...

2023-08-12 11:11:54,166 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy] Secure session established
2023-08-12 11:11:54,166 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy]  negotiated protocol: TLSv1.2
2023-08-12 11:11:54,166 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy]  negotiated cipher suite: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
2023-08-12 11:11:54,166 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy]  peer principal: CN=*.google.ch
2023-08-12 11:11:54,166 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy]  peer alternative names: [*.google.ch, google.ch]
2023-08-12 11:11:54,166 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.ssl.AbstractClientTlsStrategy]  issuer principal: CN=GTS CA 1C3, O=Google Trust Services LLC, C=US
2023-08-12 11:11:54,168 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager] ep-0000000001 connected c-0000000000
2023-08-12 11:11:54,168 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.impl.async.InternalHttpAsyncClient] ep-0000000001 endpoint connected
2023-08-12 11:11:54,168 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.impl.async.AsyncConnectExec] ex-0000000001 connected to target
2023-08-12 11:11:54,168 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.impl.async.AsyncConnectExec] ex-0000000001 route fully established
2023-08-12 11:11:54,168 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.impl.async.HttpAsyncMainClientExec] ex-0000000001 executing GET / HTTP/1.1
2023-08-12 11:11:54,169 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.impl.async.InternalHttpAsyncClient] ep-0000000001 start execution ex-0000000001
2023-08-12 11:11:54,169 DEBUG [httpclient-dispatch-1][org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager] ep-0000000001 executing exchange ex-0000000001 over c-0000000000






On Fri, 2023-08-11 at 18:50 -0600, Shawn Heisey wrote:
> On 8/10/23 14:03, Petar Tahchiev wrote:
> > Hi Jochen,
> > I don't have 2 different SSL certificates.
> > I have no idea what  SNI is but that seems to be the only
> > difference in the
> > log from curl and httpclient5.
> 
> https://en.wikipedia.org/wiki/Server_Name_Indication
> 
> Basically it's a feature of TLS that allows a client to send a hint
> to a 
> server so it can decide which certificate to send.  With HTTPS, the
> SNI 
> value is typically the same as the Host header value that is later
> sent 
> over the encrypted channel.  With httpclient implementations, the SNI
> value is usually extracted from the URL that has been requested.  So
> a 
> request for "https://www.example.com/some/path" would set the SNI and
> Host header to www.example.com.
> 
> This issue seems to be a case where the SNI value is missing, or
> maybe 
> sent or interpreted as the literal string "null".
> 
> It seems odd that SNI could affect a server that doesn't have more
> than 
> one certificate.  Unless the server is deciding to not proceed with
> the 
> connection at all because it doesn't have a certificate that matches
> the 
> missing or incorrect SNI value.
> 
> I have seen that things can often get fuzzy with Java software and
> TLS, 
> because Sun wrote their own implementation of TLS for Java, and it 
> sometimes does not behave exactly the same as other implementations. 
> I'm not trying to say that their implementation is wrong, but it does
> behave differently than another implementation like openssl.
> 
> I hope you can get the info you need to work around the difficulty.
> 
> Thanks,
> Shawn
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: How Do I Set SNI(Server Name Indentification)

Posted by Shawn Heisey <ap...@elyograg.org>.
On 8/10/23 14:03, Petar Tahchiev wrote:
> Hi Jochen,
> I don't have 2 different SSL certificates.
> I have no idea what  SNI is but that seems to be the only difference in the
> log from curl and httpclient5.

https://en.wikipedia.org/wiki/Server_Name_Indication

Basically it's a feature of TLS that allows a client to send a hint to a 
server so it can decide which certificate to send.  With HTTPS, the SNI 
value is typically the same as the Host header value that is later sent 
over the encrypted channel.  With httpclient implementations, the SNI 
value is usually extracted from the URL that has been requested.  So a 
request for "https://www.example.com/some/path" would set the SNI and 
Host header to www.example.com.

This issue seems to be a case where the SNI value is missing, or maybe 
sent or interpreted as the literal string "null".

It seems odd that SNI could affect a server that doesn't have more than 
one certificate.  Unless the server is deciding to not proceed with the 
connection at all because it doesn't have a certificate that matches the 
missing or incorrect SNI value.

I have seen that things can often get fuzzy with Java software and TLS, 
because Sun wrote their own implementation of TLS for Java, and it 
sometimes does not behave exactly the same as other implementations. 
I'm not trying to say that their implementation is wrong, but it does 
behave differently than another implementation like openssl.

I hope you can get the info you need to work around the difficulty.

Thanks,
Shawn

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: How Do I Set SNI(Server Name Indentification)

Posted by Petar Tahchiev <pa...@gmail.com>.
Hi Jochen,
I don't have 2 different SSL certificates.
I have no idea what  SNI is but that seems to be the only difference in the
log from curl and httpclient5.

This is from curl:
--------------------------------------------------------------------------------------------------------------------------------------
 2023-08-10 21:34:05,099 org.apache.tomcat.util.threads.LimitLatch
[https-jsse-nio-0.0.0.0-8112-Acceptor] DEBUG: Counting
up[https-jsse-nio-0.0.0.0-8112-Acceptor] latch=1
 2023-08-10 21:34:05,101 org.apache.tomcat.util.net.SecureNioChannel
[https-jsse-nio-0.0.0.0-8112-exec-2] DEBUG: *The SNI host name extracted
for connection [java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 <http://127.0.0.1:8112> remote=/127.0.0.1:55478
<http://127.0.0.1:55478>]] was [localhost]*
 2023-08-10 21:34:05,117 org.apache.tomcat.util.net.NioEndpoint
[https-jsse-nio-0.0.0.0-8112-exec-2] DEBUG: Registered write interest for
[org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@555bd3a4
:org.apache.tomcat.util.net.SecureNioChannel@dcab21d:java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 remote=/127.0.0.1:55478]]
 2023-08-10 21:34:05,117 org.apache.tomcat.util.net.NioEndpoint
[https-jsse-nio-0.0.0.0-8112-exec-3] DEBUG: Registered write interest for
[org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@555bd3a4
:org.apache.tomcat.util.net.SecureNioChannel@dcab21d:java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 remote=/127.0.0.1:55478]]
 2023-08-10 21:34:05,118 org.apache.tomcat.util.net.NioEndpoint
[https-jsse-nio-0.0.0.0-8112-exec-4] DEBUG: Registered read interest for
[org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@555bd3a4
:org.apache.tomcat.util.net.SecureNioChannel@dcab21d:java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 remote=/127.0.0.1:55478]]
 2023-08-10 21:34:05,119 org.apache.tomcat.util.net.NioEndpoint
[https-jsse-nio-0.0.0.0-8112-exec-5] DEBUG: Registered write interest for
[org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@555bd3a4
:org.apache.tomcat.util.net.SecureNioChannel@dcab21d:java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 remote=/127.0.0.1:55478]]
 2023-08-10 21:34:05,120 org.apache.tomcat.util.http.Parameters
[https-jsse-nio-0.0.0.0-8112-exec-7] DEBUG: Set query string encoding to
UTF-8
 2023-08-10 21:34:05,120 org.apache.tomcat.util.net.NioEndpoint
[https-jsse-nio-0.0.0.0-8112-exec-6] DEBUG: Registered read interest for
[org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@555bd3a4
:org.apache.tomcat.util.net.SecureNioChannel@dcab21d:java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 remote=/127.0.0.1:55478]]
 2023-08-10 21:34:05,120 org.apache.catalina.valves.RemoteIpValve
[https-jsse-nio-0.0.0.0-8112-exec-7] DEBUG: Incoming request
/storefront/facade/auth with originalRemoteAddr [127.0.0.1],
originalRemoteHost=[127.0.0.1], originalSecure=[true],
originalScheme=[https], originalServerName=[localhost],
originalServerPort=[8112] will be seen as newRemoteAddr=[127.0.0.1],
newRemoteHost=[127.0.0.1], newSecure=[true], newScheme=[https],
newServerName=[localhost], newServerPort=[8112]
 2023-08-10 21:34:05,120
org.apache.catalina.authenticator.AuthenticatorBase
[https-jsse-nio-0.0.0.0-8112-exec-7] DEBUG: Security checking request GET
/storefront/facade/auth
 2023-08-10 21:34:05,120 org.apache.catalina.realm.RealmBase
[https-jsse-nio-0.0.0.0-8112-exec-7] DEBUG:   No applicable constraints
defined
 2023-08-10 21:34:05,120
org.apache.catalina.authenticator.AuthenticatorBase
[https-jsse-nio-0.0.0.0-8112-exec-7] DEBUG: Not subject to any constraint
 2023-08-10 21:34:05,121 org.apache.tomcat.util.http.Parameters
[https-jsse-nio-0.0.0.0-8112-exec-7] DEBUG: Set encoding to UTF-8
 2023-08-10 21:34:05,203 org.apache.tomcat.util.threads.LimitLatch
[https-jsse-nio-0.0.0.0-8112-exec-7] DEBUG: Counting
down[https-jsse-nio-0.0.0.0-8112-exec-7] latch=1
 2023-08-10 21:34:05,203 org.apache.tomcat.util.net.NioEndpoint
[https-jsse-nio-0.0.0.0-8112-exec-7] DEBUG: Calling
[org.apache.tomcat.util.net.NioEndpoint@213543bc
].closeSocket([org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@555bd3a4
:org.apache.tomcat.util.net.SecureNioChannel@dcab21d:java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 remote=/127.0.0.1:55478]])
 2023-08-10 21:34:12,172 org.apache.catalina.session.ManagerBase
[Catalina-utility-1] DEBUG: Start expire sessions StandardManager at
1691692452172 sessioncount 0
 2023-08-10 21:34:12,172 org.apache.catalina.session.ManagerBase
[Catalina-utility-1] DEBUG: End expire sessions StandardManager
processingTime 0 expired sessions: 0
---------------------------------------------------------------------------------------------------------------------------------------


this is from httpclient5:
---------------------------------------------------------------------------------------------------------------------------------------
2023-08-10 21:34:58,076 org.apache.tomcat.util.threads.LimitLatch
[https-jsse-nio-0.0.0.0-8112-Acceptor] DEBUG: Counting
up[https-jsse-nio-0.0.0.0-8112-Acceptor] latch=1
 2023-08-10 21:34:58,080 org.apache.tomcat.util.net.SecureNioChannel
[https-jsse-nio-0.0.0.0-8112-exec-9] DEBUG: *The SNI host name extracted
for connection [java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 <http://127.0.0.1:8112> remote=/127.0.0.1:55754
<http://127.0.0.1:55754>]] was [null]*
 2023-08-10 21:34:58,096 org.apache.tomcat.util.net.NioEndpoint
[https-jsse-nio-0.0.0.0-8112-exec-9] DEBUG: Registered write interest for
[org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@33a45cc7
:org.apache.tomcat.util.net.SecureNioChannel@dcab21d:java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 remote=/127.0.0.1:55754]]
 2023-08-10 21:34:58,097 org.apache.tomcat.util.net.NioEndpoint
[https-jsse-nio-0.0.0.0-8112-exec-10] DEBUG: Registered write interest for
[org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@33a45cc7
:org.apache.tomcat.util.net.SecureNioChannel@dcab21d:java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 remote=/127.0.0.1:55754]]
 2023-08-10 21:34:58,097 org.apache.tomcat.util.net.NioEndpoint
[https-jsse-nio-0.0.0.0-8112-exec-1] DEBUG: Registered read interest for
[org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@33a45cc7
:org.apache.tomcat.util.net.SecureNioChannel@dcab21d:java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 remote=/127.0.0.1:55754]]
 2023-08-10 21:34:58,098 org.apache.tomcat.util.net.NioEndpoint
[https-jsse-nio-0.0.0.0-8112-exec-2] DEBUG: Registered read interest for
[org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@33a45cc7
:org.apache.tomcat.util.net.SecureNioChannel@dcab21d:java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 remote=/127.0.0.1:55754]]
 2023-08-10 21:34:58,100 org.apache.tomcat.util.net.NioEndpoint
[https-jsse-nio-0.0.0.0-8112-exec-3] DEBUG: Registered read interest for
[org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@33a45cc7
:org.apache.tomcat.util.net.SecureNioChannel@dcab21d:java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 remote=/127.0.0.1:55754]]
 2023-08-10 21:34:58,100 org.apache.tomcat.util.net.NioEndpoint
[https-jsse-nio-0.0.0.0-8112-exec-4] DEBUG: Registered read interest for
[org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@33a45cc7
:org.apache.tomcat.util.net.SecureNioChannel@dcab21d:java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 remote=/127.0.0.1:55754]]
 2023-08-10 21:35:12,173 org.apache.catalina.session.ManagerBase
[Catalina-utility-1] DEBUG: Start expire sessions StandardManager at
1691692512173 sessioncount 0
 2023-08-10 21:35:12,173 org.apache.catalina.session.ManagerBase
[Catalina-utility-1] DEBUG: End expire sessions StandardManager
processingTime 0 expired sessions: 0
 2023-08-10 21:35:58,156 org.apache.tomcat.util.threads.LimitLatch
[https-jsse-nio-0.0.0.0-8112-exec-5] DEBUG: Counting
down[https-jsse-nio-0.0.0.0-8112-exec-5] latch=1
 2023-08-10 21:35:58,157 org.apache.tomcat.util.net.NioEndpoint
[https-jsse-nio-0.0.0.0-8112-exec-5] DEBUG: Calling
[org.apache.tomcat.util.net.NioEndpoint@213543bc
].closeSocket([org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@33a45cc7
:org.apache.tomcat.util.net.SecureNioChannel@dcab21d:java.nio.channels.SocketChannel[connected
local=/127.0.0.1:8112 remote=/127.0.0.1:55754]])
---------------------------------------------------------------------------------------------------------------------------------------



На чт, 10.08.2023 г. в 22:54 ч. Jochen Wiedmann <jo...@gmail.com>
написа:

> Hi, Petar,
>
> looking through
>
>   https://tomcat.apache.org/tomcat-9.0-doc/config/http.html
>
> I get the impression, that SNI is a server-side issue. So, the actual
> problem may be on the server side, rather than the client side. To
> begin with: Do you really need two different SSL certificates within
> one Tomcat. (Because that is, what SNI appears to be about.)
>
> Jochen
>
> On Thu, Aug 10, 2023 at 9:41 PM Petar Tahchiev <pa...@gmail.com>
> wrote:
> >
> > Hmm,
> >
> > I tried now setting the Host header:
> >
> >
> > httpGet.setHeader("Host", "localhost");
> >
> >
> > yet tomcat still logs null for SNI
> >
> > На чт, 10.08.2023 г. в 22:21 ч. Jochen Wiedmann <
> jochen.wiedmann@gmail.com>
> > написа:
> >
> > > On Thu, Aug 10, 2023 at 9:14 PM Petar Tahchiev <pa...@gmail.com>
> > > wrote:
> > >
> > > > I found this gist which tells how to provide a SNI:
> > > >
> > > > https://gist.github.com/jkuipers/e0b35c21c466a9b4d88a
> > > >
> > > > but it is for HttpClient4 and I am unable to migrate the code to
> > > > HttpClient5.
> > >
> > > From looking at the gist, all that it does is to set the "Host"
> > > header. Surely, that's possible using the httpclient5 API.
> > >
> > > Jochen
> > >
> > >
> > >
> > > --
> > > The woman was born in a full-blown thunderstorm. She probably told it
> > > to be quiet. It probably did. (Robert Jordan, Winter's heart)
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > >
> > >
> >
> > --
> > Regards, Petar!
> > Karlovo, Bulgaria.
> > ---
> > Public PGP Key at:
> > http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611
> > Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
>
>
>
> --
> The woman was born in a full-blown thunderstorm. She probably told it
> to be quiet. It probably did. (Robert Jordan, Winter's heart)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

-- 
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611

Re: How Do I Set SNI(Server Name Indentification)

Posted by Jochen Wiedmann <jo...@gmail.com>.
Hi, Petar,

looking through

  https://tomcat.apache.org/tomcat-9.0-doc/config/http.html

I get the impression, that SNI is a server-side issue. So, the actual
problem may be on the server side, rather than the client side. To
begin with: Do you really need two different SSL certificates within
one Tomcat. (Because that is, what SNI appears to be about.)

Jochen

On Thu, Aug 10, 2023 at 9:41 PM Petar Tahchiev <pa...@gmail.com> wrote:
>
> Hmm,
>
> I tried now setting the Host header:
>
>
> httpGet.setHeader("Host", "localhost");
>
>
> yet tomcat still logs null for SNI
>
> На чт, 10.08.2023 г. в 22:21 ч. Jochen Wiedmann <jo...@gmail.com>
> написа:
>
> > On Thu, Aug 10, 2023 at 9:14 PM Petar Tahchiev <pa...@gmail.com>
> > wrote:
> >
> > > I found this gist which tells how to provide a SNI:
> > >
> > > https://gist.github.com/jkuipers/e0b35c21c466a9b4d88a
> > >
> > > but it is for HttpClient4 and I am unable to migrate the code to
> > > HttpClient5.
> >
> > From looking at the gist, all that it does is to set the "Host"
> > header. Surely, that's possible using the httpclient5 API.
> >
> > Jochen
> >
> >
> >
> > --
> > The woman was born in a full-blown thunderstorm. She probably told it
> > to be quiet. It probably did. (Robert Jordan, Winter's heart)
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
> >
>
> --
> Regards, Petar!
> Karlovo, Bulgaria.
> ---
> Public PGP Key at:
> http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611
> Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611



-- 
The woman was born in a full-blown thunderstorm. She probably told it
to be quiet. It probably did. (Robert Jordan, Winter's heart)

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: How Do I Set SNI(Server Name Indentification)

Posted by Petar Tahchiev <pa...@gmail.com>.
Hmm,

I tried now setting the Host header:


httpGet.setHeader("Host", "localhost");


yet tomcat still logs null for SNI

На чт, 10.08.2023 г. в 22:21 ч. Jochen Wiedmann <jo...@gmail.com>
написа:

> On Thu, Aug 10, 2023 at 9:14 PM Petar Tahchiev <pa...@gmail.com>
> wrote:
>
> > I found this gist which tells how to provide a SNI:
> >
> > https://gist.github.com/jkuipers/e0b35c21c466a9b4d88a
> >
> > but it is for HttpClient4 and I am unable to migrate the code to
> > HttpClient5.
>
> From looking at the gist, all that it does is to set the "Host"
> header. Surely, that's possible using the httpclient5 API.
>
> Jochen
>
>
>
> --
> The woman was born in a full-blown thunderstorm. She probably told it
> to be quiet. It probably did. (Robert Jordan, Winter's heart)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

-- 
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611

Re: How Do I Set SNI(Server Name Indentification)

Posted by Jochen Wiedmann <jo...@gmail.com>.
On Thu, Aug 10, 2023 at 9:14 PM Petar Tahchiev <pa...@gmail.com> wrote:

> I found this gist which tells how to provide a SNI:
>
> https://gist.github.com/jkuipers/e0b35c21c466a9b4d88a
>
> but it is for HttpClient4 and I am unable to migrate the code to
> HttpClient5.

From looking at the gist, all that it does is to set the "Host"
header. Surely, that's possible using the httpclient5 API.

Jochen



-- 
The woman was born in a full-blown thunderstorm. She probably told it
to be quiet. It probably did. (Robert Jordan, Winter's heart)

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org