-
Notifications
You must be signed in to change notification settings - Fork 3.9k
netty: Support pseudo headers in all GrpcHttp2RequestHeaders methods #9004
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
Conversation
The previous code assumed that only gRPC would be using these methods. But twice now Netty has made a change (generally relating to security) that used a method for pseudo headers that previously wasn't supported. Let's stop the whack-a-mole and just implement them all. This restores compatibility with Netty 4.1.75.Final. Fixes grpc#8981
@@ -340,7 +340,12 @@ public Http2Headers add(CharSequence csName, CharSequence csValue) { | |||
AsciiString name = validateName(requireAsciiString(csName)); | |||
AsciiString value = requireAsciiString(csValue); | |||
if (isPseudoHeader(name)) { | |||
addPseudoHeader(name, value); | |||
AsciiString previous = getPseudoHeader(name); |
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.
It'd be possible to implement this without a get-then-set if setPseudoHeader()
returned the old value. We'd have to re-set the old value if there was one already present, but that's not the worst. Returning-old-valuesetPseudoHeader()
would seem to most benefit remove()
, but it isn't safe for remove because it would throw for remove(":status')
. Having the returning-old-value setPseudoHeader()
made it really easy to make mistakes, so I went with the KISS approach. These code paths don't matter for performance.
netty/src/test/java/io/grpc/netty/GrpcHttp2HeadersUtilsTest.java
Outdated
Show resolved
Hide resolved
I had these changes locally, but failed to use "-a" for my "git commit" to add them...
- grpc < 1.45.1 is not compatible with Netty > 4.1.74.Final - grpc/grpc-java#9004
- grpc < 1.45.1 is not compatible with Netty > 4.1.74.Final - grpc/grpc-java#9004
- grpc < 1.45.1 is not compatible with Netty > 4.1.74.Final - grpc/grpc-java#9004
) * Upgrade Netty to 4.1.76.Final and Netty Tcnative to 2.0.51.Final Fixes #14015 - release notes https://netty.io/news/2022/04/12/4-1-76-Final.html - contains fix for netty/netty#11695 * Upgrade grpc to 1.45.1 and protobuf to 3.19.2 - grpc < 1.45.1 is not compatible with Netty > 4.1.74.Final - grpc/grpc-java#9004
…che#15212) * Upgrade Netty to 4.1.76.Final and Netty Tcnative to 2.0.51.Final Fixes apache#14015 - release notes https://netty.io/news/2022/04/12/4-1-76-Final.html - contains fix for netty/netty#11695 * Upgrade grpc to 1.45.1 and protobuf to 3.19.2 - grpc < 1.45.1 is not compatible with Netty > 4.1.74.Final - grpc/grpc-java#9004
…che#15212) * Upgrade Netty to 4.1.76.Final and Netty Tcnative to 2.0.51.Final Fixes apache#14015 - release notes https://netty.io/news/2022/04/12/4-1-76-Final.html - contains fix for netty/netty#11695 * Upgrade grpc to 1.45.1 and protobuf to 3.19.2 - grpc < 1.45.1 is not compatible with Netty > 4.1.74.Final - grpc/grpc-java#9004 (cherry picked from commit 332a3c7)
) * Upgrade Netty to 4.1.76.Final and Netty Tcnative to 2.0.51.Final Fixes #14015 - release notes https://netty.io/news/2022/04/12/4-1-76-Final.html - contains fix for netty/netty#11695 * Upgrade grpc to 1.45.1 and protobuf to 3.19.2 - grpc < 1.45.1 is not compatible with Netty > 4.1.74.Final - grpc/grpc-java#9004 (cherry picked from commit 332a3c7)
) * Upgrade Netty to 4.1.76.Final and Netty Tcnative to 2.0.51.Final Fixes #14015 - release notes https://netty.io/news/2022/04/12/4-1-76-Final.html - contains fix for netty/netty#11695 * Upgrade grpc to 1.45.1 and protobuf to 3.19.2 - grpc < 1.45.1 is not compatible with Netty > 4.1.74.Final - grpc/grpc-java#9004 (cherry picked from commit 332a3c7)
…che#15212) * Upgrade Netty to 4.1.76.Final and Netty Tcnative to 2.0.51.Final Fixes apache#14015 - release notes https://netty.io/news/2022/04/12/4-1-76-Final.html - contains fix for netty/netty#11695 * Upgrade grpc to 1.45.1 and protobuf to 3.19.2 - grpc < 1.45.1 is not compatible with Netty > 4.1.74.Final - grpc/grpc-java#9004 (cherry picked from commit 332a3c7)
…che#15212) * Upgrade Netty to 4.1.76.Final and Netty Tcnative to 2.0.51.Final Fixes apache#14015 - release notes https://netty.io/news/2022/04/12/4-1-76-Final.html - contains fix for netty/netty#11695 * Upgrade grpc to 1.45.1 and protobuf to 3.19.2 - grpc < 1.45.1 is not compatible with Netty > 4.1.74.Final - grpc/grpc-java#9004 (cherry picked from commit 332a3c7)
) * Upgrade Netty to 4.1.76.Final and Netty Tcnative to 2.0.51.Final Fixes #14015 - release notes https://netty.io/news/2022/04/12/4-1-76-Final.html - contains fix for netty/netty#11695 * Upgrade grpc to 1.45.1 and protobuf to 3.19.2 - grpc < 1.45.1 is not compatible with Netty > 4.1.74.Final - grpc/grpc-java#9004 (cherry picked from commit 332a3c7)
…che#15212) * Upgrade Netty to 4.1.76.Final and Netty Tcnative to 2.0.51.Final Fixes apache#14015 - release notes https://netty.io/news/2022/04/12/4-1-76-Final.html - contains fix for netty/netty#11695 * Upgrade grpc to 1.45.1 and protobuf to 3.19.2 - grpc < 1.45.1 is not compatible with Netty > 4.1.74.Final - grpc/grpc-java#9004 (cherry picked from commit 332a3c7)
The previous code assumed that only gRPC would be using these methods.
But twice now Netty has made a change (generally relating to security)
that used a method for pseudo headers that previously wasn't supported.
Let's stop the whack-a-mole and just implement them all.
This restores compatibility with Netty 4.1.75.Final. Fixes #8981
CC @njhill
Alternative to #9001