From httpclient-users-return-14172-archive-asf-public=cust-asf.ponee.io@hc.apache.org Wed Mar 28 19:54:13 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id CCD83180652 for ; Wed, 28 Mar 2018 19:54:12 +0200 (CEST) Received: (qmail 65849 invoked by uid 500); 28 Mar 2018 17:54:11 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 65838 invoked by uid 99); 28 Mar 2018 17:54:11 -0000 Received: from mail-relay.apache.org (HELO mailrelay2-lw-us.apache.org) (207.244.88.137) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Mar 2018 17:54:11 +0000 Received: from ok2c (249.164-224-87.telenet.ru [87.224.164.249]) by mailrelay2-lw-us.apache.org (ASF Mail Server at mailrelay2-lw-us.apache.org) with ESMTPSA id 42B1DFA6 for ; Wed, 28 Mar 2018 17:54:10 +0000 (UTC) Message-ID: <1522259645.23674.1.camel@apache.org> Subject: Re: Client5, HTTP2 , https and proxy usage From: Oleg Kalnichevski To: HttpClient User Discussion Date: Wed, 28 Mar 2018 19:54:05 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit 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-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org