package hack

import "github.com/docker/cli/components/engine/cmd/dockerd/hack"

Index

Types

type MalformedHostHeaderOverride

type MalformedHostHeaderOverride struct {
	net.Listener
}

MalformedHostHeaderOverride is a wrapper to be able to overcome the 400 Bad request coming from old docker clients that send an invalid Host header.

func (*MalformedHostHeaderOverride) Accept

func (l *MalformedHostHeaderOverride) Accept() (net.Conn, error)

Accept makes the listener accepts connections and wraps the connection in a MalformedHostHeaderOverrideConn initializing first to true.

type MalformedHostHeaderOverrideConn

type MalformedHostHeaderOverrideConn struct {
	net.Conn
	// contains filtered or unexported fields
}

MalformedHostHeaderOverrideConn wraps the underlying unix connection and keeps track of the first read from http.Server which just reads the headers.

func (*MalformedHostHeaderOverrideConn) Read

func (l *MalformedHostHeaderOverrideConn) Read(b []byte) (n int, err error)

Read reads the first *read* request from http.Server to inspect the Host header. If the Host starts with / then we're talking to an old docker client which send an invalid Host header. To not error out in http.Server we rewrite the first bytes of the request to sanitize the Host header itself. In case we're not dealing with old docker clients the data is just passed to the server w/o modification.

Source Files

malformed_host_override.go

Version
v17.10.0-ce-rc1+incompatible
Published
Oct 4, 2017
Platform
linux/amd64
Imports
1 packages
Last checked
2 hours ago

Tools for package owners.