A RFC-3986 URI Library for parsing and building URIs
Find a file
2016-01-21 23:26:35 -05:00
bin Update the description 2016-01-21 23:26:35 -05:00
doc Implement the initial API 2016-01-21 23:04:34 -05:00
include Implement the initial API 2016-01-21 23:04:34 -05:00
src Update the description 2016-01-21 23:26:35 -05:00
test Implement the initial API 2016-01-21 23:04:34 -05:00
.editorconfig Implement the initial API 2016-01-21 23:04:34 -05:00
.gitignore Implement the initial API 2016-01-21 23:04:34 -05:00
.travis.yml <17.5 doesnt work 2016-01-09 14:48:59 -05:00
LICENSE urllib -> urilib 2016-01-08 22:00:05 -05:00
README.md Abbreviated API documentation 2016-01-21 23:21:39 -05:00
rebar.config Implement the initial API 2016-01-21 23:04:34 -05:00

urilib

RFC-3986 URI Library for Erlang.

Parse and build URIs with automatic percent encoding and plus encoding of query arguments.

Build Status codecov.io

API

Functions

Function Description
build/1 Build a URI from a uri() or url.
parse/1 Parse a URI from a string, returning a uri().
parse/2 Parse a URI, returning the result as either a uri() or url().
percent_decode/1 Decode a percent encoded string value.
percent_encode/1 Percent encode a string value.
plus_decode/1 Decode a percent encoded string value that uses pluses for spaces.
plus_encode/1 Percent encode a string value similar to encode/1, but encodes spaces with a plus (+) instead of %20.

Types

Type Definition
scheme() `http
username() `string()
password() `string()
userinfo() `{username(), password()}
host() string()
tcp_port() integer()
authority() {userinfo(), host(), tcp_port()}
path() string()
query() `[tuple()
fragment() `string()
uri() {scheme(), authority(), path(), query(), fragment()}
url() {scheme(), username(), password(), host(), tcp_port(), path(), query(), fragment()}

Example Usage

Eshell V7.2.1  (abort with ^G)
1> urilib:build({http, {{"guest", "guest"}, "localhost", 15672}, "/api/queues", [{"name", "test"}], undefined}).
"http://guest:guest@localhost:15672/api/queues?name=test"

2> urilib:build({http, "guest", "guest", "localhost", 15672, "/api/queues", [{"name", "test"}], undefined}).    
"http://guest:guest@localhost:15672/api/queues?name=test"

3> urilib:parse("http://guest:guest@localhost:15672/api/queues?name=test").
{http,{{"guest","guest"},"localhost",15672},
      "/api/queues",
      [{"name","test"}],
      undefined}