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

gRPC should encode Metadata headers as lowercase #415

Closed
mwitkow opened this issue Oct 27, 2015 · 3 comments · Fixed by #470
Closed

gRPC should encode Metadata headers as lowercase #415

mwitkow opened this issue Oct 27, 2015 · 3 comments · Fixed by #470
Milestone

Comments

@mwitkow
Copy link
Contributor

mwitkow commented Oct 27, 2015

According to the HTTP2 spec:

However, header field names MUST be converted to lowercase prior to their encoding in HTTP/2.

Currently if you set a value in Metadata to be uppercase "Bar", the receiving server will also get it as "Bar".

Not really sure how we should fix it, in gRPC (t *http2Client) NewStream() (grpc/transport/http2_client.go:232) or upstream in (e *Encoder) WriteField(f HeaderField) of (golang.org/x/net/http2/hpack/encode.go:49)

@mwitkow
Copy link
Contributor Author

mwitkow commented Oct 27, 2015

@bradfitz as he's the maintainer of http2/hpack: should hEnc.WriteField force the lower case encoding of field names?

@bradfitz
Copy link
Contributor

Note that only the http2 spec says that field names must be lowercase (https://httpwg.github.io/specs/rfc7540.html#rfc.section.8.1.2). The hpack spec says nothing about it. I believe in theory other protocols could use hpack but make different decisions about the case of fields.

So I'm inclined to say it's the caller's responsibility.

But perhaps we can add a boolean to hpack.Encoder like AllowCapital bool defaulting to true from NewEncoder so people CAN do weird things if they want, like the options in the http2 framer to send illegal frames.

@iamqizhao
Copy link
Contributor

I do have plan to enforce this in metadata package.

@iamqizhao iamqizhao modified the milestone: GA Nov 6, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Sep 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants