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

[release-branch.go1.19] net/http: go 1.20.6 host validation breaks setting Host to a unix socket address #61837

Closed
wants to merge 1 commit into from

Conversation

mfrw
Copy link
Contributor

@mfrw mfrw commented Aug 8, 2023

Fixes #61825.

Historically, the Transport has silently truncated invalid
Host headers at the first '/' or ' ' character. CL 506996 changed
this behavior to reject invalid Host headers entirely.
Unfortunately, Docker appears to rely on the previous behavior.

When sending a HTTP/1 request with an invalid Host, send an empty
Host header. This is safer than truncation: If you care about the
Host, then you should get the one you set; if you don't care,
then an empty Host should be fine.

Continue to fully validate Host headers sent to a proxy,
since proxies generally can't productively forward requests
without a Host.

For golang#60374
Fixes golang#61431

Change-Id: If170c7dd860aa20eb58fe32990fc93af832742b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/511155
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
@mfrw mfrw changed the base branch from master to release-branch.go1.19 August 8, 2023 11:01
@gopherbot
Copy link
Contributor

This PR (HEAD: 66b4e9c) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/go/+/516416.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to register for Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

@dmitshur dmitshur changed the title net/http: go 1.20.6 host validation breaks setting Host to a unix socket address [release-branch.go1.19] net/http: go 1.20.6 host validation breaks setting Host to a unix socket address Aug 8, 2023
@gopherbot
Copy link
Contributor

Message from Dmitri Shuralyov:

Patch Set 2: Hold+1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/516416.
After addressing review feedback, remember to publish your drafts!

@mfrw
Copy link
Contributor Author

mfrw commented Aug 9, 2023

cherry-pick CL can be only made via Gerrit and not github.

@mfrw mfrw closed this Aug 9, 2023
@mfrw mfrw deleted the mfrw/fix-host-header branch August 9, 2023 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants