package url

Import Path
	net/url (on golang.org and go.dev)

Dependency Relation
	imports 5 packages, and imported by 7 packages

Involved Source Files
	d-> url.go

Exported Type Names

type Error (struct) Error reports an error and the operation and URL that caused it. Err error Op string URL string (*T) Error() string (*T) Temporary() bool (*T) Timeout() bool (*T) Unwrap() error *T : net.Error *T : error
type EscapeError string (T) Error() string T : error
type InvalidHostError string (T) Error() string T : error
type URL (struct) A URL represents a parsed URL (technically, a URI reference). The general form represented is: [scheme:][//[userinfo@]host][/]path[?query][#fragment] URLs that do not start with a slash after the scheme are interpreted as: scheme:opaque[?query][#fragment] Note that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/. A consequence is that it is impossible to tell which slashes in the Path were slashes in the raw URL and which were %2f. This distinction is rarely important, but when it is, the code should use RawPath, an optional field which only gets set if the default encoding is different from Path. URL's String method uses the EscapedPath method to obtain the path. See the EscapedPath method for more details. ForceQuery bool Fragment string Host string Opaque string Path string RawFragment string RawPath string RawQuery string Scheme string User *Userinfo (*T) EscapedFragment() string (*T) EscapedPath() string (*T) Hostname() string (*T) IsAbs() bool (*T) MarshalBinary() (text []byte, err error) (*T) Parse(ref string) (*URL, error) (*T) Port() string (*T) Query() Values (*T) Redacted() string (*T) RequestURI() string (*T) ResolveReference(ref *URL) *URL (*T) String() string (*T) UnmarshalBinary(text []byte) error *T : encoding.BinaryMarshaler *T : encoding.BinaryUnmarshaler *T : expvar.Var *T : fmt.Stringer func Parse(rawurl string) (*URL, error) func ParseRequestURI(rawurl string) (*URL, error) func (*URL).Parse(ref string) (*URL, error) func (*URL).ResolveReference(ref *URL) *URL func net/http.ProxyFromEnvironment(req *http.Request) (*URL, error) func net/http.(*Response).Location() (*URL, error) func (*URL).ResolveReference(ref *URL) *URL func net/http.ProxyURL(fixedURL *URL) func(*http.Request) (*URL, error) func net/http.CookieJar.Cookies(u *URL) []*http.Cookie func net/http.CookieJar.SetCookies(u *URL, cookies []*http.Cookie) func net/http/cookiejar.(*Jar).Cookies(u *URL) (cookies []*http.Cookie) func net/http/cookiejar.(*Jar).SetCookies(u *URL, cookies []*http.Cookie) func net/http/httputil.NewSingleHostReverseProxy(target *URL) *httputil.ReverseProxy
type Userinfo (struct) The Userinfo type is an immutable encapsulation of username and password details for a URL. An existing Userinfo value is guaranteed to have a username set (potentially empty, as allowed by RFC 2396), and optionally a password. (*T) Password() (string, bool) (*T) String() string (*T) Username() string *T : expvar.Var *T : fmt.Stringer func User(username string) *Userinfo func UserPassword(username, password string) *Userinfo
type Values (map) Values maps a string key to a list of values. It is typically used for query parameters and form values. Unlike in the http.Header map, the keys in a Values map are case-sensitive. (T) Add(key, value string) (T) Del(key string) (T) Encode() string (T) Get(key string) string (T) Set(key, value string) func ParseQuery(query string) (Values, error) func (*URL).Query() Values func net/http.PostForm(url string, data Values) (resp *http.Response, err error) func net/http.(*Client).PostForm(url string, data Values) (resp *http.Response, err error)
Exported Values
func Parse(rawurl string) (*URL, error) Parse parses rawurl into a URL structure. The rawurl may be relative (a path, without a host) or absolute (starting with a scheme). Trying to parse a hostname and path without a scheme is invalid but may not necessarily return an error, due to parsing ambiguities.
func ParseQuery(query string) (Values, error) ParseQuery parses the URL-encoded query string and returns a map listing the values specified for each key. ParseQuery always returns a non-nil map containing all the valid query parameters found; err describes the first decoding error encountered, if any. Query is expected to be a list of key=value settings separated by ampersands or semicolons. A setting without an equals sign is interpreted as a key set to an empty value.
func ParseRequestURI(rawurl string) (*URL, error) ParseRequestURI parses rawurl into a URL structure. It assumes that rawurl was received in an HTTP request, so the rawurl is interpreted only as an absolute URI or an absolute path. The string rawurl is assumed not to have a #fragment suffix. (Web browsers strip #fragment before sending the URL to a web server.)
func PathEscape(s string) string PathEscape escapes the string so it can be safely placed inside a URL path segment, replacing special characters (including /) with %XX sequences as needed.
func PathUnescape(s string) (string, error) PathUnescape does the inverse transformation of PathEscape, converting each 3-byte encoded substring of the form "%AB" into the hex-decoded byte 0xAB. It returns an error if any % is not followed by two hexadecimal digits. PathUnescape is identical to QueryUnescape except that it does not unescape '+' to ' ' (space).
func QueryEscape(s string) string QueryEscape escapes the string so it can be safely placed inside a URL query.
func QueryUnescape(s string) (string, error) QueryUnescape does the inverse transformation of QueryEscape, converting each 3-byte encoded substring of the form "%AB" into the hex-decoded byte 0xAB. It returns an error if any % is not followed by two hexadecimal digits.
func User(username string) *Userinfo User returns a Userinfo containing the provided username and no password set.
func UserPassword(username, password string) *Userinfo UserPassword returns a Userinfo containing the provided username and password. This functionality should only be used with legacy web sites. RFC 2396 warns that interpreting Userinfo this way ``is NOT RECOMMENDED, because the passing of authentication information in clear text (such as URI) has proven to be a security risk in almost every case where it has been used.''