Net.HTTP.HTTPURL
lib/Net/HTTP/HTTPURL.gob
A URL an HTTP request can be sent to: http or https, with a host.
A URL that is one is refined by fromURL, which also refuses:
- user information (
https://user:pw@host/), which RFC 9110 §4.2.4 forbids a sender to write: it leaks into logs, and it makeshttps://bank.example@evil.example/read as the bank's; - a
%in the host, so that two spellings of one host cannot pass two different checks;
and drops the fragment, which is the client's alone and never sent. An
empty path is /, as RFC 9110 §4.2.3 makes it.
type HTTPURL
fun parse : fun(String) -> Either URLError HTTPURL
fun literal : fun(String) -> HTTPURL
Returns the URL text writes, and panics if it writes no HTTP URL.
fun fromURL : fun(URL) -> Either URLError HTTPURL
fun toURL : fun(HTTPURL) -> URL
fun toString : fun(HTTPURL) -> String
fun isHTTPS : fun(HTTPURL) -> Bool
fun host : fun(HTTPURL) -> String
Returns the host as written, lowercase: a name, an IPv4 address, or an IPv6 address in brackets.
fun port : fun(HTTPURL) -> Int
Returns the port, the scheme's own (80 or 443) where the URL gives none.
fun authority : fun(HTTPURL) -> String
Returns the host and, if the URL gave one, the port: example.com:8080.
fun path : fun(HTTPURL) -> String
Returns the path, encoded, never empty.
fun query : fun(HTTPURL) -> Option String
fun target : fun(HTTPURL) -> String
Returns the path and query, as a request line sends them: /search?q=a.
fun segments : fun(HTTPURL) -> Option (Array String)
Returns the path's segments, decoded, as URL.segments does.
instance Eq HTTPURL
instance Show HTTPURL