Skip to content
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

Fixes #3553 - Support sslSession() in Jetty Client. #12179

Merged
merged 3 commits into from
Aug 26, 2024

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented Aug 20, 2024

Implemented Connection.getSSLSession(), where the Connection can be obtained from the Request: request.getConnection().getSSLSession().

Updated documentation.

Implemented Connection.getSSLSession(), where the Connection can be obtained from the Request:
request.getConnection().getSSLSession().

Updated documentation.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet requested a review from gregw August 20, 2024 19:12
@sbordet sbordet linked an issue Aug 20, 2024 that may be closed by this pull request
* @return the {@link SSLSession} associated with the connection, or {@code null}
* if the connection is not secure or the {@link SSLSession} is not available.
*/
default SSLSession getSSLSession()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any benefit of returning an EndPoint.SslSessionData instead? It can provide more information or just the ID if the actual session is abstracted away.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see much benefit? SSLSession is from the JDK, so it is well known.
Also, this is the client, and it does not need the number of tricks the server should support when it's behind a reverse proxy (e.g. support non-standard HTTP headers that a proxy may add that specify the cipher suite, etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gregw actually, I changed my mind.

The reason being HTTP/3, which won't have an SSLSession, but there could be enough information to return the cipher suite and the peer certificates.

@sbordet sbordet requested a review from gregw August 21, 2024 08:40
gregw
gregw previously approved these changes Aug 21, 2024
The reason is to allow return some information for HTTP/3.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
gregw
gregw previously approved these changes Aug 26, 2024
Comment on lines +1038 to +1039
if (sslSessionData == null)
r.abort(new IllegalStateException());
Copy link
Contributor

Choose a reason for hiding this comment

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

So we are saying that having a non null SslSessionData, even with all the fields null, is saying that the endpoint/connection is Ssl. I think this is consistent with other usage in the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's just that we could not gather the TLS data (cipher, certificates, etc.).

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet merged commit 21f2f2a into jetty-12.0.x Aug 26, 2024
2 of 4 checks passed
@sbordet sbordet deleted the fix/jetty-12.0.x/3553/http-client-sslsession branch August 26, 2024 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Support sslSession() in Jetty Client
2 participants