-
Notifications
You must be signed in to change notification settings - Fork 985
RFC 7639 ALPN #731
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
base: master
Are you sure you want to change the base?
RFC 7639 ALPN #731
Conversation
42fd028 to
6140646
Compare
4b95aca to
8f872b6
Compare
aea3fa3 to
5fa9a19
Compare
5fa9a19 to
16b5442
Compare
|
@arturobernalg Could you please rebase this change-set? |
cc58cd1 to
208b565
Compare
@ok2c done. |
208b565 to
eed86b1
Compare
httpclient5/src/main/java/org/apache/hc/client5/http/impl/AlpnHeaderSupport.java
Show resolved
Hide resolved
| /** | ||
| * Formats a list of raw ALPN protocol IDs into a single {@code ALPN} header value. | ||
| */ | ||
| public static String formatValue(final List<String> protocolIds) { |
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 Use MessageSupport#headerOfTokens instead
| /** | ||
| * Parses an {@code ALPN} header value into decoded protocol IDs. | ||
| */ | ||
| public static List<String> parseValue(final String value) { |
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 Use MessageSupport#parseTokens(Header, Consumer) instead.
733a98c to
a910585
Compare
| tokens.add(encodeId(id)); | ||
| } | ||
| final Header header = MessageSupport.headerOfTokens(HEADER_NAME, tokens); | ||
| return header.getValue(); |
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 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.
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.
@ok2c sorry about that. I think all are fine now
d0b8b57 to
a4b886b
Compare
Emit ALPN on CONNECT tunnels from classic and async exec when configured. Use canonical percent-encoding with liberal decoding for protocol IDs.
a178fe7 to
e343841
Compare
| * Parses an {@code ALPN} header into decoded protocol IDs. | ||
| */ | ||
| public static List<String> parseValue(final Header header) { | ||
| if (header == null) { |
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 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) { |
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 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; |
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 is a protocol error. Should not we treat it as such?
Add ConnectAlpnProvider and inject ALPN header in ConnectExec/AsyncConnectExec. Provide builder hooks for fixed list or provider-driven values.