Documentation
¶
Index ¶
- Variables
- func CollectMetricNames(header string, timings ServerTimings)
- func HasEmptyOrDotSegment(path string) bool
- func JoinOpenAPIPath(elements ...string) string
- func JoinPath(elements ...string) string
- func MergeMetrics(src, dest ServerTimings)
- func NormalizePath(escaped string) (string, error)
- func NormalizeURLPath(u *url.URL) error
- type ServerTimings
Constants ¶
This section is empty.
Variables ¶
var ( BuildDate = "" BuildName = "dev" VersionName = "0" )
var ErrPathAboveRoot = errors.New("path resolves above the root")
ErrPathAboveRoot reports a path whose dot segments resolve above the root.
Functions ¶
func CollectMetricNames ¶
func CollectMetricNames(header string, timings ServerTimings)
CollectMetricNames collects metric names from the given Server-Timing HTTP header field. See https://www.w3.org/TR/server-timing/
func HasEmptyOrDotSegment ¶ added in v1.14.6
HasEmptyOrDotSegment reports whether a decoded path contains an empty or dot segment. A trailing slash is not an empty segment.
func JoinOpenAPIPath ¶
func JoinPath ¶
JoinPath ensures the file-muxer behaviour for redirecting '/path' to '/path/' if not explicitly specified.
func MergeMetrics ¶
func MergeMetrics(src, dest ServerTimings)
MergeMetrics merges timings from 'src' into 'dest'.
func NormalizePath ¶ added in v1.14.6
NormalizePath removes dot segments and merges slashes of an escaped path (RFC 3986 section 5.2.4). Only a segment made of literal or %2E-encoded dots is decoded, every other byte is kept, so an encoded slash stays inside its segment. A ".." above the root is an error, not clamped.
func NormalizeURLPath ¶ added in v1.14.6
NormalizeURLPath rewrites Path and RawPath of u to the normalized form of its path, so that EscapedPath keeps the encoding of the normalized form. It starts from RawPath, the path as sent. EscapedPath would re-encode Path when RawPath holds a byte like "|" that Go escapes, and that turns %2F into a slash.