sptk2 logo
SPTK Home Page

sptk::CHttpConnect Class Reference
[Utility Classes]

HTTP socket. More...

#include <CHttpConnect.h>

Inheritance diagram for sptk::CHttpConnect:

sptk::CSocket

List of all members.

Public Member Functions

 CHttpConnect ()
 Default constructor.
 ~CHttpConnect ()
 Destructor.
void getResponse ()
 Retrieves the server response on the command.
const CBufferhtmlData () 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.


Detailed Description

HTTP socket.

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.


Member Function Documentation

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.

Parameters:
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.

Parameters:
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.

Returns:
internal read buffer reference

CHttpHeaders& sptk::CHttpConnect::requestHeaders (  )  [inline]

Returns the HTTP request headers.

The HTTP headers request should be set before sending a command to the server

Returns:
internal http request headers reference

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).

Returns:
internal http headers reference

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.

Parameters:
cmd std::string, HTTP command


The documentation for this class was generated from the following file:

Mon Mar 5 11:56:05 2012: SPTK 3.5.7