Module cow_http_hd

Data Types

etag()

etag() = {weak | strong, binary()}

media_type()

media_type() = {binary(), binary(), [{binary(), binary()}]}

qvalue()

qvalue() = 0..1000

websocket_version()

websocket_version() = 0..255

Function Index

access_control_allow_credentials/0Build the Access-Control-Allow-Credentials header.
access_control_allow_headers/1Build the Access-Control-Allow-Headers header.
access_control_allow_methods/1Build the Access-Control-Allow-Methods header.
access_control_allow_origin/1Build the Access-Control-Allow-Origin header.
access_control_expose_headers/1Build the Access-Control-Expose-Headers header.
access_control_max_age/1Build the Access-Control-Max-Age header.
parse_accept/1Parse the Accept header.
parse_accept_charset/1Parse the Accept-Charset header.
parse_accept_encoding/1Parse the Accept-Encoding header.
parse_accept_language/1Parse the Accept-Language header.
parse_accept_ranges/1Parse the Accept-Ranges header.
parse_access_control_request_headers/1Parse the Access-Control-Request-Headers header.
parse_access_control_request_method/1Parse the Access-Control-Request-Method header.
parse_age/1Parse the Age header.
parse_allow/1Parse the Allow header.
parse_authorization/1Parse the Authorization header.
parse_cache_control/1Parse the Cache-Control header.
parse_connection/1Parse the Connection header.
parse_content_encoding/1Parse the Content-Encoding header.
parse_content_language/1Parse the Content-Language header.
parse_content_length/1Parse the Content-Length header.
parse_content_range/1Parse the Content-Range header.
parse_content_type/1Parse the Content-Type header.
parse_date/1Parse the Date header.
parse_etag/1Parse the ETag header.
parse_expect/1Parse the Expect header.
parse_expires/1Parse the Expires header.
parse_host/1Parse the Host header.
parse_http2_settings/1Parse the HTTP2-Settings header.
parse_if_match/1Parse the If-Match header.
parse_if_modified_since/1Parse the If-Modified-Since header.
parse_if_none_match/1Parse the If-None-Match header.
parse_if_range/1Parse the If-Range header.
parse_if_unmodified_since/1Parse the If-Unmodified-Since header.
parse_last_modified/1Parse the Last-Modified header.
parse_max_forwards/1Parse the Max-Forwards header.
parse_origin/1Parse the Origin header.
parse_pragma/1Parse the Pragma header.
parse_proxy_authenticate/1Parse the Proxy-Authenticate header.
parse_proxy_authorization/1Parse the Proxy-Authorization header.
parse_range/1Parse the Range header.
parse_retry_after/1Parse the Retry-After header.
parse_sec_websocket_accept/1Dummy parsing function for the Sec-WebSocket-Accept header.
parse_sec_websocket_extensions/1Parse the Sec-WebSocket-Extensions request header.
parse_sec_websocket_key/1Dummy parsing function for the Sec-WebSocket-Key header.
parse_sec_websocket_protocol_req/1Parse the Sec-WebSocket-Protocol request header.
parse_sec_websocket_protocol_resp/1Parse the Sec-Websocket-Protocol response header.
parse_sec_websocket_version_req/1Parse the Sec-WebSocket-Version request header.
parse_sec_websocket_version_resp/1Parse the Sec-WebSocket-Version response header.
parse_te/1Parse the TE header.
parse_trailer/1Parse the Trailer header.
parse_transfer_encoding/1Parse the Transfer-Encoding header.
parse_upgrade/1Parse the Upgrade header.
parse_vary/1Parse the Vary header.
parse_www_authenticate/1Parse the WWW-Authenticate header.
parse_x_forwarded_for/1Parse the X-Forwarded-For header.

Function Details

access_control_allow_credentials/0

access_control_allow_credentials() -> iodata()

Build the Access-Control-Allow-Credentials header.

access_control_allow_headers/1

access_control_allow_headers(Headers::[binary()]) -> iodata()

Build the Access-Control-Allow-Headers header.

access_control_allow_methods/1

access_control_allow_methods(Methods::[binary()]) -> iodata()

Build the Access-Control-Allow-Methods header.

access_control_allow_origin/1

access_control_allow_origin(Ref::{binary(), binary(), 0..65535} | reference() | '*') -> iodata()

Build the Access-Control-Allow-Origin header.

access_control_expose_headers/1

access_control_expose_headers(Headers::[binary()]) -> iodata()

Build the Access-Control-Expose-Headers header.

access_control_max_age/1

access_control_max_age(MaxAge::non_neg_integer()) -> iodata()

Build the Access-Control-Max-Age header.

parse_accept/1

parse_accept(Accept::binary()) -> [{media_type(), qvalue(), [binary() | {binary(), binary()}]}]

Parse the Accept header.

parse_accept_charset/1

parse_accept_charset(Charset::binary()) -> [{binary(), qvalue()}]

Parse the Accept-Charset header.

parse_accept_encoding/1

parse_accept_encoding(Encoding::binary()) -> [{binary(), qvalue()}]

Parse the Accept-Encoding header.

parse_accept_language/1

parse_accept_language(LanguageRange::binary()) -> [{binary(), qvalue()}]

Parse the Accept-Language header.

parse_accept_ranges/1

parse_accept_ranges(AcceptRanges::binary()) -> [binary()]

Parse the Accept-Ranges header.

parse_access_control_request_headers/1

parse_access_control_request_headers(Headers::binary()) -> [binary()]

Parse the Access-Control-Request-Headers header.

parse_access_control_request_method/1

parse_access_control_request_method(Method::binary()) -> binary()

Parse the Access-Control-Request-Method header.

parse_age/1

parse_age(Age::binary()) -> non_neg_integer()

Parse the Age header.

parse_allow/1

parse_allow(Allow::binary()) -> [binary()]

Parse the Allow header.

parse_authorization/1

parse_authorization(X1::binary()) -> {basic, binary(), binary()} | {bearer, binary()} | {digest, [{binary(), binary()}]}

Parse the Authorization header.

We support Basic, Digest and Bearer schemes only.

In the Digest case we do not validate that the mandatory fields are present. When parsing auth-params, we do not accept BWS characters around the "=".

parse_cache_control/1

parse_cache_control(CacheControl::binary()) -> [binary() | {binary(), binary()} | {binary(), non_neg_integer()} | {binary(), [binary()]}]

Parse the Cache-Control header.

In the fields list case, we do not support escaping, which shouldn't be needed anyway.

parse_connection/1

parse_connection(Connection::binary()) -> [binary()]

Parse the Connection header.

parse_content_encoding/1

parse_content_encoding(ContentEncoding::binary()) -> [binary()]

Parse the Content-Encoding header.

parse_content_language/1

parse_content_language(ContentLanguage::binary()) -> [binary()]

Parse the Content-Language header.

We do not support irregular deprecated tags that do not match the ABNF.

parse_content_length/1

parse_content_length(ContentLength::binary()) -> non_neg_integer()

Parse the Content-Length header.

parse_content_range/1

parse_content_range(X1::binary()) -> {bytes, non_neg_integer(), non_neg_integer(), non_neg_integer() | '*'} | {bytes, '*', non_neg_integer()} | {binary(), binary()}

Parse the Content-Range header.

parse_content_type/1

parse_content_type(X1::binary()) -> media_type()

Parse the Content-Type header.

parse_date/1

parse_date(Date::binary()) -> calendar:datetime()

Parse the Date header.

parse_etag/1

parse_etag(X1::binary()) -> etag()

Parse the ETag header.

parse_expect/1

parse_expect(X1::binary()) -> continue

Parse the Expect header.

parse_expires/1

parse_expires(Expires::binary()) -> calendar:datetime()

Parse the Expires header.

Recipients must interpret invalid date formats as a date in the past. The value "0" is commonly used.

parse_host/1

parse_host(Host::binary()) -> {binary(), 0..65535 | undefined}

Parse the Host header.

We only seek to have legal characters and separate the host and port values. The number of segments in the host or the size of each segment is not checked.

There is no way to distinguish IPv4 addresses from regular names until the last segment is reached therefore we do not differentiate them.

The following valid hosts are currently rejected: IPv6 addresses with a zone identifier; IPvFuture addresses; and percent-encoded addresses.

parse_http2_settings/1

parse_http2_settings(HTTP2Settings::binary()) -> map()

Parse the HTTP2-Settings header.

parse_if_match/1

parse_if_match(IfMatch::binary()) -> '*' | [etag()]

Parse the If-Match header.

parse_if_modified_since/1

parse_if_modified_since(IfModifiedSince::binary()) -> calendar:datetime()

Parse the If-Modified-Since header.

parse_if_none_match/1

parse_if_none_match(IfNoneMatch::binary()) -> '*' | [etag()]

Parse the If-None-Match header.

parse_if_range/1

parse_if_range(IfRange::binary()) -> etag() | calendar:datetime()

Parse the If-Range header.

parse_if_unmodified_since/1

parse_if_unmodified_since(IfModifiedSince::binary()) -> calendar:datetime()

Parse the If-Unmodified-Since header.

parse_last_modified/1

parse_last_modified(LastModified::binary()) -> calendar:datetime()

Parse the Last-Modified header.

parse_max_forwards/1

parse_max_forwards(MaxForwards::binary()) -> non_neg_integer()

Parse the Max-Forwards header.

parse_origin/1

parse_origin(Origins::binary()) -> [{binary(), binary(), 0..65535} | reference()]

Parse the Origin header.

parse_pragma/1

parse_pragma(X1::binary()) -> cache | no_cache

Parse the Pragma header.

Legacy header kept for backward compatibility with HTTP/1.0 caches. Only the "no-cache" directive was ever specified, and only for request messages.

We take a large shortcut in the parsing of this header, expecting an exact match of "no-cache".

parse_proxy_authenticate/1

parse_proxy_authenticate(ProxyAuthenticate::binary()) -> [{basic, binary()} | {bearer | digest | binary(), [{binary(), binary()}]}]

Parse the Proxy-Authenticate header.

Alias of parse_www_authenticate/1 due to identical syntax.

parse_proxy_authorization/1

parse_proxy_authorization(ProxyAuthorization::binary()) -> {basic, binary(), binary()} | {bearer, binary()} | {digest, [{binary(), binary()}]}

Parse the Proxy-Authorization header.

Alias of parse_authorization/1 due to identical syntax.

parse_range/1

parse_range(X1::binary()) -> {bytes, [{non_neg_integer(), non_neg_integer() | infinity} | neg_integer()]} | {binary(), binary()}

Parse the Range header.

parse_retry_after/1

parse_retry_after(RetryAfter::binary()) -> non_neg_integer() | calendar:datetime()

Parse the Retry-After header.

parse_sec_websocket_accept/1

parse_sec_websocket_accept(SecWebSocketAccept::binary()) -> binary()

Dummy parsing function for the Sec-WebSocket-Accept header.

The argument is returned without any processing. This value is expected to be matched directly by the client so no parsing is needed.

parse_sec_websocket_extensions/1

parse_sec_websocket_extensions(SecWebSocketExtensions::binary()) -> [{binary(), [binary() | {binary(), binary()}]}]

Parse the Sec-WebSocket-Extensions request header.

parse_sec_websocket_key/1

parse_sec_websocket_key(SecWebSocketKey::binary()) -> binary()

Dummy parsing function for the Sec-WebSocket-Key header.

The argument is returned without any processing. This value is expected to be prepended to a static value, the result of which hashed to form a new base64 value returned in Sec-WebSocket-Accept, therefore no parsing is needed.

parse_sec_websocket_protocol_req/1

parse_sec_websocket_protocol_req(SecWebSocketProtocol::binary()) -> [binary()]

Parse the Sec-WebSocket-Protocol request header.

parse_sec_websocket_protocol_resp/1

parse_sec_websocket_protocol_resp(Protocol::binary()) -> binary()

Parse the Sec-Websocket-Protocol response header.

parse_sec_websocket_version_req/1

parse_sec_websocket_version_req(SecWebSocketVersion::binary()) -> websocket_version()

Parse the Sec-WebSocket-Version request header.

parse_sec_websocket_version_resp/1

parse_sec_websocket_version_resp(SecWebSocketVersion::binary()) -> [websocket_version()]

Parse the Sec-WebSocket-Version response header.

parse_te/1

parse_te(TE::binary()) -> {trailers | no_trailers, [{binary(), qvalue()}]}

Parse the TE header.

This function does not support parsing of transfer-parameter.

parse_trailer/1

parse_trailer(Trailer::binary()) -> [binary()]

Parse the Trailer header.

parse_transfer_encoding/1

parse_transfer_encoding(TransferEncoding::binary()) -> [binary()]

Parse the Transfer-Encoding header.

This function does not support parsing of transfer-parameter.

parse_upgrade/1

parse_upgrade(Upgrade::binary()) -> [binary()]

Parse the Upgrade header.

It is unclear from the RFC whether the values here are case sensitive.

We handle them in a case insensitive manner because they are described as case insensitive in the Websocket RFC.

parse_vary/1

parse_vary(Vary::binary()) -> '*' | [binary()]

Parse the Vary header.

parse_www_authenticate/1

parse_www_authenticate(Authenticate::binary()) -> [{basic, binary()} | {bearer | digest | binary(), [{binary(), binary()}]}]

Parse the WWW-Authenticate header.

Unknown schemes are represented as the lowercase binary instead of an atom. Unlike with parse_authorization/1, we do not crash on unknown schemes.

When parsing auth-params, we do not accept BWS characters around the "=".

parse_x_forwarded_for/1

parse_x_forwarded_for(XForwardedFor::binary()) -> [binary()]

Parse the X-Forwarded-For header.

This header has no specification but *looks like* it is a list of tokens.

This header is deprecated in favor of the Forwarded header.


Generated by EDoc