Internal

internal/escapedpath

import "github.com/gofiber/fiber/v3/internal/escapedpath"

Package escapedpath resolves URL references through net/url on the path as written, so an escape such as "%2F" is never decoded into a separator. The client and the proxy follow redirects each with a loop of their own and resolve a Location here.

Functions

func RawPathValid(raw string) bool

Source: internal/escapedpath/escapedpath.go:72

RawPathValid reports whether raw holds only the bytes net/url's validEncoded accepts in a path.

func RepairRawPath(raw, path string) string

Source: internal/escapedpath/escapedpath.go:53

RepairRawPath escapes the bytes of raw that a path cannot hold raw, as "%XX", and leaves the escapes it has alone. url.Parse made sure raw decodes to path, and each byte is written as its own escape, so the result does too. It returns "" when that is what String writes for path anyway.

func Resolve(base string, location []byte) (*url.URL, error)

Source: internal/escapedpath/escapedpath.go:19

Resolve resolves location against base on the escaped path (RFC 3986 Section 5.2), not through fasthttp.URI, which decodes "%2F" and resolves the ".." it uncovers: a Location that repeats the request URI, as a canonical-host redirect does, would otherwise name another path than the one requested. The result carries no user info and has a host.

func SchemeEnd(ref string) int

Source: internal/escapedpath/escapedpath.go:124

SchemeEnd returns the index after the "scheme:" ref opens with, or 0 when it opens with none, as net/url's getScheme does.