GClasses
|
This class allows you to implement a simple HTTP daemon.
#include <GHttp.h>
Public Member Functions | |
GHttpServer (int nPort) | |
virtual | ~GHttpServer () |
virtual GHttpConnection * | makeConnection (SOCKET s)=0 |
This method should return a new instance of an object that inherrits from GHttpConnection. More... | |
bool | process () |
You should call this method constantly inside the main loop. It returns true if it did anything, and false if it didn't, so if it returns false you may want to sleep for a little while. More... | |
GTCPServer * | socket () |
Returns a reference to the socket on which this server listens. More... | |
Static Public Member Functions | |
static bool | parseFileParam (const char *pParams, size_t nParamsLen, const char **ppFilename, size_t *pFilenameLen, const unsigned char **ppFile, size_t *pFileLen) |
This is a rather hacky method that parses the parameters of a specific upload-file form. More... | |
static void | unescapeUrl (char *szOut, const char *szIn, size_t nInLen) |
Unescapes a URL. (i.e. replace "%20" with " ", etc.). szOut should point to a buffer at least as big as szIn (including the null terminator). This will stop when it hits the null-terminator in szIn or when nInLen characters have been parsed. So if szIn is null-terminated, you can safely pass in a huge arbitrary value for nInLen. More... | |
Protected Member Functions | |
void | beginRequest (GHttpConnection *pConn, int eType, const char *szIn) |
virtual void | onProcessLine (GHttpConnection *pConn, const char *szLine) |
void | onReceiveFullPostRequest (GHttpConnection *pConn) |
void | processHeaderLine (GHttpConnection *pConn, const char *szLine) |
void | processPostData (GHttpConnection *pConn, const unsigned char *pData, size_t nDataSize) |
void | sendNotModifiedResponse (GHttpConnection *pConn) |
void | sendResponse (GHttpConnection *pConn) |
Protected Attributes | |
char * | m_pReceiveBuf |
GHttpServerSocket * | m_pSocket |
std::ostringstream | m_stream |
GClasses::GHttpServer::GHttpServer | ( | int | nPort | ) |
|
virtual |
|
protected |
|
pure virtual |
This method should return a new instance of an object that inherrits from GHttpConnection.
|
inlineprotectedvirtual |
|
protected |
|
static |
This is a rather hacky method that parses the parameters of a specific upload-file form.
bool GClasses::GHttpServer::process | ( | ) |
You should call this method constantly inside the main loop. It returns true if it did anything, and false if it didn't, so if it returns false you may want to sleep for a little while.
|
protected |
|
protected |
|
protected |
|
protected |
|
inline |
Returns a reference to the socket on which this server listens.
|
static |
Unescapes a URL. (i.e. replace "%20" with " ", etc.). szOut should point to a buffer at least as big as szIn (including the null terminator). This will stop when it hits the null-terminator in szIn or when nInLen characters have been parsed. So if szIn is null-terminated, you can safely pass in a huge arbitrary value for nInLen.
|
protected |
|
protected |
|
protected |