Ewebmachine.Core.Utils

HTTP utility module

Source

Summary

choose_charset(charsets, acc_char_hdr)

HTTP Charset negociation, get the charset to use from :

choose_encoding(encs, acc_enc_hdr)

HTTP Encoding negociation, get the encoding to use from :

choose_media_type(ct_provided, accept_header)

HTTP Content negociation, get the content type to send from :

convert_request_date(date)

Convert rfc1123 or rfc850 to :calendar dates

format_mtype(arg1)

format a norm_content_type into an HTTP content type header

fuzzy_mt_match(arg1, arg2)

Match normalized media types accepting a partial match (wildcard or incomplete params)

http_label(int1)

get HTTP status label from HTTP code

normalize_mtype(mtype)

convert any content type representation (see spec) into a norm_content_type

quoted_string(value)

Remove quotes from HTTP quoted string

rfc1123_date(arg1)

Convert a calendar date to a rfc1123 date string

split_quoted_strings(str)

Get the string list from a comma separated list of HTTP quoted strings

Types

norm_content_type :: {type :: String.t, subtype :: String.t, params :: %{}}

Functions

choose_charset(charsets, acc_char_hdr)

Specs:

HTTP Charset negociation, get the charset to use from :

  • acc_char_hdr, the HTTP header Accept-Charset
  • charsets, the list of supported charsets
Source
choose_encoding(encs, acc_enc_hdr)

Specs:

HTTP Encoding negociation, get the encoding to use from :

  • acc_enc_hdr, the HTTP header Accept-Encoding
  • encs, the list of supported encoding
Source
choose_media_type(ct_provided, accept_header)

Specs:

HTTP Content negociation, get the content type to send from :

  • accept_header, the HTTP header Accept
  • ct_provided, the list of provided content types
Source
convert_request_date(date)

Specs:

  • convert_request_date(String.t) :: {{year :: integer, month :: integer, day :: integer}, {h :: integer, min :: integer, sec :: integer}}

Convert rfc1123 or rfc850 to :calendar dates

Source
format_mtype(arg1)

Specs:

format a norm_content_type into an HTTP content type header

Source
fuzzy_mt_match(arg1, arg2)

Match normalized media types accepting a partial match (wildcard or incomplete params)

Source
http_label(int1)

Specs:

  • http_label(code :: integer) :: String.t

get HTTP status label from HTTP code

Source
normalize_mtype(mtype)

Specs:

convert any content type representation (see spec) into a norm_content_type

Source
quoted_string(value)

Remove quotes from HTTP quoted string

Source
rfc1123_date(arg1)

Specs:

  • rfc1123_date({{year :: integer, month :: integer, day :: integer}, {h :: integer, min :: integer, sec :: integer}}) :: String.t

Convert a calendar date to a rfc1123 date string

Source
split_quoted_strings(str)

Get the string list from a comma separated list of HTTP quoted strings

Source