#include <GDynamicPage.h>
|
| GDynamicPageConnection (SOCKET sock, GDynamicPageServer *pServer) |
|
virtual | ~GDynamicPageConnection () |
|
virtual void | doGet (std::ostream &response) |
| The primary purpose of this method is to push a response into pResponse. Typically this method will call SetHeaders. More...
|
|
virtual void | doPost (std::ostream &response) |
| This method takes ownership of pData. Don't forget to delete it. When the POST is caused by an HTML form, it's common for this method to just call DoGet (passing pData for szParams) and then delete pData. (For convenience, a '\0' is already appended at the end of pData.) More...
|
|
| GHttpConnection (SOCKET sock) |
| General-purpose constructor. More...
|
|
virtual | ~GHttpConnection () |
|
void | reset () |
| Clear all the buffers in this object. More...
|
|
void | setContentType (const char *szContentType) |
| Specify the type of the content that is being sent to the client. More...
|
|
void | setCookie (const char *szPayload, bool bPersist) |
| Specify a cookie to send to the client with this response. More...
|
|
void | setModifiedTime (time_t t) |
| Sets the date (modified time) to be sent with the file so the client can cache it. More...
|
|
| GTCPConnection (SOCKET sock) |
|
virtual | ~GTCPConnection () |
|
in_addr | ipAddr () |
| Returns the client's IP address for this connection. (You can use inet_ntoa to convert the value this returns to a string.) More...
|
|
void | setSocket (SOCKET sock) |
| Sets the socket for this connection. More...
|
|
SOCKET | socket () |
| Returns the socket associated with this connection. More...
|
|
|
GDynamicPageSession * | establishSession () |
|
virtual void | handleRequest (GDynamicPageSession *pSession, std::ostream &response)=0 |
| This method is called by doGet or doPost when a client requests something from the server. More...
|
|
virtual bool | hasBeenModifiedSince (const char *szUrl, const char *szDate) |
| This is called when the client does a conditional GET. It should return true if you wish to re-send the file, and DoGet will be called. More...
|
|
void | sendFile (const char *szMimeType, const char *szFilename, std::ostream &response) |
|
void | sendFileSafe (const char *szJailPath, const char *localPath, std::ostream &response) |
| Concatenates szJailPath+szLocalPath, and makes sure that the result is within szJailPath, then it automatically determines the mime type from the extension, and sends the file. More...
|
|
virtual void | setHeaders (const char *szUrl, const char *szParams) |
| This method should set the content type and the date headers, and any other headers deemed necessary. More...
|
|
|
static const char * | extensionToMimeType (const char *szFilename) |
| Determines an appropriate mime type for the given filename based on its extension. (Currently only recognizes a very small number of extensions.) More...
|
|
GClasses::GDynamicPageConnection::GDynamicPageConnection |
( |
SOCKET |
sock, |
|
|
GDynamicPageServer * |
pServer |
|
) |
| |
virtual GClasses::GDynamicPageConnection::~GDynamicPageConnection |
( |
| ) |
|
|
virtual |
virtual void GClasses::GDynamicPageConnection::doGet |
( |
std::ostream & |
response | ) |
|
|
virtual |
The primary purpose of this method is to push a response into pResponse. Typically this method will call SetHeaders.
Implements GClasses::GHttpConnection.
virtual void GClasses::GDynamicPageConnection::doPost |
( |
std::ostream & |
response | ) |
|
|
virtual |
This method takes ownership of pData. Don't forget to delete it. When the POST is caused by an HTML form, it's common for this method to just call DoGet (passing pData for szParams) and then delete pData. (For convenience, a '\0' is already appended at the end of pData.)
Implements GClasses::GHttpConnection.
static const char* GClasses::GDynamicPageConnection::extensionToMimeType |
( |
const char * |
szFilename | ) |
|
|
staticprotected |
Determines an appropriate mime type for the given filename based on its extension. (Currently only recognizes a very small number of extensions.)
virtual void GClasses::GDynamicPageConnection::handleRequest |
( |
GDynamicPageSession * |
pSession, |
|
|
std::ostream & |
response |
|
) |
| |
|
protectedpure virtual |
This method is called by doGet or doPost when a client requests something from the server.
virtual bool GClasses::GDynamicPageConnection::hasBeenModifiedSince |
( |
const char * |
szUrl, |
|
|
const char * |
szDate |
|
) |
| |
|
protectedvirtual |
This is called when the client does a conditional GET. It should return true if you wish to re-send the file, and DoGet will be called.
Implements GClasses::GHttpConnection.
void GClasses::GDynamicPageConnection::sendFile |
( |
const char * |
szMimeType, |
|
|
const char * |
szFilename, |
|
|
std::ostream & |
response |
|
) |
| |
|
protected |
void GClasses::GDynamicPageConnection::sendFileSafe |
( |
const char * |
szJailPath, |
|
|
const char * |
localPath, |
|
|
std::ostream & |
response |
|
) |
| |
|
protected |
Concatenates szJailPath+szLocalPath, and makes sure that the result is within szJailPath, then it automatically determines the mime type from the extension, and sends the file.
virtual void GClasses::GDynamicPageConnection::setHeaders |
( |
const char * |
szUrl, |
|
|
const char * |
szParams |
|
) |
| |
|
protectedvirtual |
This method should set the content type and the date headers, and any other headers deemed necessary.
Implements GClasses::GHttpConnection.