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

Removed jm.CustomHeader from TlsSessionInfo heirarchy #4427

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

jroper
Copy link
Contributor

@jroper jroper commented Sep 24, 2024

Fixes #4426.

When TlsSessionInfo was added, the only way to mark it as a header that should not be rendered was to implement CustomHeader, and then implement a method called suppressRendering to return true.

Obviously, this semantically didn't make sense since it's not a custom header, but not long after, a much better, more robust and semantically reasonable mechanism to ensure it didn't get rendered was provided in:

akka/akka@a93a73e

This added renderInRequests and renderInResponses flags to headers, along with the traits RequestHeader, ResponseHeader, and SyntheticHeader. The Scala Tls-Session-Info class was modified to implement SyntheticHeader instead of the Scala CustomHeader trait, but the author forgot to modify the Java TlsSessionInfo class to no longer extend the Java CustomHeader class.

This didn't cause any real issue at the time, because there was nowhere that the Java CustomHeader class was returned or accepted by any API calls, or treated specially in anyway. That was, until #4348, which caused the modelled header lookup method to throw an exception, instead of return None, when the header is not present, if it extends the Java CustomHeader class.

So, this change removes CustomHeader from the superclass heirarchy of TlsSessionInfo, and instead makes it implement the Scala HttpHeader class directly, like all other headers. As far as I can tell, this should cause no issues, as CustomHeader is otherwise still not treated specially anywhere or exposed in any API. It would only cause an issue if some end user code tried to assign it to a CustomHeader typed variable, which I don't see any reason to ever do that.

jroper and others added 2 commits September 24, 2024 10:44
When `TlsSessionInfo` was added, the only way to mark it as a header that
not be rendered was to implement `CustomHeader`, and then implement a method
called `suppressRendering` to return `true`.

Obviously, this semantically didn't make sense since it's not a custom header,
but not long after, a much better, more robust and semantically reasonable
mechanism to ensure it didn't get rendered was provided in:

akka/akka@a93a73e

This added `renderInRequests` and `renderInResponses` flags to headers, along
with the traits `RequestHeader`, `ResponseHeader`, and `SyntheticHeader`. The
Scala `Tls-Session-Info` class was modified to implement `SyntheticHeader`
instead of the Scala `CustomHeader` trait, but the author forgot to modify the
Java `TlsSessionInfo` class to no longer extend the Java `CustomHeader`
class.

This didn't cause any real issue at the time, because there was nowhere that
the Java `CustomHeader` class was returned or accepted by any API calls, or
treated specially in anyway. That was, until akka#4348, which caused the modelled
header lookup method to throw an exception, instead of return `None`, when the
header is not present, if it extends the Java `CustomHeader` class.

So, this change removes `CustomHeader` from the superclass heirarchy of
`TlsSessionInfo`, and instead makes it implement the Scala `HttpHeader` class
directly, like all other headers. As far as I can tell, this should cause no
issues, as `CustomHeader` is otherwise still not treated specially anywhere or
exposed in any API. It would only cause an issue if some end user code tried to
assign it to a `CustomHeader` typed variable, which I don't see any reason to
ever do that.
@johanandren johanandren merged commit 3e053fd into akka:main Oct 4, 2024
8 checks passed
@jroper jroper deleted the tls-session-info-not-custom-header branch October 7, 2024 05:23
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.

TlsSessionInfo implements CustomHeader
2 participants