Notes:
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)>
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_text & | operator+= (const std::string &rhs) |
| http_text | operator+ (const http_text &rhs) const |
| Append text and return result. | |
| http_text & | operator+= (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. | |
| restcgi::http_text::http_text | ( | ) |
Construct.
| restcgi::http_text::http_text | ( | const std::string & | s | ) |
Construct from string.
| std::invalid_argument | if string contains invalid chars |
| 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.
| 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.
| std::invalid_argument | if string contains invalid chars |
| 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.
1.4.7