restcgi::http_text Class Reference

List of all members.

Detailed Description

HTTP/1.1 specification "TEXT".

Notes:

  1. Meant to be human readable, i.e. CTL chars not valid.
  2. There is no "encoding"/"decoding" of the TEXT string (encoding() method included for consistency). The concept simply restricts the chars allowed in the string.
  3. On construction, LWS is compressed to a single space char. Note that this is irreversible, encoding does not put the LWS back in.

Syntax (see http_token for additional definitions):

 OCTET         = <any 8-bit sequence of data>
 TEXT          = <any OCTET except CTLs, but including LWS>
 LWS           = [CRLF] 1*( SP | HT )
 CRLF          = CR LF
 CR            = <US-ASCII CR, carriage return (13)>
 LF            = <US-ASCII LF, linefeed (10)>
 
See also:
http_token, http_word

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


Public Member Functions

 http_text ()
 http_text (const std::string &s)
bool empty () const
 Test empty.
const std::string & string () const
 Get string.
const std::string & encoding () const
http_text operator+ (const std::string &rhs) const
http_textoperator+= (const std::string &rhs)
http_text operator+ (const http_text &rhs) const
 Append text and return result.
http_textoperator+= (const http_text &rhs)
 Append text to this and return this.

Static Public Attributes

static const char ctypes_ [256]
 valid chars (1=non space, 2=space)

Friends

bool RESTCGI_API parse (std::string::const_iterator &first, std::string::const_iterator last, http_text &v, const char *terms, bool lastok)
 Parse HTTP text.


Constructor & Destructor Documentation

restcgi::http_text::http_text (  ) 

Construct.

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

Construct from string.

Exceptions:
std::invalid_argument if string contains invalid chars


Member Function Documentation

const std::string& restcgi::http_text::encoding (  )  const [inline]

Encoding, just returns string.

http_text restcgi::http_text::operator+ ( const std::string &  rhs  )  const [inline]

Append (and check) string and return result.

Exceptions:
std::invalid_argument if string contains invalid chars

http_text& restcgi::http_text::operator+= ( const std::string &  rhs  ) 

Append (and check) string to this and return this.

Exceptions:
std::invalid_argument if string contains invalid chars


Friends And Related Function Documentation

bool RESTCGI_API parse ( std::string::const_iterator &  first,
std::string::const_iterator  last,
http_text v,
const char *  terms,
bool  lastok 
) [friend]

Parse HTTP text.

Returns whether found or not and advances first and sets v if found. LWS is compressed. If terms is specified it stops on any of those chars, i.e. on return *first == <term> (note that true is returned and v is empty if term is the first char). If last encountered before a term char and lastok is true, this returns all chars in interval. If terms not specified, this returns all chars in interval or up to first invalid char.


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