hack

package
v1.12.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2016 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 initilizing 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL