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

Enhancement Suggestion: Validate URL Scheme in Tonic Channels #1984

Open
rustyconover opened this issue Oct 8, 2024 · 0 comments
Open

Enhancement Suggestion: Validate URL Scheme in Tonic Channels #1984

rustyconover opened this issue Oct 8, 2024 · 0 comments

Comments

@rustyconover
Copy link

Bug Report

Summary

I hope you're doing well! I wanted to bring up a small issue I've encountered while using Tonic. When creating a channel with the grpc URL scheme, I ran into some unexpected HTTP/2 parsing errors because the GRPC server expected the :scheme header value to be either http or https.

Steps to Reproduce

Here’s the code I used to create the channel:

let channel = Channel::from_shared("grpc://127.0.0.1:50051")
    .unwrap()
    .connect()
    .await;

Problem

It seems that using the grpc scheme leads Tonic to send the request with the grpc scheme, but servers may only understand the values of https and http.

As a result, I encountered the following parsing error:

000 00:00:1728430246.326386 50275371 hpack_parser.cc:713] HTTP:1:HDR:SVR: :method: POST
E0000 00:00:1728430246.326399 50275371 hpack_parser.cc:1008] Error parsing ':scheme' metadata: invalid value
I0000 00:00:1728430246.326401 50275371 hpack_parser.cc:713] HTTP:1:HDR:SVR: :scheme: <discarded-invalid-value> (parse error: INTERNAL: Error parsing ':scheme' metadata [type.googleapis.com/grpc.status.int.stream_id='0'])

Suggestion

To enhance the user experience, it might be helpful if Tonic could validate that the URL scheme is either http or https. This small check could prevent others from encountering the same issue and help them have a smoother experience with Tonic.

Version

Here’s the version information for your reference:

$ cargo tree | grep tonic
├── tonic v0.12.3
├── tonic-async-interceptor v0.12.0
│   ├── tonic v0.12.3 (*)
├── tonic-reflection v0.12.3
│   └── tonic v0.12.3 (*)
└── tonic-build v0.11.0

Platform

I’m currently using the following platform:

Darwin Juno.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:14:59 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8122 arm64

Thank you so much for your hard work on Tonic! I really appreciate it, and I hope this feedback is helpful!

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

No branches or pull requests

1 participant