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? 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. Regards, Sreenivas On Fri, Nov 4, 2022, 5:30 PM Oleg Kalnichevski <ol...@apache.org> wrote: > On Fri, 2022-11-04 at 04:16 +0530, sreenivas somavarapu wrote: > > Hi Team, > > > > Might be the query had been answered before but I tried to search and > > was > > unscuccessful to find any reference stating whether Apache HTTPClient > > 5.x > > classic api implementation is supporting HTTP 2 requests or not. > > > > I am trying to set request as HTTP 2 using below code but server is > > throwing 400 and if use my own IIS server it is throwing 500 > > "*Version Not > > Supported*” as I could see in java ssl debug in both cases it is > > being sent > > as “GET / HTTP/2.0”. If I define my own *ProtocolVersion* class and > > override *format* method in that class to send request “GET / HTTP/2” > > (Similar to how browsers send) I am getting even 400 error from IIS. > > > > > > *final HttpGet httpget = new HttpGet("https://hc.apache.org/ > > <https://hc.apache.org/>”);* > > *httpget.setVersion(HttpVersion.HTTP_2);* > > > > Thanks & Regards, > > Sreenivas > > > > > > > Sreenivas, > > The classic I/O (InputStream / OutputStream API based) is perfectly > adequate and works quite well for request / response oriented protocols > such as HTTP/1.1. > > The HTTP/2 protocol is completely different. It is frame based and can > multiplex multiple message exchange streams over the same physical > connection. The message stream multiplexing just does not work well > with the classic I/O. Classic HttpClient 5.x implementation presently > does not support HTTP/2 and most likely never will. If one needs HTTP/2 > one has to switch to Async HttpClient 5.x. > > Oleg > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org > For additional commands, e-mail: httpclient-users-h...@hc.apache.org > >