On Thu, 2023-07-20 at 15:13 +0200, Konrad Windszus wrote: > Hi, > Currently from reading > https://hc.apache.org/httpcomponents-client-5.2.x/ it seems that > there are no limitations with support of HTTP/2, on the other hand > only Async API has explicit HTTP/2 examples mentioned in > https://hc.apache.org/httpcomponents-client-5.2.x/examples-async.html > . > Does the classic (blocking) API also support HTTP/2 protocol or only > 1 and 1.1? > > Can you maybe clarify that a bit on the website? > Thanks in advance, > Konrad
Hi Konrad The classic i/o based transport presently supports HTTP/1.1 only and this is not likely to change in the foreseeable future. The truth is that there is no reasonable way in terms of functionality and performance (I know of) to implement the requirements of the HTTP/2 protocol using Java classic (blocking) i/o. HTTP/2 connections work in a fully multiplexing mode which can only be implemented with the classic i/o by using multiple (at least two) concurrent threads involving complex synchronization between those threads. It just does not work well, does not scale and does not perform well. I did try. What other libraries do is they emulate the InputStream / OutputStream APIs on top of NIO, which does provide the end user with APIs compatible with the classic i/o but at the substantial cost in terms of complexity and performance. I do not think we should follow the same approach, at least not short- or mid-term. In my personal opinion the use of HTTP/2 at its full potential requires event driven (async) programming interface incompatible with the InputStream / OutputStream based APIs. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org