Documentation
¶
Overview ¶
Package httpclient is the one place mcpmu builds outbound HTTP clients and reads response bodies. Both the MCP transport and the OAuth flows go through it so every upstream request gets the same redirect policy and every body read is bounded.
Index ¶
Constants ¶
const ( // MaxRedirects is how many hops a client follows before giving up. MaxRedirects = 3 // DefaultConnectTimeout bounds dialing, the TLS handshake and the wait for // response headers. It is deliberately not a whole-request deadline: SSE // bodies stay open indefinitely. DefaultConnectTimeout = 30 * time.Second )
Variables ¶
var ErrBodyTooLarge = errors.New("response body too large")
ErrBodyTooLarge is returned by ReadBody when a response body exceeds the caller's limit.
var ErrCrossOriginRedirect = errors.New("refusing cross-origin redirect")
ErrCrossOriginRedirect is the reason a client refuses to follow a redirect to a different scheme or host.
Functions ¶
func New ¶
New returns a client derived from base (http.DefaultClient when nil) that refuses cross-origin redirects and never applies http.Client.Timeout.
Go replays custom headers — Authorization, Mcp-Session-Id, CF-Access-* — on every hop it follows, so a same-origin-only policy is what keeps an upstream from bouncing our credentials to a third party. Per-request deadlines come from the request context; connection-level timeouts from the transport.
Types ¶
This section is empty.