Am 2022-11-04 um 12:59 schrieb Oleg Kalnichevski:
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.

This also means that https://issues.apache.org/jira/browse/WAGON-606 would never happen unless to be rewritten to the async client.

M


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

Reply via email to