Documentation
¶
Overview ¶
Package httpurl contains validation shared by HTTP URL construction boundaries. It deliberately does not decide whether a particular caller may use plaintext; production-mode policy remains at the application boundary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMissingHost reports an HTTP authority with no host component. ErrMissingHost = errors.New("must have a host") // ErrInvalidHostname reports an authority such as :443 or . that has a // syntactic Host value but no usable destination hostname. ErrInvalidHostname = errors.New("must have a non-empty, non-dot hostname") // ErrInvalidPort reports an explicitly configured TCP port outside the // usable 1..65535 range (including an empty explicit port). ErrInvalidPort = errors.New("explicit port must be between 1 and 65535") )
Functions ¶
func NormalizeOrigin ¶
NormalizeOrigin validates raw as an HTTP(S) origin and returns its one canonical spelling. A single trailing slash is accepted and removed. Empty query and fragment markers are rejected rather than silently discarded, so configuration and direct client construction enforce the same boundary.
func ValidateAuthority ¶
ValidateAuthority proves that parsed has a usable HTTP destination authority. url.Parse rejects malformed and non-numeric ports, but it accepts port-only hosts (":443"), empty explicit ports, port zero, and values above 65535. Leaving those until transport time can turn a durable side effect into an indefinitely undeliverable request; a port-only host can also resolve to a local/unspecified destination.
Types ¶
This section is empty.