Navigation Menu

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/textproto: mime header Get expects canonical header form #6252

Closed
eaigner opened this issue Aug 26, 2013 · 3 comments
Closed

net/textproto: mime header Get expects canonical header form #6252

eaigner opened this issue Aug 26, 2013 · 3 comments

Comments

@eaigner
Copy link
Contributor

eaigner commented Aug 26, 2013

If a textproto.MIMEHeader is initialized from a source where header keys are not
canonical, Get won't work on those keys.

  http://play.golang.org/p/_yeMZaJdZv

I suggest comparing the keys using strings.EqualFold instead. It is quite common that
headers are not in their canonical form.
@eaigner
Copy link
Contributor Author

eaigner commented Aug 26, 2013

Comment 1:

Maybe a method to normalize the header would be more efficient, than running through all
the keys on Get.
   // Canonical returns the header with all keys converted to their canonical form.
   func (h MIMEHeader) Canonical() MIMEHeader

@gopherbot
Copy link

Comment 2 by islandberry23:

Use http://golang.org/pkg/net/textproto/#CanonicalMIMEHeaderKey to canonicalize the keys
when constructing the map.

@robpike
Copy link
Contributor

robpike commented Aug 27, 2013

Comment 3:

Status changed to WorkingAsIntended.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants