httpx

package
v0.17.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidForwardedIP = errors.New("invalid forwarded ip")
)

Functions

func HostPort

func HostPort(hp string) (string, int)

func IPFromHostPort

func IPFromHostPort(hp string) string

func IPsFromForwarded added in v0.17.17

func IPsFromForwarded(dst []string, values []string) ([]string, error)

func IPsFromXForwardedFor added in v0.17.17

func IPsFromXForwardedFor(dst []string, values []string) ([]string, error)

func IsValidAuthority added in v0.17.17

func IsValidAuthority(authority string) bool

IsValidAuthority reports whether authority is safe to use as an HTTP Host value for proxying and Forwarded header construction.

This is intentionally a pragmatic ASCII allowlist, not a full DNS/IP validator. It accepts hostname-like reg-names, IPv4-like values, and bracketed IPv6 literals with an optional port. Its primary purpose is to reject Forwarded header delimiters, quoting characters, whitespace, control characters, and other bytes that could change the structure of a Forwarded header.

In particular, ',' and ';' are rejected to prevent Forwarded header element/parameter injection.

func LocalAddress

func LocalAddress(req *http.Request) string

func NewTraceRoundTripper

func NewTraceRoundTripper(rt http.RoundTripper) http.RoundTripper

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL