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/http: unexpected malformed MIME header error #63168

Closed
hy950921 opened this issue Sep 22, 2023 · 7 comments
Closed

net/http: unexpected malformed MIME header error #63168

hy950921 opened this issue Sep 22, 2023 · 7 comments
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@hy950921
Copy link

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

$ go version
just upgraded to 1.20.8 from 1.17

Does this issue reproduce with the latest release?

we are having it in 1.20.8 but not in 1.17

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
macos locally

What did you do?

running the url test locally

What did you expect to see?

a status code 200 is returned

What did you see instead?

500 is returned and error message=net/http: HTTP/1.x transport connection broken: malformed MIME header line: (.*)A:B

FYI: (.*)A is defined as a queryparameter and B is the value here. idk why it is identified as MIME header here.

@ianlancetaylor
Copy link
Contributor

Can you show us a standalone program that reproduces the problem? I don't understand the problem from your description. Thanks.

@ianlancetaylor ianlancetaylor changed the title affected/package: net/http net/http: unexpected malformed MIME header error Sep 22, 2023
@ianlancetaylor ianlancetaylor added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Sep 22, 2023
@hy950921
Copy link
Author

hy950921 commented Sep 22, 2023

@ianlancetaylor
It is an enterprise config driven routing application, I can only share more details in words here. I am upgrading the golang version from 1.17 to 1.20.8, and I am getting some errors after running our URL tests in CI/locally. The error message from the log says "net/http: HTTP/1.x transport connection broken: malformed MIME header line: (. * )foo:bar". However, in our config definition, (. * )foo is defined as the name of queryparameter and bar is defined as the value of queryparameter. I am wondering that what changed to have this issue.

@seankhliao
Copy link
Member

we'd need to see the request it's making to determine if it's valid

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Sep 22, 2023
@ianlancetaylor
Copy link
Contributor

CC @neild

@ianlancetaylor
Copy link
Contributor

This may be due to https://go.dev/cl/410714, which restricts the bytes permitted in MIME headers to those listed in RFC 7230.

@hy950921
Copy link
Author

hy950921 commented Oct 2, 2023

@ianlancetaylor Thanks, I can confirm this is the root cause for me, is there any easy fix for experiencing such issue, we used to have some characters "parentheses" that are not allowed in 1.20 but we are hoping to keep them.

@ianlancetaylor
Copy link
Contributor

Unfortunately, there is no easy fix, as the change was made for security reasons. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants