Documentation
¶
Overview ¶
Package httpx holds HTTP primitives shared by the MCP surface (internal/server) and the REST/SSE surface (internal/httpapi). It is a leaf package: it imports nothing from the rest of the tree, so both surfaces can depend on it without an import cycle (internal/server already imports internal/httpapi).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HostMatchesTrusted ¶
HostMatchesTrusted reports whether host matches one of the configured trusted_hosts entries. Matching is case-insensitive on the hostname. An entry without a port matches that hostname on any port; an entry with a port requires the request port to match too. An entry with a leading dot is a subdomain wildcard (Django/Vite/webpack convention): ".example.com" matches example.com and every subdomain of it. The single entry "*" disables validation entirely.
func IsLoopbackHost ¶
IsLoopbackHost reports whether addr refers to a loopback interface. addr may be a bare host ("localhost", "127.0.0.1", "::1", "[::1]") or a host:port pair ("localhost:3000", "127.0.0.1:3000", "[::1]:3000").
func OriginAllowed ¶
OriginAllowed implements the MCP spec's Origin validation (2025-11-25 basic security best practices): a present Origin must be a well-formed serialized origin — scheme://host[:port] over http(s)/ws(s), no userinfo, path, query, or fragment — whose host is loopback or trusted. "null", unparseable, and non-origin-shaped values are invalid. Absence is handled by the caller (non-browser clients don't send Origin at all).
Types ¶
This section is empty.