Documentation ¶
Overview ¶
Package urlutil provides URL-related utility functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCleanPath ¶
GetCleanPath returns cleaned u.Path. It is like path.Clean(u.Path) but does not remove the trailing slash.
func HasSameOrigin ¶
HasSameOrigin reports whether u1 and u2 have the same nonempty Scheme and Host. u1 and u2 are assumed to be absolute URLs with the http/https scheme. Nevertheless, HasSameOrigin returns false when either or both of them have empty Scheme or Host.
HasSameOrigin does not implement all the rules defined for "same origin" in HTML5 but yields the same result if u1 and u2 are both absolute URLs with the http/https scheme, barring one corner case: HasSameOrigin does not recognize the default port numbers, e.g. it reports https://example.com and https://example.com:443 have a "different origin."
Types ¶
This section is empty.