Skip to content

Adding the client hello sni information at Connection.sniHostName()#58

Merged
jaylu merged 8 commits into3redronin:masterfrom
jaylu:sni-3
Feb 27, 2026
Merged

Adding the client hello sni information at Connection.sniHostName()#58
jaylu merged 8 commits into3redronin:masterfrom
jaylu:sni-3

Conversation

@jaylu
Copy link
Collaborator

@jaylu jaylu commented Feb 13, 2026

Adding the client hello sni information at Connection.sniHostName(), below is the implementation details:

  • the client sni info is captured in the MuSniHandler and stored as channel attributes.
  • given the SniHandler change the life cycle of the SslHandler and break the HAProxy stuff, so we apply the same pattern as above to simplify the code and get things fixed.

@jaylu jaylu requested a review from danielflower February 13, 2026 14:03
@jaylu
Copy link
Collaborator Author

jaylu commented Feb 18, 2026

Hi @danielflower please feel free to do a review

@danielflower
Copy link
Contributor

Can you make public-facing API changes to the mu3 branch too? The impl can just throw an exception saying "Not implemented". And copy the test in which would fail and mark it as ignored. This is so we don't miss this feature if/when mu3 is released. Thanks

import java.util.function.Supplier;


public class MuSniHandler extends SniHandler {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this handler needed? Can the logic just be on the Connection itself?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

when the SniHandler trigger the SniCompletionEvent, the connection haven't been added into the pipeline yet.

The AlpnHandler ( the mu one) can see that event, my initial implementation was put in the AlpnHandler. But later we decide to use the connection attribute, so better to put the SNI things in one place. that's why put it here.

This class also overwrite the newSslHandler() method too, which to cater the existing logic for setting the SslEngine's param.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, can we not make it a non public class then? Don’t want to expand the public api

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

@jaylu
Copy link
Collaborator Author

jaylu commented Feb 24, 2026

Can you make public-facing API changes to the mu3 branch too? The impl can just throw an exception saying "Not implemented". And copy the test in which would fail and mark it as ignored. This is so we don't miss this feature if/when mu3 is released. Thanks

Just pushed to the mu3 branch

a265306

4f66593

ProxiedConnectionInfoImpl proxyConnectionInfo = ProxiedConnectionInfoImpl.fromNetty(msg);
ctx.channel().attr(HA_PROXY_INFO).set(proxyConnectionInfo);
if (!ctx.channel().config().isAutoRead()) {
ctx.read();
Copy link
Collaborator Author

@jaylu jaylu Feb 25, 2026

Choose a reason for hiding this comment

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

one thing to highlight, for JDK 8, if not doing this extra ctx.read(), it will randomly failed the text - client request timeout.

@jaylu
Copy link
Collaborator Author

jaylu commented Feb 25, 2026

Hi @danielflower , if you are fine, I will do the squash merge

@danielflower
Copy link
Contributor

Hi @danielflower , if you are fine, I will do the squash merge

Okay sure, go for it. Thanks

@jaylu jaylu merged commit 751fbee into 3redronin:master Feb 27, 2026
5 checks passed
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