Skip to content

RFC 7639 ALPN #731

Open
arturobernalg wants to merge 1 commit into
apache:masterfrom
arturobernalg:rfc7639
Open

RFC 7639 ALPN #731
arturobernalg wants to merge 1 commit into
apache:masterfrom
arturobernalg:rfc7639

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

Add ConnectAlpnProvider and inject ALPN header in ConnectExec/AsyncConnectExec. Provide builder hooks for fixed list or provider-driven values.

@ok2c

ok2c commented Nov 29, 2025

Copy link
Copy Markdown
Member

@arturobernalg Could you please rebase this change-set?

@arturobernalg arturobernalg force-pushed the rfc7639 branch 2 times, most recently from cc58cd1 to 208b565 Compare December 20, 2025 12:20
@arturobernalg

Copy link
Copy Markdown
Member Author

@arturobernalg Could you please rebase this change-set?

@ok2c done.

Comment thread httpclient5/src/main/java/org/apache/hc/client5/http/impl/AlpnHeaderSupport.java Outdated
Comment thread httpclient5/src/main/java/org/apache/hc/client5/http/impl/AlpnHeaderSupport.java Outdated
Comment thread httpclient5/src/main/java/org/apache/hc/client5/http/impl/AlpnHeaderSupport.java Outdated
Comment thread httpclient5/src/main/java/org/apache/hc/client5/http/impl/AlpnHeaderSupport.java Outdated
@arturobernalg arturobernalg force-pushed the rfc7639 branch 2 times, most recently from a178fe7 to e343841 Compare January 12, 2026 09:57
@arturobernalg arturobernalg requested a review from ok2c January 12, 2026 10:35
Comment thread httpclient5/src/main/java/org/apache/hc/client5/http/impl/AlpnHeaderSupport.java Outdated
Comment thread httpclient5/src/main/java/org/apache/hc/client5/http/impl/AlpnHeaderSupport.java Outdated
* @return this builder
* @since 5.6
*/
public HttpAsyncClientBuilder setConnectAlpn(final String... ids) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arturobernalg What should happen if the caller passes h3, http/0.75, srtuff to this method?

Why do we even need this method at all? There is already HttpVersionPolicy settable on a per route basis and this is exactly what you should be using should you decide to proceed further with this feature.

@ok2c

ok2c commented May 31, 2026

Copy link
Copy Markdown
Member

@arturobernalg This change can still make it into 5.7 if you are willing to invest time into it.

Encode protocol IDs with core's PercentCodec.HTTP_TOKEN (canonical RFC 7230 tchar form, uppercase hex) and decode strictly, rejecting malformed percent-encoding with ProtocolException. Configure via ConnectAlpnProvider through setConnectAlpnProvider on the classic and async builders; ConnectExec/AsyncConnectExec emit the header when a provider is set.
@arturobernalg

Copy link
Copy Markdown
Member Author

@arturobernalg This change can still make it into 5.7 if you are willing to invest time into it.

@ok2c please do another pass

* @return list of protocol IDs (e.g., {@code "h2"}, {@code "http/1.1"});
* {@code null} or empty to omit the header
*/
List<String> getAlpnForTunnel(HttpHost target, HttpRoute route);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arturobernalg Same question that I already asked you before. What do you think should happen if this provider returns something other than h2 or http/1.1 from supported ApplicationProtocol enum? Why do we need this interface at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants