restcgi::http_token Class Reference

List of all members.

Detailed Description

HTTP/1.1 specification "token".

Notes:

  1. ISO 8859-1 charset not completely valid, only US-ASCII.
  2. Meant to be human readable, i.e. CTL chars not valid.
  3. Printable chars that are used in the HTTP header syntax, e.g. "=", are not allowed (see Syntax below).
  4. There is no "encoding"/"decoding" of the token string (encoding() method included for consistency). The concept simply restricts the chars allowed in the string.
  5. The percent sign is valid so invalid chars could be encoded using URI percent-encoding, but en/decoding is left to the caller (must be consistent between all apps!).

Syntax:

 CHAR       = <any US-ASCII character (octets 0 - 127)>
 CTL        = <any US-ASCII control character (octets 0 - 31)
              and DEL (127)>
 SP         = <US-ASCII SP, space (32)>
 HT         = <US-ASCII HT, horizontal-tab (9)>
 token      = 1*<any CHAR except CTLs or separators>
 separators = "(" | ")" | "<" | ">" | "@"
            | "," | ";" | ":" | "\" | <">
            | "/" | "[" | "]" | "?" | "="
            | "{" | "}" | SP | HT
 
See also:
http_word, parse(std::string::const_iterator&, std::string::const_iterator, http_token&)

urisyn::encode, urisyn::decode

http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2


Public Member Functions

 http_token ()
 http_token (const std::string &s)
bool is_null () const
 Test if null.
const std::string & string () const
 Get string.
const std::string & encoding () const
 Encoding, just returns string.

Static Public Member Functions

static bool is_valid (const std::string &v)
 Test if valid http_token.

Static Public Attributes

static const char ctypes_ [256]
 valid chars

Friends

bool RESTCGI_API parse (std::string::const_iterator &first, std::string::const_iterator last, http_token &v, bool noskipls)
 Parse HTTP token.


Constructor & Destructor Documentation

restcgi::http_token::http_token (  ) 

Construct.

restcgi::http_token::http_token ( const std::string &  s  ) 

Construct from string.

Exceptions:
std::invalid_argument if string contains invalid chars or is empty


Friends And Related Function Documentation

bool RESTCGI_API parse ( std::string::const_iterator &  first,
std::string::const_iterator  last,
http_token v,
bool  noskipls 
) [friend]

Parse HTTP token.

Returns whether found or not and advances first and sets v if found. Skips leading SP or HT chars unless noskipls is true.


Generated on Fri May 15 11:27:12 2009 for restcgi by  doxygen 1.4.7