tango.net.http.HttpHeaders

License:
BSD style:

Version:
Initial release: April 2004

author:
Kris

struct HeaderElement;
Exposes freachable HttpHeader instances

class HttpHeadersView: tango.net.http.HttpTokens.HttpTokens;
Maintains a set of input headers. These are placed into an input buffer and indexed via a HttpStack.

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

this(HttpHeadersView source);
Clone a source set of HttpHeaders

HttpHeadersView clone();
Clone this set of HttpHeadersView

HttpHeadersView retain(bool yes = true);
Control whether headers are duplicated or not. Default behaviour is aliasing instead of copying, avoiding any allocatation overhead. However, the default won't preserve those headers once additional content has been read.

To retain headers across arbitrary buffering, you should set this option true

void parse(InputBuffer input);
Read all header lines. Everything is mapped rather than being allocated & copied

const(char)[] get(HttpHeaderName name, const(char)[] def = null);
Return the value of the provided header, or null if the header does not exist

int getInt(const(HttpHeaderName) name, int def = -1);
Return the integer value of the provided header, or -1 if the header does not exist

Time getDate(HttpHeaderName name, Time def = Time.epoch);
Return the date value of the provided header, or Time.epoch if the header does not exist

int opApply(scope 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.

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.

class HttpHeaders: tango.net.http.HttpHeaders.HttpHeadersView;
Maintains a set of output headers. These are held in an output buffer, and indexed via a HttpStack. Deleting a header could be supported by setting the HttpStack entry to null, and ignoring such values when it's time to write the headers.

this();
Construct output headers

this(HttpHeaders source);
Clone a source set of HttpHeaders

HttpHeaders clone();
Clone this set of HttpHeaders

void add(HttpHeaderName name, scope void delegate(OutputBuffer) dg);
Add the specified header, and use a callback to provide the content.

void add(HttpHeaderName name, const(char)[] value);
Add the specified header and text

void addInt(HttpHeaderName name, size_t value);
Add the specified header and integer value

void addDate(HttpHeaderName name, Time value);
Add the specified header and long/date value

bool remove(HttpHeaderName name);
Remove the specified header header. Returns false if not found.


Page generated by Ddoc. Copyright (c) 2004 Kris Bell. All rights reserved