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

Encode/Decode grpc-message status per spec #3023

Merged
merged 9 commits into from
Aug 2, 2024
Merged

Conversation

daschl
Copy link
Contributor

@daschl daschl commented Jul 30, 2024

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.

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.
@daschl daschl requested a review from idelpivnitskiy July 30, 2024 13:34
@daschl
Copy link
Contributor Author

daschl commented Jul 30, 2024

@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.

@idelpivnitskiy
Copy link
Member

@daschl ProtocolCompatibilityTest will be the right one. We need to make sure that any combination of st/grpc-java works consistently with each other

@daschl
Copy link
Contributor Author

daschl commented Jul 31, 2024

@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.

@@ -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? ~", "фяї", "üñö", "非常感謝",
Copy link
Member

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 🤣

@daschl daschl merged commit 9f68119 into apple:main Aug 2, 2024
11 checks passed
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.

3 participants