mod url
srcURL parser for HTTP/HTTPS URLs.
Handles the subset of RFC 3986 URIs relevant to HTTP clients:
scheme://[user:pass@]`host[:port]`/path[?query][#fragment]
Only http and https schemes are supported. Fragment is parsed
but ignored for request purposes (not sent to server per RFC 7230 Β§5.1).
Example:
var u = Url.parse("https://api.example.com:8443/v1/items?filter=active")
print(u.host) # api.example.com
print(u.port) # 8443
print(u.path) # /v1/items
print(u.query) # filter=active
```
Structs
struct UrlParseError
struct UrlParseError
Raised when a URL string cannot be parsed.
Fields
message
String
struct Url
struct Url
A parsed HTTP/HTTPS URL.
Fields:
scheme: "http" or "https".
host: Hostname or IP, without brackets (IPv6 brackets stripped).
port: Numeric port; defaults to 80 (http) or 443 (https).
path: URL path including leading /; "/" if absent.
query: Query string without leading ?; "" if absent.
fragment: Fragment without leading #; "" if absent.
This type is Movable but not Copyable.