Hi Oleg, Thank you for your reply.
My simple use case is I want to control on which channel / protocol (HTTP 1.x or HTTP 2) the requests should use using async httpclient api implementation irrespective of backend server enablement of that respective protocol. Is there a way to achieve this usecase using same connection pool manager / single httpclient object? Regards, Sreenivas On Sat, Nov 19, 2022, 3:47 PM Oleg Kalnichevski <ol...@apache.org> wrote: > On Fri, 2022-11-18 at 13:45 +0530, sreenivas somavarapu wrote: > > Hi Oleg, > > > > Thank you for your reply and conformation. > > > > I was looking at async APIs on how to achieve both HTTP 1.x and HTTP > > 2 > > support using same HttpAsyncClients builder but initial glance at > > APIs > > looks like it is not possible. Is my understanding correct? > > > No, it is not. > > > > Below are > > different types of configurations I have used. Please let me know if > > you > > need my complete sample code? For these tests I was using IIS server > > with > > HTTP2 enabled and as well as https://hc.apache.org website as well. > > > > I am trying with *setVersionPolicy* method on *HttpAsyncClients* API > > and if > > use *NEGOTIATE* version policy then it is working fine. If I use any > > of > > *FORCE_HTTP_** version policy then I am getting *400 bad request*. > > > > If I keep it as *NEGOTIATE* and then try to force HTTP2 request using > > *AsyncRequestBuilder* APIs setVersion method bu using > > *HttpVersion.HTTP_2* > > or *HttpVersion.HTTP_2_0* argument request is failing with > > *Unsupported > > version* error. > > > > My usecase is I have a small web app which will be used by users to > > get > > data from different servers. I am using httpclient here to get data > > from > > pre-configured servers which I even don't know before hand. Basically > > kind > > of reverse proxy. So if users request the data using HTTP 1.x I have > > to get > > data from backend server using HTTP 1.x only and vice-versa as well. > > > > Thank you once again for the help you are providing. > > > > I am not sure I understand what your are trying to do here. If want > HttpClient to negotiate the protocol you need to use the NEGOTIATE > protocol policy with HTTPS. One only needs to use FORCE_HTTP_2 when > connecting to an HTTP/2 endpoint over HTTP (so called h2c). > > Oleg > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org > For additional commands, e-mail: httpclient-users-h...@hc.apache.org > >