On Wed, 2018-03-28 at 17:11 +0200, Rémy Amouroux wrote: > Hi > > Thanks Oleg for the answer on the possible logging options for > client5. > > I tried different setup to find a solution to my present problem, but > without seeing light. > > I’m trying to setup a connection to a http2 server, using https and a > proxy (which can do only HTTP1). > > Thus, the CONNECT operation to setup the SSL Tunnel should use http1 > , then the traffic going through the tunnel first negociate the > protocol, and then use http2 if available. > It’s what I understood from the output of curl 7.59.0 compiled with > http2 support. > (I can provide the traces of my tests if necessary) > > I’m using Java 9 as recommended in a previous exchange, in order to > have ALPN. > > First question : is it possible right now with httpclient5 ? >
Right now, it is not. It can be done but it will likely require some work in both HttpCore and HttpClient. > The tests I have done while forcing usage of http2 : > using .setVersionPolicy(HttpVersionPolicy.FORCE_HTTP_2), leads to > AsyncRetryExec:90 - I/O exception > (org.apache.hc.core5.http2.H2ConnectionException) caught when > processing request > to {tls}->http://94.23.118.210:80->https://korben.info:443: Frame > size exceeds maximum > > It seems quite logical : the client is trying to speak http2 to the > proxy which is answering with http1. > > But the same code using > .setVersionPolicy(HttpVersionPolicy.NEGOTIATE), leads to : > Exception in thread "main" java.util.concurrent.ExecutionException: > org.apache.hc.core5.http.ParseException: Invalid protocol version; > error at offset 0: <ÿÿÿÿ> > > Is there something I’m doing wrong ? > HttpClient 5 can either speak HTTP/1.1 or HTTP/2 on the same connection but not both. It can negotiate a tunnel through an HTTP/1.1 proxy but it cannot switch to HTTP/2 once the tunnel has been established. Oleg > The code for the last test is attached to this mail. > > I can provide the traces for the different tests if necessary. > > regards > > remyA > > > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org