HttpParams

Maintains a set of query parameters, parsed from an HTTP request. Use HttpParams instead for output parameters.

Note that these input params may have been encoded by the user- agent. Unfortunately there has been little consensus on what that encoding should be (especially regarding GET query-params). With luck, that will change to a consistent usage of UTF-8 within the near future.

Constructors

this
this()

Construct parameters by telling the HttpStack that name/value pairs are separated by a '=' character.

Members

Aliases

parse
alias parse = HttpTokens.parse
Undocumented in source.

Functions

add
void add(cstring name, cstring value)

Add a name/value pair to the query list

addDate
void addDate(cstring name, Time value)

Add a name/date(long) pair to the query list

addInt
void addInt(cstring name, int value)

Add a name/integer pair to the query list

get
cstring get(cstring name, cstring ret)

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

getDate
Time getDate(cstring name, Time ret)

Return the date value of the provided header, or the provided default-value 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-value if the header does not exist

parse
void parse(InputBuffer input)

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

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

Output the param list to the provided consumer

size
uint size()

Return the number of headers

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.

From HttpParamsView

size
uint size()

Return the number of headers

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-value if the header does not exist

getDate
Time getDate(cstring name, Time ret)

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

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

Output the param list to the provided consumer

Meta