Documentation
¶
Overview ¶
Package proxytarget keeps a plain-HTTP request's destination intact when it is forwarded through an HTTP proxy (Burp, --proxy http://…, HTTP_PROXY).
A forward proxy routes a plain-HTTP request by the absolute-form request target ("GET http://host:port/path HTTP/1.1"), and net/http writes that target from req.Host, not req.URL.Host (Request.write in net/http). When the Host header deliberately differs from the URL being fetched — a Host-header-injection probe, a fuzzed Host, a vhost probe, a replay retargeted at another environment, or a Host captured without the port — the proxy is told to fetch the Host header's authority and forwards the request there instead of to the target.
Transport fixes that one case: for a plain-HTTP request sent through an HTTP or HTTPS proxy whose Host differs from req.URL.Host, it sends the absolute form built from req.URL (scheme://host:port/path) while the Host header still carries the override. Every other request passes through unchanged: direct connections, SOCKS proxies (which dial req.URL's host:port), and https targets (tunnelled with CONNECT to req.URL's host:port).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base ¶
func Base(rt http.RoundTripper) (*http.Transport, bool)
Base returns the *http.Transport behind rt: rt itself when it is one, the embedded transport when rt is a *Transport, else nil and false. Callers that adjust a client's transport after construction use it so wrapping does not hide the transport from them.
Types ¶
type Transport ¶
Transport is an *http.Transport whose RoundTrip keeps req.URL's authority in the request target sent to an HTTP proxy. The embedded transport carries all configuration (Proxy, TLS, dialers, pools); its other methods, such as CloseIdleConnections, are promoted unchanged. Safe for concurrent use.