HTTP header. More...
#include <http_header.h>

Public Types | |
|
typedef std::map< std::string, std::string > | http_headers |
| HTTP header and value pair collection. | |
Public Member Functions | |
| http_header () | |
| Constructor. | |
| void | set_header (const std::string &key, const std::string &value) |
| Initialize a header. | |
| void | set_header (const std::string &header) |
| Initialize a header. | |
| const std::string & | get_header (const std::string &key) const |
| Get the header value. | |
| const http_headers & | all_headers () const |
| Get iterator to the all headers. | |
| void | set_content (const std::string &value) |
| Initialize the content. | |
| void | set_content (int value_size, const char *value) |
| Initialize the content. | |
| void | add_content (int value_size, std::istream &value) |
| Append the content. | |
| void | add_content (std::istream &value) |
| Append the content. | |
| const char * | get_content () const |
| Get content. | |
| int | get_content_size () const |
| Get content size. | |
| const std::string | get_content_type () const |
| Get content type. | |
| void | set_content_type (const std::string &value) |
| Set content type. | |
| const std::string & | http_version () const |
| Get HTTP version number. | |
| http_header & | http_version (const std::string &value) |
| Set HTTP version number. | |
| const http_cookies & | get_cookies () const |
| Return cookies. | |
| void | set_cookies (const http_cookies &) |
| Set cookies. | |
| void | set_cookie (const http_cookie &) |
| Clear cookies and set single cookie. | |
| void | add_cookie (const http_cookie &) |
| Add the cookie. | |
Protected Attributes | |
| http_headers | headers |
| http_cookies | cookies |
Friends | |
| std::istream & | operator>> (std::istream &, http_header &) |
| Set content from a stream. | |
| std::ostream & | operator<< (std::ostream &, const http_header &) |
| Get a stream from content. | |
HTTP header.
This class represents http headers.
| void dbp::http_header::add_content | ( | std::istream & | value | ) |
Append the content.
Detect size of the source stream and add whole content from the source to the content buffer.
| value | a stream to set content from. |
| void dbp::http_header::add_content | ( | int | value_size, | |
| std::istream & | value | |||
| ) |
Append the content.
Add content from the source stream.
| value_size | the content size. | |
| value | a stream to set content from. |
| const http_headers& dbp::http_header::all_headers | ( | ) | const [inline] |
Get iterator to the all headers.
Obtaining a const_iterator to the all headers added before.
| const char* dbp::http_header::get_content | ( | ) | const [inline] |
Get content.
| int dbp::http_header::get_content_size | ( | ) | const [inline] |
Get content size.
| const std::string dbp::http_header::get_content_type | ( | ) | const [inline] |
Get content type.
| const std::string& dbp::http_header::get_header | ( | const std::string & | key | ) | const |
Get the header value.
Get a header value specified by key.
| key | a value key. |
| void dbp::http_header::set_content | ( | int | value_size, | |
| const char * | value | |||
| ) |
Initialize the content.
| value_size | a string length. | |
| value | a C string to set as content. |
| void dbp::http_header::set_content | ( | const std::string & | value | ) |
Initialize the content.
| value | a string to set as content. |
| void dbp::http_header::set_content_type | ( | const std::string & | value | ) | [inline] |
Set content type.
| value | the MIME content type |
| void dbp::http_header::set_header | ( | const std::string & | header | ) |
Initialize a header.
Parse a given string (specified by a standard web header, where header and its value are divided by a semicolon). Set up a header and initialize it with parsed value.
| header | a "header: value" pair. |
| void dbp::http_header::set_header | ( | const std::string & | key, | |
| const std::string & | value | |||
| ) |
Initialize a header.
Set up a header and initialize it with value.
| key | a header to be initialized. | |
| value | a header value. |