Erlang -- http_uri

inets

Reference Manual

Version 7.2

- User's Guide
- Reference Manual
- Release Notes
- PDF
- Top

- Expand All
- Contract All

### Table of Contents

- inets
  - Top of manual page
  - service_names/0
  - services/0
  - services_info/0
  - start/0
  - start/1
  - start/2
  - start/3
  - stop/0
  - stop/2
- httpc
  - Top of manual page
  - cancel_request/1
  - cancel_request/2
  - cookie_header/1
  - cookie_header/2
  - cookie_header/3
  - get_options/1
  - get_options/2
  - info/0
  - info/1
  - request/1
  - request/2
  - request/4
  - request/5
  - reset_cookies/0
  - reset_cookies/1
  - set_options/1
  - set_options/2
  - store_cookies/2
  - store_cookies/3
  - stream_next/1
  - which_cookies/0
  - which_cookies/1
  - which_sessions/0
  - which_sessions/1
- httpd
  - Top of manual page
  - info/1
  - info/2
  - info/2
  - info/3
  - info/4
  - info/3
  - parse_query/1
  - reload_config/2
  - Module:do/1
  - Module:remove/1
  - Module:store/2
- httpd_custom_api
  - Top of manual page
  - request_header/1
  - response_default_headers/0
  - response_header/1
- httpd_socket
  - Top of manual page
  - deliver/3
  - peername/2
  - resolve/0
- httpd_util
  - Top of manual page
  - convert_request_date/1
  - create_etag/1
  - day/1
  - decode_hex/1
  - flatlength/1
  - hexlist_to_integer/1
  - integer_to_hexlist/1
  - lookup/2
  - lookup/3
  - lookup_mime/2
  - lookup_mime/3
  - lookup_mime_default/2
  - lookup_mime_default/3
  - message/3
  - month/1
  - multi_lookup/2
  - reason_phrase/1
  - rfc1123_date/0
  - rfc1123_date/1
  - split/3
  - split_path/1
  - split_script_path/1
  - strip/1
  - suffix/1
- mod_alias
  - Top of manual page
  - default_index/2
  - path/3
  - real_name/3
  - real_script_name/3
- mod_auth
  - Top of manual page
  - add_group_member/3
  - add_group_member/4
  - add_group_member/5
  - add_user/2
  - add_user/5
  - add_user/6
  - delete_group/2
  - delete_group/4
  - delete_group_member/3
  - delete_group_member/4
  - delete_group_member/5
  - delete_user/2
  - delete_user/3
  - delete_user/4
  - get_user/2
  - get_user/3
  - get_user/4
  - list_group_members/2
  - list_group_members/3
  - list_group_members/4
  - list_groups/1
  - list_groups/2
  - list_groups/3
  - list_users/1
  - list_users/2
  - list_users/3
  - update_password/5
  - update_password/6
- mod_esi
  - Top of manual page
  - deliver/2
  - Module:Function/3
  - Module:Function/2
- mod_security
  - Top of manual page
  - block_user/4
  - block_user/5
  - list_auth_users/1
  - list_auth_users/2
  - list_auth_users/2
  - list_auth_users/3
  - list_blocked_users/1
  - list_blocked_users/2
  - list_blocked_users/2
  - list_blocked_users/3
  - unblock_user/2
  - unblock_user/3
  - unblock_user/3
  - unblock_user/4
  - Module:event/4
  - Module:event/5
- http_uri
  - Top of manual page
  - decode/1
  - encode/1
  - parse/1
  - parse/2
  - scheme_defaults/0

# http_uri

### 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

HexEncodedURI = string() | binary() - A possibly hexadecimal encoded URI
URI = uri()

Decodes a possibly hexadecimal encoded URI.

encode(URI) -> HexEncodedURI | OTP R15B01

### Types

URI = uri()
HexEncodedURI = string() | binary() - Hexadecimal encoded URI

Encodes a hexadecimal encoded URI.

parse(URI) -> {ok, Result} | {error, Reason} | OTP R15B01

parse(URI, Options) -> {ok, Result} | {error, Reason} | OTP R15B01

### Types

URI = uri()
Options = [Option]
Option = {ipv6_host_with_brackets, boolean()} | {scheme_defaults, scheme_defaults()} | {fragment, boolean()} | {scheme_validation_fun, fun()}
Result = {Scheme, UserInfo, Host, Port, Path, Query} | {Scheme, UserInfo, Host, Port, Path, Query, Fragment}
Scheme = scheme()
UserInfo = user_info()
Host = host()
Port = inet:port_number()
Path = path()
Query = query()
Fragment = fragment()
Reason = term()

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

Warning

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

SchemeDefaults = [{scheme(), default_scheme_port_number()}]
default_scheme_port_number() = inet:port_number()

Provides a list of the scheme and their default port numbers supported (by default) by this utility.