Changes made for RPC
HTTPConnection Class Reference
class HTTPConnection, encapsulates one connection being made throught the HTTPServer More...
#include <HTTPConnection.h>
Data Structures | |
struct | HTTPMessage |
HTTPMessage contains all the details of the request received by external HTTP client. More... | |
Public Member Functions | |
HTTPConnection (TCPSocketConnection &clnt) | |
Public constructor for HTTPConnection objects. | |
~HTTPConnection () | |
Destructor for HTTPConnection objects. | |
bool | is_closed () |
Query if this connection is already closed and can be deleted. | |
int | poll () |
Polling function for the connection. | |
Protected Member Functions | |
void | close () |
Function to close this connection. | |
int | parse (char *buffer) |
parse a HTTP request line from the content of the buffer. | |
int | parseHeader (char *buffer) |
parses the received string in buffer for HTTP request headers. | |
int | receiveLine (char *szLine, int nMaxLen, int nTimeout=-1, char szLineTerm= '\n') |
Function which receives a line from the current Socket. | |
int | parseUriArgs (char *uri_string, map< string, string > &args) |
parse the receoved uri_string for arguments which will be stored in the args map. | |
Friends | |
class | HTTPServer |
Detailed Description
class HTTPConnection, encapsulates one connection being made throught the HTTPServer
Definition at line 51 of file HTTPConnection.h.
Constructor & Destructor Documentation
HTTPConnection | ( | TCPSocketConnection & | clnt ) |
Public constructor for HTTPConnection objects.
Definition at line 30 of file HTTPConnection.cpp.
~HTTPConnection | ( | ) |
Destructor for HTTPConnection objects.
Definition at line 35 of file HTTPConnection.cpp.
Member Function Documentation
void close | ( | ) | [protected] |
Function to close this connection.
To be called from internally.
Definition at line 40 of file HTTPConnection.cpp.
bool is_closed | ( | ) |
Query if this connection is already closed and can be deleted.
- Returns:
- true, if connection is closed.
int parse | ( | char * | buffer ) | [protected] |
parse a HTTP request line from the content of the buffer.
- Parameters:
-
buffer : the request received from the client in the form <RequestType> <uri> <Http version>="">
- Returns:
- -1 if the request is invalid or 0 if the request is valid
Definition at line 149 of file HTTPConnection.cpp.
int parseHeader | ( | char * | buffer ) | [protected] |
parses the received string in buffer
for HTTP request headers.
- Parameters:
-
buffer : buffer which contains the string to parse for headers.
- Returns:
- -1 in case of an error, otherwise returns 0
Definition at line 195 of file HTTPConnection.cpp.
int parseUriArgs | ( | char * | uri_string, |
map< string, string > & | args | ||
) | [protected] |
parse the receoved uri_string
for arguments which will be stored in the args
map.
uri_string : the uri string which was received from the client. args : the args map which will receive the argument:value touples from the uri_string
.
- Returns:
- -1 if an error occured, otherwise returns 0.
Definition at line 220 of file HTTPConnection.cpp.
int poll | ( | ) |
Polling function for the connection.
- Returns:
- -1 if connection is not required anymore. In the current version of this library this should be the normal case. This may change in future versions.
Definition at line 45 of file HTTPConnection.cpp.
int receiveLine | ( | char * | szLine, |
int | nMaxLen, | ||
int | nTimeout = -1 , |
||
char | szLineTerm = '\n' |
||
) | [protected] |
Function which receives a line from the current Socket.
- Parameters:
-
szline : will contain one line received from the socket nMaxLen : the size of the buffer. If the line is longer than the buffer the line is cropped at the end. nTimeout : if the timeout elapses, only the portion that has been received within this time will be returned. szLineTerm : the end-of-line
character to be used to detect the end of the line.
- Returns:
- -1 in case of an error or timeout, -2 in case of an empty line or the number of received characters.
Definition at line 96 of file HTTPConnection.cpp.
Generated on Mon Jul 18 2022 11:51:41 by
