apmhttputil

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DestinationAddr added in v1.7.0

func DestinationAddr(req *http.Request) (string, int)

DestinationAddr returns the destination server address and port for req, a client HTTP request.

If req.URL.Host contains a port it will be returned, and otherwise the default port according to req.URL.Scheme will be returned. If the included port is not a valid integer, or no port is included and the scheme is unknown, the returned port value will be zero.

func RemoteAddr

func RemoteAddr(req *http.Request) string

RemoteAddr returns the remote (peer) socket address for req, a server HTTP request.

func RequestURL

func RequestURL(req *http.Request) model.URL

RequestURL returns a model.URL for req.

If req contains an absolute URI, the values will be split and sanitized, but no further processing performed. For all other requests (i.e. most server-side requests), we reconstruct the URL based on various proxy forwarding headers and other request attributes.

func SchemeDefaultPort added in v1.7.0

func SchemeDefaultPort(scheme string) int

SchemeDefaultPort returns the default port for the given URI scheme, if known, or 0 otherwise.

Types

type ForwardedHeader

type ForwardedHeader struct {
	For   string
	Host  string
	Proto string
}

ForwardedHeader holds information extracted from a "Forwarded" HTTP header.

func ParseForwarded

func ParseForwarded(f string) ForwardedHeader

ParseForwarded parses a "Forwarded" HTTP header.

Jump to

Keyboard shortcuts

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