Add RFC 8297 (103 Early Hints) support to HttpClient5 (async)#707
Conversation
|
Hi all, The page https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/103 suggests |
For what I understand MDN’s note is a deployment recommendation, not a protocol limit. RFC 8297 does not restrict 103 to HTTP/2+ |
Check. I wonder if the fact that this is an RFC marked "Experimental" should be of concern, or at least mentioned in the Javadoc. |
The RFC text is immutable, so the body still says “Experimental” (that’s the original 2017 publication). However, the IESG later changed the status to Proposed Standard; that action is recorded separately and Datatracker now shows the badge accordingly. Official status-change doc (Feb 5, 2025) is here.  |
|
Thank you for the details @arturobernalg 👌 |
And rightly so. HTTP/1.1's framing is inherently unreliable and they're still finding desync attacks in the wild. Additionally, this type of scheme works best with async IO, so that the I agree that the client should at least tolerate |
|
@arturobernalg I agree with @rschmitt I would not add this feature to the classic transport at all. The implementation for the classic i/o looks clumsy and it is not worth it. |
@ok2c I’ll scope Early Hints to the async client only and drop the classic wiring. |
5d407af to
cb650da
Compare
4a34b97 to
26d51f6
Compare
ok2c
left a comment
There was a problem hiding this comment.
@arturobernalg Looks good overall. An example / sample app would be nice, though.
| final AsyncEntityProducer entityProducer, | ||
| final AsyncExecChain.Scope scope, | ||
| final AsyncExecChain chain, | ||
| final AsyncExecCallback callback) throws HttpException, java.io.IOException { |
There was a problem hiding this comment.
@arturobernalg This one still uses full class name. Should it?
6ce04b9 to
66db92a
Compare
36e1959 to
0ee138f
Compare
ok2c
left a comment
There was a problem hiding this comment.
@arturobernalg There is still one unresolved comment
Expose EarlyHintsListener + builder hooks ( only for async) Deliver 103 via EarlyHintsAsyncExec; final response unchanged
fb04b3f to
0fc9dd2
Compare
solve. sorry @ok2c I overlooked it |
Introduces EarlyHintsListener to surface 103 Early Hints without altering final response flow.
Wires listener via HttpClientBuilder#setEarlyHintsListener(...) and HttpAsyncClientBuilder#setEarlyHintsListener(...).
Handles 103 in classic (MainClientExec) and async (EarlyHintsAsyncExec).
Early Hints (RFC 8297) allows servers to advise clients (typically via Link preload/preconnect) before the final response. Libraries should expose these hints while keeping normal processing intact.