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: fails when headers contain invalid headers #53855

Closed
kayrus opened this issue Jul 13, 2022 · 1 comment
Closed

net/textproto: fails when headers contain invalid headers #53855

kayrus opened this issue Jul 13, 2022 · 1 comment

Comments

@kayrus
Copy link

kayrus commented Jul 13, 2022

What version of Go are you using (go version)?

$ go version
go version go1.18.3 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What did you do?

See example: https://go.dev/play/p/OLfq5WlWCMf (with a fake UTF colon)

What did you expect to see?

I expect that textproto.ReadMIMEHeader will return parsed headers, skip failed headers and return an error if any along with parsed headers:

Read headers: map[Date:[Mon, 23 Jun 2015 11:40:36 -0400] Subject:[Gophers at Gophercon] To:[Another Gopher <to@example.com>]]

What did you see instead?

I see only first parsed header: Date:[Mon, 23 Jun 2015 11:40:36 -0400]

Further headers are not parsed.

See also: #53854

@seankhliao
Copy link
Member

In general it cannot safely skip malformed headers, since the malformation may affect the parsing of subsequent lines.
This is also consistent with the other go standard library functions that return on first error.

Closing as working as intended

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jul 13, 2022
@golang golang locked and limited conversation to collaborators Jul 13, 2023
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