#include <http_header.hh>
Public Member Functions | |
| Header () | |
| Constructor. | |
| void | Init () |
| Initialize. | |
| bool | Parse (std::string &data) |
| Parse header. | |
| std::string & | Compose (std::string &buffer) |
| Compose header. | |
Accessors. | |
| const std::string & | Method () const |
| Get http method. | |
| ssize_t | ContentLength () const |
| Get content length. | |
| const std::string & | Connection () const |
| Get connection. | |
| const std::string & | FirstLine () const |
| Get first line. | |
| bool | Complete () const |
| Get completion status. | |
Modifiers. | |
| void | Method (const std::string &x) |
| Set http method. | |
| void | Uri (const std::string &x) |
| Set http uri. | |
| void | Version (const std::string &x) |
| Set version. | |
| void | Connection (const std::string &x) |
| Set connection. | |
| void | ContentLength (ssize_t x) |
| Set content length. | |
| void | FirstLine (const std::string &x) |
| Set first line. | |
| void | ContentType (const std::string &x) |
| Set content type. | |
| void | Custom (const std::string &x) |
| Set custom header. | |
Static Public Attributes | |
| static const ssize_t | NO_CONTENT_LENGTH = -1 |
| content length undefined | |
Private Member Functions | |
| void | ParseFirstLineReq (const std::string &line, std::string::size_type pos, std::string::size_type n) |
| Parse first line of the request. | |
| void | ParseFirstLineRsp (const std::string &line, std::string::size_type pos, std::string::size_type n) |
| Parse first line of the response. | |
Private Attributes | |
| std::string | mMethod |
| http method | |
| std::string | mUri |
| http uri | |
| std::string | mVersion |
| http version | |
| ssize_t | mContentLength |
| content length | |
| std::string | mConnection |
| connection | |
| std::string | mContentType |
| content type | |
| std::list< std::string > | mCustom |
| custom header (not including end-of-line) | |
| std::string | mProtocolRsp |
| response protocol | |
| int | mRspCode |
| response code | |
| std::string | mRspText |
| response text | |
| std::string | mFirstLine |
| first line of either request or response | |
| bool | mComplete |
| true if header parsing is complete | |
| nnl::http::Header::Header | ( | ) |
Constructor.
Calls Init().
| bool nnl::http::Header::Complete | ( | ) | const |
Get completion status.
Returns true if header parsing is complete.
| std::string& nnl::http::Header::Compose | ( | std::string & | buffer | ) |
Compose header.
Compose header from member attributes, store the data in buffer.
| buffer | where to compose the header |
| void nnl::http::Header::Connection | ( | const std::string & | x | ) |
Set connection.
| x | connection |
| const std::string& nnl::http::Header::Connection | ( | ) | const |
Get connection.
| void nnl::http::Header::ContentLength | ( | ssize_t | x | ) |
Set content length.
| x | content length |
| ssize_t nnl::http::Header::ContentLength | ( | ) | const |
Get content length.
| void nnl::http::Header::ContentType | ( | const std::string & | x | ) |
Set content type.
| x | content type |
| void nnl::http::Header::Custom | ( | const std::string & | x | ) |
Set custom header.
Append custom header to the list of custom headers.
| x | header line without the terminating CR LF |
| void nnl::http::Header::FirstLine | ( | const std::string & | x | ) |
Set first line.
| x | first line |
| const std::string& nnl::http::Header::FirstLine | ( | ) | const |
Get first line.
| void nnl::http::Header::Init | ( | ) |
Initialize.
Clear all member attributes.
| void nnl::http::Header::Method | ( | const std::string & | x | ) |
Set http method.
| x | http method |
| const std::string& nnl::http::Header::Method | ( | ) | const |
Get http method.
| bool nnl::http::Header::Parse | ( | std::string & | data | ) |
Parse header.
Parse chunk of data and try to create header.
| data | data to parse |
| void nnl::http::Header::ParseFirstLineReq | ( | const std::string & | line, | |
| std::string::size_type | pos, | |||
| std::string::size_type | n | |||
| ) | [private] |
Parse first line of the request.
The first line of the request is broken to method, uri and version.
| line | buffer to parse | |
| pos | start position | |
| n | length |
| void nnl::http::Header::ParseFirstLineRsp | ( | const std::string & | line, | |
| std::string::size_type | pos, | |||
| std::string::size_type | n | |||
| ) | [private] |
Parse first line of the response.
The first line of the response is broken down to protocol, code and text.
| line | buffer to parse | |
| pos | start position | |
| n | length |
| void nnl::http::Header::Uri | ( | const std::string & | x | ) |
Set http uri.
| x | uri |
| void nnl::http::Header::Version | ( | const std::string & | x | ) |
Set version.
| x | version |
1.4.7