http_uri
http_uri
Module
http_uri
Module Summary
URI utility module
Description
This module provides utility functions for working with URIs, according to RFC 3986
.
Data types
Type definitions that are used more than once in this module:
boolean() = true | false
string()
= list of ASCII characters
unicode_binary()
= binary() with characters encoded in the UTF-8 coding standard
Uri data types
Type definitions that are related to URI:
uri() = string() | unicode:unicode_binary()
Syntax according to the URI definition in RFC 3986, for example, "http://www.erlang.org/"
user_info() = string() | unicode:unicode_binary()
scheme() = atom()
Example: http, https
host() = string() | unicode:unicode_binary()
port() = pos_integer()
path() = string() | unicode:unicode_binary()
Represents a file path or directory path
query() = string() | unicode:unicode_binary()
fragment() = string() | unicode:unicode_binary()
For more information about URI, see RFC 3986
.
Exports
decode(HexEncodedURI) -> URI
Types
Decodes a possibly hexadecimal encoded URI.
encode(URI) -> HexEncodedURI
Types
Encodes a hexadecimal encoded URI.
parse(URI) -> {ok, Result} | {error, Reason}
parse(URI, Options) -> {ok, Result} | {error, Reason}
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() | unicode:unicode_binary()) -> valid | {error, Reason :: term()}.
It is called before scheme string gets converted into scheme atom and thus possible atom leak could be prevented
scheme_defaults() -> SchemeDefaults
Types
Provides a list of the scheme and their default port numbers supported (by default) by this utility.
© 2010–2017 Ericsson AB
Licensed under the Apache License, Version 2.0.