Skip to content

Conversation

@lorban
Copy link
Contributor

@lorban lorban commented Dec 15, 2025

Fixes #14134

…2 information to the backend

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban lorban requested a review from sbordet December 15, 2025 11:49
@lorban lorban self-assigned this Dec 15, 2025
@lorban lorban added the Bug For general bugs on Jetty side label Dec 15, 2025
@lorban lorban moved this to 👀 In review in Jetty 12.1.6 Dec 15, 2025
* Added test to show how to forward V2.Tag information in ProxyHandler.Reverse.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
}

proxyEndPoint = new ProxyEndPoint(endPoint, local, remote, tlvs, client == 0 ? null : EndPoint.SslSessionData.from(null, null, sslCipher, null));
proxyEndPoint = new ProxyEndPoint(endPoint, local, remote, tlvs, (client & PP2_CLIENT_SSL) == 0 ? null : EndPoint.SslSessionData.from(null, null, sslCipher, null));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be reverted, because client == 2 or client == 4 also mean that the connection was secured.

Comment on lines 450 to 453
public static final int TYPE_SSL = 0x20;
public static final int CLIENT_SSL = 0x01;
public static final int SUBTYPE_SSL_VERSION = 0x21;
public static final int SUBTYPE_SSL_CIPHER = 0x23;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those constants are already declared in ProxyV2ConnectionFactory although private. If we have to duplicate them, I'd very much prefer that the duplication is in test code.

I'm also not fond of the fact that those constant names don't exactly match the ones defined in the spec (all the same but with the PP2_ prefix).


List<V2.Tag.TLV> tlvs = List.of();
if (secure)
tlvs = List.of(new V2.Tag.TLV(V2.Tag.TLV.TYPE_SSL, new byte[]{V2.Tag.TLV.CLIENT_SSL}));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

My version used to test both 1 (PP2_CLIENT_SSL) and 2 (PP2_CLIENT_CERT_CONN) as the PROXY protocol specification chapter 2.2.6 (The PP2_TYPE_SSL type and subtypes) states that the client connected over SSL/TLS only when PP2_CLIENT_SSL (bit 0) is 1.

* Renamed constants adding PP2_ prefix as per the specification.
* Improved test case.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@lorban lorban requested a review from sbordet December 18, 2025 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug For general bugs on Jetty side

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

Improve detection of secure requests for HTTP/1

2 participants