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

net/mail: not clear that Header.Get is case insensitive #18019

Closed
mvdan opened this issue Nov 22, 2016 · 1 comment
Closed

net/mail: not clear that Header.Get is case insensitive #18019

mvdan opened this issue Nov 22, 2016 · 1 comment
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mvdan
Copy link
Member

mvdan commented Nov 22, 2016

Reading the godoc:

    func (h Header) Get(key string) string

Get gets the first value associated with the given key. If there are no values associated with the key, Get returns "".

It's not immediately obvious that key is not case sensitive. As it turns out, Get("From") and Get("from") mean the same because internally this all goes through https://golang.org/pkg/net/textproto/#CanonicalMIMEHeaderKey.

Perhaps this is just me not being used to MIME Headers being canonical in this way. But I think a sentence like "note that key is case insensitive as it is canonicalized" would help some people. The net/mail godoc does not mention MIME headers anywhere either.

Perhaps this should go in net/textproto too, even though that's much closer to the actual CanonicalMIMEHeaderKey func.

@quentinmit quentinmit added Documentation NeedsFix The path to resolution is known, but the work has not been done. labels Nov 22, 2016
@quentinmit quentinmit added this to the Go1.8Maybe milestone Nov 22, 2016
@gopherbot
Copy link

CL https://golang.org/cl/33530 mentions this issue.

@golang golang locked and limited conversation to collaborators Nov 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants