Module
http_uri
Module Summary
Old URI utility module, use uri_string instead
Since
Module http_uri was introduced in OTP R15B01.
Description
This module is deprecated since OTP 23. Use the module uri_string
to properly handle URIs, this is the recommended module since OTP 21.
Data types
Type definitions that are used more than once in this module:
boolean() = true | false
string()
= list of ASCII characters
Uri data types
Type definitions that are related to URI:
uri() = string() | binary()
Syntax according to the URI definition in RFC 3986, for example, "http://www.erlang.org/"
user_info() = string() | binary()
scheme() = atom()
Example: http, https
host() = string() | binary()
port() = inet:port_number()
path() = string() | binary()
Represents a file path or directory path
query() = string() | binary()
fragment() = string() | binary()
For more information about URI, see RFC 3986
.
Exports
decode(HexEncodedURI) -> URI | OTP R15B01 |
Types
Decodes a possibly hexadecimal encoded URI.
encode(URI) -> HexEncodedURI | OTP R15B01 |
Types
Encodes a hexadecimal encoded URI.
parse(URI) -> {ok, Result} | {error, Reason} | OTP R15B01 |
parse(URI, Options) -> {ok, Result} | {error, Reason} | OTP R15B01 |
Types
Parses a URI. If no scheme defaults are provided, the value of the scheme_defaults
function is used.
When parsing a URI with an unknown scheme (that is, a scheme not found in the scheme defaults), a port number must be provided, otherwise the parsing fails.
If the fragment option is true
, the URI fragment is returned as part of the parsing result, otherwise it is ignored.
Scheme validation fun is to be defined as follows:
fun(SchemeStr :: string() | binary()) -> valid | {error, Reason :: term()}.
It is called before scheme string gets converted into scheme atom and thus possible atom leak could be prevented
The scheme portion of the URI gets converted into atom, meaning that atom leak may occur. Specifying a scheme validation fun is recommended unless the URI is already sanitized.
scheme_defaults() -> SchemeDefaults | OTP R15B01 |
Types
Provides a list of the scheme and their default port numbers supported (by default) by this utility.
© 2010–2021 Ericsson AB
Licensed under the Apache License, Version 2.0.