Module z_url

Misc utility URL functions for zotonic.

Copyright © 2012-2022 Marc Worrell

Authors: Marc Worrell.

Description

Misc utility URL functions for zotonic

Function Index

abs_link/2Given a relative URL and a base URL, calculate the absolute URL.
decode_data_url/1Decode a "data:" url to its parts.
hex_decode/1
hex_encode/1
hex_encode_lc/1
location/1Find the definitive location of an url, removing url shorteners in the process.
percent_encode/1Percent encoding/decoding as defined by RFC 3986 (http://tools.ietf.org/html/rfc3986).
percent_encode/2
remove_protocol/1Naive function to remove the protocol from an Url.
split_base_host/1
url_decode/1
url_encode/1
url_path_encode/1
url_reserved_char/1
url_unreserved_char/1
url_valid_char/1

Function Details

abs_link/2

abs_link(RelativeUrl::string() | binary(), BaseUrl::string() | binary()) -> binary()

Given a relative URL and a base URL, calculate the absolute URL.

decode_data_url/1

decode_data_url(X1::binary()) -> {ok, Mime::binary(), Charset::binary(), Data::binary()} | {error, unknown_encoding}

Decode a "data:" url to its parts. Crashes if the url doesn't have a "data:" protocol.

hex_decode/1

hex_decode(Data::binary()) -> binary()

hex_encode/1

hex_encode(Data::iodata()) -> binary()

hex_encode_lc/1

hex_encode_lc(Data::iodata()) -> binary()

location/1

location(Url) -> any()

Find the definitive location of an url, removing url shorteners in the process. Identify as Curl to prevent url shorteners returning HTML pages.

percent_encode/1

percent_encode(Chars::iodata()) -> binary()

Percent encoding/decoding as defined by RFC 3986 (http://tools.ietf.org/html/rfc3986).

percent_encode/2

percent_encode(X1, Acc) -> any()

remove_protocol/1

remove_protocol(Rest::string()) -> string()

remove_protocol(Rest::binary()) -> binary()

Naive function to remove the protocol from an Url

split_base_host/1

split_base_host(Base::string() | binary()) -> {binary(), binary()}

url_decode/1

url_decode(S::string() | binary() | iodata()) -> binary()

url_encode/1

url_encode(S::string() | atom() | float() | integer() | binary() | iodata()) -> binary()

url_path_encode/1

url_path_encode(L::iodata()) -> binary()

url_reserved_char/1

url_reserved_char(X1) -> any()

url_unreserved_char/1

url_unreserved_char(Ch) -> any()

url_valid_char/1

url_valid_char(Char) -> any()


Generated by EDoc