|
#include <CHttpConnect.h>

Public Member Functions | |
| CHttpConnect () | |
| Default constructor. | |
| ~CHttpConnect () | |
| Destructor. | |
| void | getResponse () |
| Retrieves the server response on the command. | |
| const CBuffer & | htmlData () const |
| Returns the internal read buffer. | |
| CHttpHeaders & | requestHeaders () |
| Returns the HTTP request headers. | |
| const CHttpHeaders & | responseHeaders () const |
| Returns the HTTP headers. | |
| void | cmd_get (std::string pageName, CHttpParams &postData) |
| Sends the GET command to the server. | |
| void | cmd_post (std::string pageName, CHttpParams &postData) |
| Sends the POST command to the server. | |
Protected Member Functions | |
| void | sendCommand (std::string cmd) |
| Sends a single command to HTTP server. | |
Protected Attributes | |
| CHttpHeaders | m_requestHeaders |
| HTTP request headers. | |
| CHttpHeaders | m_responseHeaders |
| HTTP response headers. | |
Implements the GET and POST methods of HTTP protocol. Allows to define the host, port, submit information, and then GET or POST the HTML data to the server.
| void sptk::CHttpConnect::cmd_get | ( | std::string | pageName, | |
| CHttpParams & | postData | |||
| ) |
Sends the GET command to the server.
Retrieves the server response into internal read buffer.
| pageName | std::string, the name of the page without the server name. | |
| postData | CHttpParams&, the list of HTTP data to pass to the server |
| void sptk::CHttpConnect::cmd_post | ( | std::string | pageName, | |
| CHttpParams & | postData | |||
| ) |
Sends the POST command to the server.
Retrieves the server response into internal read buffer.
| pageName | std::string, the name of the page without the server name. | |
| postData | CHttpParams&, the list of HTTP data to pass to the server |
| void sptk::CHttpConnect::getResponse | ( | ) |
Retrieves the server response on the command.
Stops when HTTP server closes the connection. The server response can then be accessed through the htmlData() method.
| const CBuffer& sptk::CHttpConnect::htmlData | ( | ) | const [inline] |
Returns the internal read buffer.
The buffer makes sense only after sending a command to the server (if that command calls getResponse() method internally). The buffer doesn't contain HTTP headers that are parsed int m_headers map.
| CHttpHeaders& sptk::CHttpConnect::requestHeaders | ( | ) | [inline] |
Returns the HTTP request headers.
The HTTP headers request should be set before sending a command to the server
References m_requestHeaders.
| const CHttpHeaders& sptk::CHttpConnect::responseHeaders | ( | ) | const [inline] |
Returns the HTTP headers.
The HTTP response headers make sense only after sending a command to the server (if that command calls getResponse() method internally).
References m_responseHeaders.
| void sptk::CHttpConnect::sendCommand | ( | std::string | cmd | ) | [protected] |
Sends a single command to HTTP server.
CRLF characters are automatically appended to the command.
| cmd | std::string, HTTP command |