Documentation
¶
Overview ¶
Package httpproxytest provides a stub HTTP CONNECT proxy for tests.
It is a package rather than a helper in a _test.go file because three packages need the same stub — internal/httpproxy, host/internal and ws — and test files cannot be imported.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Proxy ¶
type Proxy struct {
// URL addresses the proxy and carries no credentials. A test that wants
// Proxy-Authorization copies it and sets User.
URL *url.URL
// contains filtered or unexported fields
}
Proxy is a minimal HTTP CONNECT proxy.
func Start ¶
Start runs a proxy answering CONNECT with status. A 200 splices the tunnel through to the requested target; any other status refuses it.
func StartRaw ¶
StartRaw runs a proxy answering every CONNECT with reply, written verbatim, dialing no target. Whatever follows the header in reply becomes the tunnel's first bytes, which is how a non-conformant proxy is simulated.
func (*Proxy) LastAuth ¶
LastAuth reports the Proxy-Authorization header of the most recent CONNECT, which is "" both when none was sent and when there was no CONNECT at all.
func (*Proxy) LastTarget ¶
LastTarget reports the authority of the most recent CONNECT, or "" if the proxy was never asked for a tunnel.