Skip to content

Conversation

@arturobernalg
Copy link
Member

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

@ok2c
Copy link
Member

ok2c commented Nov 29, 2025

@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
Member Author

@arturobernalg Could you please rebase this change-set?

@ok2c done.

/**
* Formats a list of raw ALPN protocol IDs into a single {@code ALPN} header value.
*/
public static String formatValue(final List<String> protocolIds) {
Copy link
Member

Choose a reason for hiding this comment

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

@arturobernalg Use MessageSupport#headerOfTokens instead

/**
* Parses an {@code ALPN} header value into decoded protocol IDs.
*/
public static List<String> parseValue(final String value) {
Copy link
Member

Choose a reason for hiding this comment

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

@arturobernalg Use MessageSupport#parseTokens(Header, Consumer) instead.

tokens.add(encodeId(id));
}
final Header header = MessageSupport.headerOfTokens(HEADER_NAME, tokens);
return header.getValue();
Copy link
Member

Choose a reason for hiding this comment

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

@arturobernalg Noooooooo, please do not do that! You create a header with a char buffer, than you you get the value of it as a string, then you make char buffer with a copy of the string and then create a header. Please do not do that.

Please focus more on quality of your contributions than their volume,

My other two comments have not been addressed.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ok2c sorry about that. I think all are fine now

Emit ALPN on CONNECT tunnels from classic and async exec when configured.
Use canonical percent-encoding with liberal decoding for protocol IDs.
* Parses an {@code ALPN} header into decoded protocol IDs.
*/
public static List<String> parseValue(final Header header) {
if (header == null) {
Copy link
Member

Choose a reason for hiding this comment

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

@arturobernalg This is an internal method. It does not need to do strict input validation. This is the responsibility of public methods. Keep it simple and small.

/**
* Encodes a single raw protocol ID to canonical token form.
*/
public static String encodeId(final String id) {
Copy link
Member

Choose a reason for hiding this comment

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

@arturobernalg I asked this already, I have to ask it again. What is the reason for having to re-implement percent coding and not using PercentCodec from core? What is wrong with PercentCodec encoding?

try {
return PercentCodec.decode(token, StandardCharsets.UTF_8);
} catch (final IllegalArgumentException ex) {
return token;
Copy link
Member

Choose a reason for hiding this comment

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

@arturobernalg This is a protocol error. Should not we treat it as such?

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