License:
BSD style: see license.txt
Version:
Initial release: April 2004
author:
Kris
- class
Cookie
: tango.io.protocol.model.IWriter.IWritable;
- Defines the
Cookie
class, and the means for reading & writing them.
Cookie
implementation conforms with RFC 2109, but supports parsing
of server-side cookies only. Client-side cookies are supported in
terms of output, but response parsing is not yet implemented ...
See over here
for the RFC document.
- this();
- Construct an empty client-side cookie. You add these
to an output request using HttpClient.addCookie(), or
the equivalent.
- this(char[] name, char[] value);
- Construct a cookie with the provided attributes. You add
these to an output request using HttpClient.addCookie(),
or the equivalent.
- Cookie
setName
(char[] name);
- Set the name of this cookie
- Cookie
setValue
(char[] value);
- Set the value of this cookie
- Cookie
setVersion
(uint vrsn);
- Set the version of this cookie
- Cookie
setPath
(char[] path);
- Set the path of this cookie
- Cookie
setDomain
(char[] domain);
- Set the domain of this cookie
- Cookie
setComment
(char[] comment);
- Set the comment associated with this cookie
- Cookie
setMaxAge
(long maxAge);
- Set the maximum duration of this cookie
- Cookie
setSecure
(bool secure);
- Indicate whether this cookie should be considered secure or not
- void
write
(IWriter writer);
- Output the cookie as a text stream, via the provided IWriter
- void
produce
(void delegate(void[]) consume);
- Output the cookie as a text stream, via the provided consumer
- Cookie
clear
();
- Reset this cookie
- class
CookieStack
;
- Implements a stack of cookies. Each cookie is pushed onto the
stack by a parser, which takes its input from HttpHeaders. The
stack can be populated for both client and server side cookies.
- this(int size);
- Construct a cookie stack with the specified initial extent.
The stack will grow as necessary over time.
- final void
reset
();
- Pop the stack all the way to zero
- final Cookie
push
();
- Return a fresh cookie from the stack
- int
opApply
(int delegate(ref Cookie) dg);
- Iterate over all cookies in stack
- class
HttpCookiesView
: tango.io.protocol.model.IWriter.IWritable;
- This is the support point for server-side cookies. It wraps a
CookieStack together with a set of HttpHeaders, along with the
appropriate cookie parser. One would do something very similar
for client side cookie parsing also.
- this(HttpHeadersView headers);
- Construct cookie wrapper with the provided headers.
- void
write
(IWriter writer);
- Output each of the cookies parsed to the provided IWriter.
- void
produce
(void delegate(void[]) consume, char[] eol = "\x0d\x0a");
- Output the token list to the provided consumer
- void
reset
();
- Reset these cookies for another parse
- CookieStack
parse
();
- Parse all cookies from our HttpHeaders, pushing each onto
the CookieStack as we go.
- class
HttpCookies
;
- Handles a set of output cookies by writing them into the list of
output headers.
- this(HttpHeaders headers, HttpHeaderName name = (HttpHeader ).SetCookie);
- Construct an output cookie wrapper upon the provided
output headers. Each cookie added is converted to an
addition to those headers.
- void
add
(Cookie cookie);
- Add a cookie to our output headers.
- class
CookieParser
: tango.text.stream.StreamIterator.StreamIterator!(char).StreamIterator;
- Server-side cookie parser. See RFC 2109 for details.
- this(CookieStack stack);
- protected uint
scan
(void[] data);
- Callback for iterator.next(). We
scan
for name-value
pairs, populating Cookie instances along the way.
- bool
parse
(char[] header);
- Locate the next token from the provided buffer, and map a
buffer reference into token. Returns true if a token was
located, false otherwise.
Note that the buffer content is not duplicated. Instead, a
slice of the buffer is referenced by the token. You can use
Token.clone() or Token.toString().dup() to copy content per
your application needs.
Note also that there may still be one token left in a buffer
that was not terminated correctly (as in eof conditions). In
such cases, tokens are mapped onto remaining content and the
buffer will have no more readable content.
- static final char[]
toLower
(ref char[] src);
- in-place conversion to lowercase
|