HttpHeadersView

Maintains a set of input headers. These are placed into an input buffer and indexed via a HttpStack.

Constructors

this
this()

Construct this set of headers, using a HttpStack based upon a ':' delimiter

this
this(HttpHeadersView source)

Clone a source set of HttpHeaders

Members

Aliases

parse
alias parse = HttpTokens.parse
Undocumented in source.

Functions

clone
HttpHeadersView clone()

Clone this set of HttpHeadersView

createFilter
FilteredHeaders createFilter(HttpHeaderName header)

Create a filter for iterating of a set of named headers. We have to create a filter since we can't pass additional arguments directly to an opApply() method.

get
cstring get(HttpHeaderName name, cstring def)

Return the value of the provided header, or null if the header does not exist

getDate
Time getDate(HttpHeaderName name, Time def)

Return the date value of the provided header, or Time.epoch if the header does not exist

getInt
int getInt(HttpHeaderName name, int def)

Return the integer value of the provided header, or -1 if the header does not exist

opApply
int opApply(int delegate(ref HeaderElement) dg)

Iterate over the set of headers. This is a shell around the superclass, where we can convert the HttpToken into a HeaderElement instead.

parse
void parse(InputBuffer input)

Read all header lines. Everything is mapped rather than being allocated & copied

retain
HttpHeadersView retain(bool yes)

Control whether headers are duplicated or not. Default behaviour is aliasing instead of copying, avoiding any allocation overhead. However, the default won't preserve those headers once additional content has been read.

Inherited Members

From HttpTokens

stack
HttpStack stack;
Undocumented in source.
parse
void parse(InputBuffer input)

Read all tokens. Everything is mapped rather than being allocated & copied

parse
void parse(char[] content)

Parse an input string.

reset
HttpTokens reset()

Reset this set of tokens.

isParsed
bool isParsed()

Have tokens been parsed yet?

setParsed
void setParsed(bool parsed)

Indicate whether tokens have been parsed or not.

get
cstring get(cstring name, cstring ret)

Return the value of the provided header, or null if the header does not exist

getInt
int getInt(cstring name, int ret)

Return the integer value of the provided header, or the provided default-vaule if the header does not exist

getDate
Time getDate(cstring name, Time date)

Return the date value of the provided header, or the provided default-value if the header does not exist

opApply
int opApply(int delegate(ref HttpToken) dg)

Iterate over the set of tokens

produce
void produce(size_t delegate(const(void)[]) consume, cstring eol)

Output the token list to the provided consumer

handleMissingSeparator
bool handleMissingSeparator(cstring s, HttpToken element)

overridable method to handle the case where a token does not have a separator. Apparently, this can happen in HTTP usage

createFilter
FilteredTokens createFilter(char[] match)

Create a filter for iterating over the tokens matching a particular name.

FilteredTokens
class FilteredTokens

Implements a filter for iterating over tokens matching a particular name. We do it like this because there's no means of passing additional information to an opApply() method.

formatTokens
char[] formatTokens(OutputBuffer dst, cstring delim)

Return a char[] representing the output. An empty array is returned if output was not configured. This perhaps could just return our 'output' buffer content, but that would not reflect deletes, or separators. Better to do it like this instead, for a small cost.

add
void add(cstring name, void delegate(OutputBuffer) value)

Add a token with the given name. The content is provided via the specified delegate. We stuff this name & content into the output buffer, and map a new Token onto the appropriate buffer slice.

add
void add(cstring name, cstring value)

Add a simple name/value pair to the output

addInt
void addInt(cstring name, int value)

Add a name/integer pair to the output

addDate
void addDate(cstring name, Time value)

Add a name/date(long) pair to the output

remove
bool remove(cstring name)

remove a token from our list. Returns false if the named token is not found.

Meta