-
Notifications
You must be signed in to change notification settings - Fork 982
Add RFC 8297 (103 Early Hints) support to HttpClient5 (async) #707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arturobernalg Looks good overall. An example / sample app would be nice, though.
httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/EarlyHintsAsyncExec.java
Outdated
Show resolved
Hide resolved
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arturobernalg Why full class name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arturobernalg This one still uses full class name. Should it?
httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/EarlyHintsAsyncExec.java
Outdated
Show resolved
Hide resolved
httpclient5/src/test/java/org/apache/hc/client5/http/impl/async/EarlyHintsAsyncExecTest.java
Show resolved
Hide resolved
6ce04b9 to
66db92a
Compare
httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncEarlyHintsEndToEndDemo.java
Outdated
Show resolved
Hide resolved
36e1959 to
0ee138f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.