Module mochiweb_headers

Case preserving (but case insensitive) HTTP Header dictionary.

Copyright © 2007 Mochi Media, Inc.

Authors: Bob Ippolito (bob@mochimedia.com).

Description

Case preserving (but case insensitive) HTTP Header dictionary.

Data Types

headers()

abstract datatype: headers()

key()

key() = atom() | binary() | string()

value()

value() = atom() | binary() | string() | integer()

Function Index

default/3Insert the pair into the headers if it does not already exist.
default_from_list/2Insert pairs into the headers for keys that do not already exist.
empty/0Create an empty headers structure.
enter/3Insert the pair into the headers, replacing any pre-existing key.
enter_from_list/2Insert pairs into the headers, replace any values for existing keys.
from_list/1Construct a headers() from the given list.
get_primary_value/2Return the value of the given header up to the first semicolon using a case insensitive search.
get_value/2Return the value of the given header using a case insensitive search.
insert/3Insert the pair into the headers, merging with any pre-existing key.
lookup/2Return the case preserved key and value for the given header using a case insensitive search.
make/1Construct a headers() from the given list.
test/0Run tests for this module.
to_list/1Return the contents of the headers.

Function Details

default/3

default(K::key(), V::value(), T::headers()) -> headers()

Insert the pair into the headers if it does not already exist.

default_from_list/2

default_from_list(List::[{key(), value()}], T::headers()) -> headers()

Insert pairs into the headers for keys that do not already exist.

empty/0

empty() -> headers()

Create an empty headers structure.

enter/3

enter(K::key(), V::value(), T::headers()) -> headers()

Insert the pair into the headers, replacing any pre-existing key.

enter_from_list/2

enter_from_list(List::[{key(), value()}], T::headers()) -> headers()

Insert pairs into the headers, replace any values for existing keys.

from_list/1

from_list(List::[{key(), value()}]) -> headers()

Construct a headers() from the given list.

get_primary_value/2

get_primary_value(K::key(), T::headers()) -> string() | undefined

Return the value of the given header up to the first semicolon using a case insensitive search. undefined will be returned for keys that are not present.

get_value/2

get_value(K::key(), T::headers()) -> string() | undefined

Return the value of the given header using a case insensitive search. undefined will be returned for keys that are not present.

insert/3

insert(K::key(), V::value(), T::headers()) -> headers()

Insert the pair into the headers, merging with any pre-existing key. A merge is done with Value = V0 ++ ", " ++ V1.

lookup/2

lookup(K::key(), T::headers()) -> {value, {key(), string()}} | none

Return the case preserved key and value for the given header using a case insensitive search. none will be returned for keys that are not present.

make/1

make(L::headers() | [{key(), value()}]) -> headers()

Construct a headers() from the given list.

test/0

test() -> ok

Run tests for this module.

to_list/1

to_list(T::headers()) -> [{key(), string()}]

Return the contents of the headers. The keys will be the exact key that was first inserted (e.g. may be an atom or binary, case is preserved).


Generated by EDoc, Aug 8 2008, 22:08:39.