Module cowboy_http

Core HTTP parsing API.

Description

Core HTTP parsing API.

Data Types

headers()

headers() = [{binary(), iodata()}]

status()

status() = non_neg_integer() | binary()

version()

version() = {Major::non_neg_integer(), Minor::non_neg_integer()}

Function Index

asctime_date/1Parse an asctime date.
authorization/2Parse authorization value according rfc 2617.
ce_identity/1Decode an identity content.
conneg/2Parse a conneg header (Accept-Charset, Accept-Encoding), followed by an optional quality value.
content_type/1Parse a content type.
cookie_list/1Parse a list of cookies.
cookie_to_iodata/3Convert a cookie name, value and options to its iodata form.
digits/1Parse a list of digits as a non negative integer.
entity_tag_match/1Parse either a list of entity tags or a "*".
expectation/2Parse an expectation.
http_date/1Parse an HTTP date (RFC1123, RFC850 or asctime date).
language_range/2Parse a language range, followed by an optional quality value.
list/2Parse a list of the given type.
media_range/2Parse a media range.
nonempty_list/2Parse a non-empty list of the given type.
params/2Parse a list of parameters (a=b;c=d).
quoted_string/2Parse a quoted string.
rfc1123_date/1Parse an RFC1123 date.
rfc850_date/1Parse an RFC850 date.
te_chunked/2Decode a stream of chunks.
te_identity/2Decode an identity stream.
token/2Parse a token.
token_ci/2Parse a case-insensitive token.
urldecode/1Decode a URL encoded binary.
urldecode/2Decode a URL encoded binary.
urlencode/1URL encode a string binary.
urlencode/2URL encode a string binary.
version_to_binary/1Convert an HTTP version tuple to its binary form.
whitespace/2Skip whitespace.
x_www_form_urlencoded/1

Function Details

asctime_date/1

asctime_date(Data::binary()) -> any()

Parse an asctime date.

authorization/2

authorization(UserPass::binary(), Type::binary()) -> {binary(), any()} | {error, badarg}

Parse authorization value according rfc 2617. Only Basic authorization is supported so far.

ce_identity/1

ce_identity(Data::binary()) -> {ok, binary()}

Decode an identity content.

conneg/2

conneg(Data::binary(), Fun::function()) -> any()

Parse a conneg header (Accept-Charset, Accept-Encoding), followed by an optional quality value.

content_type/1

content_type(Data::binary()) -> any()

Parse a content type.

cookie_list/1

cookie_list(Data::binary()) -> [{binary(), binary()}] | {error, badarg}

Parse a list of cookies.

We need a special function for this because we need to support both $; and $, as separators as per RFC2109.

cookie_to_iodata/3

cookie_to_iodata(Name::iodata(), Value::iodata(), Opts::cowboy_req:cookie_opts()) -> iodata()

Convert a cookie name, value and options to its iodata form.

digits/1

digits(Data::binary()) -> non_neg_integer() | {error, badarg}

Parse a list of digits as a non negative integer.

entity_tag_match/1

entity_tag_match(Data::binary()) -> any()

Parse either a list of entity tags or a "*".

expectation/2

expectation(Data::binary(), Fun::function()) -> any()

Parse an expectation.

http_date/1

http_date(Data::binary()) -> any()

Parse an HTTP date (RFC1123, RFC850 or asctime date).

language_range/2

language_range(Data::binary(), Fun::function()) -> any()

Parse a language range, followed by an optional quality value.

list/2

list(Data::binary(), Fun::function()) -> list() | {error, badarg}

Parse a list of the given type.

media_range/2

media_range(Data::binary(), Fun::function()) -> any()

Parse a media range.

nonempty_list/2

nonempty_list(Data::binary(), Fun::function()) -> [any(), ...] | {error, badarg}

Parse a non-empty list of the given type.

params/2

params(Data::binary(), Fun::function()) -> any()

Parse a list of parameters (a=b;c=d).

quoted_string/2

quoted_string(X1::binary(), Fun::function()) -> any()

Parse a quoted string.

rfc1123_date/1

rfc1123_date(Data::binary()) -> any()

Parse an RFC1123 date.

rfc850_date/1

rfc850_date(Data::binary()) -> any()

Parse an RFC850 date.

te_chunked/2

te_chunked(Bin, TransferState) -> more | {more, non_neg_integer(), Bin, TransferState} | {ok, Bin, Bin, TransferState} | {done, non_neg_integer(), Bin} | {error, badarg}

Decode a stream of chunks.

te_identity/2

te_identity(Bin, TransferState) -> {more, non_neg_integer(), Bin, TransferState} | {done, Bin, non_neg_integer(), Bin}

Decode an identity stream.

token/2

token(Data::binary(), Fun::function()) -> any()

Parse a token.

token_ci/2

token_ci(Data::binary(), Fun::function()) -> any()

Parse a case-insensitive token.

Changes all characters to lowercase.

urldecode/1

urldecode(Bin::binary()) -> binary()

Equivalent to urldecode(Bin, crash).

Decode a URL encoded binary.

urldecode/2

urldecode(Bin::binary(), OnError::crash | skip) -> binary()

Decode a URL encoded binary. The second argument specifies how to handle percent characters that are not followed by two valid hex characters. Use skip to ignore such errors, if crash is used the function will fail with the reason badarg.

urlencode/1

urlencode(Bin::binary()) -> binary()

Equivalent to urlencode(Bin, []).

URL encode a string binary.

urlencode/2

urlencode(Bin::binary(), Opts::[noplus | upper]) -> binary()

URL encode a string binary. The noplus option disables the default behaviour of quoting space characters, \s, as +. The upper option overrides the default behaviour of writing hex numbers using lowecase letters to using uppercase letters instead.

version_to_binary/1

version_to_binary(X1::version()) -> binary()

Convert an HTTP version tuple to its binary form.

whitespace/2

whitespace(Data::binary(), Fun::function()) -> any()

Skip whitespace.

x_www_form_urlencoded/1

x_www_form_urlencoded(Qs::binary()) -> [{binary(), binary() | true}]


Generated by EDoc, Aug 16 2014, 11:28:18.