-
Notifications
You must be signed in to change notification settings - Fork 181
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
Encode/Decode grpc-message status per spec #3023
Conversation
Motivation ---------- At the moment a grpc status message is not percent-encoded which the spec mandates. This is not a problem as long as regular printable ascii characters are used, but other ranges mandate a percent encoding on the wire. Modifications ------------- This changeset implements the percent encoding/decoding for the grpc status message and transparently applies it in the places where the ServiceTalk codebase would access the header previously. The implementation is strongly aligned on the io.grpc equivalent in order to ensure maximum compatibility across systems. Result ------ Properly percent-encoded/decoded grpc-message payload when non ascii-printable characters are sent.
servicetalk-grpc-internal/src/main/java/io/servicetalk/grpc/internal/StatusMessageUtils.java
Outdated
Show resolved
Hide resolved
@idelpivnitskiy looked into the grpc test suite where to put a proper integration test but did not find a good candidate right away. If you have a preference please let me know. |
@daschl |
servicetalk-grpc-internal/src/main/java/io/servicetalk/grpc/internal/StatusMessageUtils.java
Outdated
Show resolved
Hide resolved
servicetalk-grpc-internal/src/main/java/io/servicetalk/grpc/internal/StatusMessageUtils.java
Outdated
Show resolved
Hide resolved
...icetalk-grpc-internal/src/test/java/io/servicetalk/grpc/internal/StatusMessageUtilsTest.java
Outdated
Show resolved
Hide resolved
servicetalk-grpc-internal/src/main/java/io/servicetalk/grpc/internal/StatusMessageUtils.java
Outdated
Show resolved
Hide resolved
servicetalk-grpc-internal/src/main/java/io/servicetalk/grpc/internal/StatusMessageUtils.java
Outdated
Show resolved
Hide resolved
servicetalk-grpc-internal/src/main/java/io/servicetalk/grpc/internal/StatusMessageUtils.java
Outdated
Show resolved
Hide resolved
servicetalk-grpc-netty/src/test/java/io/servicetalk/grpc/netty/ProtocolCompatibilityTest.java
Show resolved
Hide resolved
@bryce-anderson the current implementation in the PR is now as vanilla as it gets w.r.t io.grpc compatibility. From this point on we can decide if we want to optimize etc. |
servicetalk-grpc-internal/src/main/java/io/servicetalk/grpc/internal/GrpcStatusUtils.java
Outdated
Show resolved
Hide resolved
servicetalk-grpc-internal/src/main/java/io/servicetalk/grpc/internal/GrpcStatusUtils.java
Outdated
Show resolved
Hide resolved
servicetalk-grpc-netty/src/test/java/io/servicetalk/grpc/netty/ProtocolCompatibilityTest.java
Outdated
Show resolved
Hide resolved
servicetalk-grpc-internal/src/main/java/io/servicetalk/grpc/internal/GrpcStatusUtils.java
Outdated
Show resolved
Hide resolved
servicetalk-grpc-internal/src/main/java/io/servicetalk/grpc/internal/GrpcStatusUtils.java
Show resolved
Hide resolved
servicetalk-grpc-internal/src/main/java/io/servicetalk/grpc/internal/GrpcStatusUtils.java
Show resolved
Hide resolved
@@ -249,7 +249,7 @@ private static Collection<Arguments> sslAndCompressionParams() { | |||
|
|||
private static Collection<Arguments> statusMessageParams() { | |||
final String[] messages = { | |||
"abc", "Hello, World!", "a\r\nbc", "a%bc", "~ what? ~", | |||
"abc", "Hello, World!", "a\r\nbc", "a%bc", "~ what? ~", "фяї", "üñö", "非常感謝", |
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.
Home those are good words 🤣
Motivation
At the moment a grpc status message is not percent-encoded which the spec mandates. This is not a problem as long as regular printable ascii characters are used, but other ranges mandate a percent encoding on the wire.
Modifications
This changeset implements the percent encoding/decoding for the grpc status message and transparently applies it in the places where the ServiceTalk codebase would access the header previously.
The implementation is strongly aligned on the io.grpc equivalent in order to ensure maximum compatibility across systems.
Result
Properly percent-encoded/decoded grpc-message payload when non ascii-printable characters are sent.