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

golang 1.6 host header parsing changed #15276

Closed
cpuguy83 opened this issue Apr 13, 2016 · 2 comments
Closed

golang 1.6 host header parsing changed #15276

cpuguy83 opened this issue Apr 13, 2016 · 2 comments

Comments

@cpuguy83
Copy link

  1. What version of Go are you using (go version)?
    1.6
  2. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go:/go/src/github.com/docker/docker/vendor"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT=""
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
  1. What did you do?
    See Pre-golang 1.6 Dockers can't talk to golang 1.6 Docker moby/moby#20865

Basically, on older docker clients ( < docker 1.10) docker was setting an invalid host header when using unix sockets. Go versions prior to 1.6 accepted this header just fine, go 1.6 does not.
This was fixed in the Docker 1.10 client, however is a problem for older clients talking to docker binary compiled against go 1.6.

With the invalid host header, golang 1.6 (correctly) causes the http server in the docker daemon to reject the request with:

400 Bad Request: malformed Host header

This is obviously a bug in the older Docker clients, but it means that newer versions of Docker daemon can not be compiled with go 1.6 unless we decide to break compatibility with older clients or have some nasty hacks in the http server.
"Older" clients here means clients that are as young as 4 months old, currently.

  1. What did you expect to see?
    Unsure.
    The Go 1.6 behavior is the "correct" behavior for dealing with the invalid header.
    Ideally, I think we would like to be able to have a path to upgrade to 1.6 (and beyond) without breaking compatibility with older clients.
    Definitely open to suggestions.
  2. What did you see instead?
    The old, invalid host headers are rejected by the http server with:
400 Bad Request: malformed Host header
@bradfitz
Copy link
Contributor

golang 1.6 host header parsing changed

Yes it has. See #13624

What did you expect to see?
Unsure.

:-)

I believe the bug you're looking for is #14952 ("net/http: add switches to accept/send bogus HTTP"), so you could in theory opt-in to accepting garbage in your server.

But there's zero chance of that being backported to a Go 1.6.x version, and I'm undecided on #14952 anyway, plus time is running out for Go 1.7.

So, I think your best bet might be a unix domain socket proxy which replaces Host: /var/run/docker.sock\r\n to Host: \r\n or something. (Maybe it's a bit trickier; I'm not sure whether you use the unix socket in trickier ways, though, using it for auth or sending file descriptors or something.)

@bradfitz
Copy link
Contributor

Closing, because there's nothing to do here. The actionable bug is #14952

@golang golang locked and limited conversation to collaborators Apr 13, 2017
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