diff options
author | madmaxoft <github@xoft.cz> | 2013-09-27 21:28:41 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-09-27 21:28:41 +0200 |
commit | 5cf8fc12ae000cd2d2b54a2bf158f82bdb8a0e67 (patch) | |
tree | 9c1f8b1f21555751b6a5886cf32a492a1e504c85 /source/HTTPServer/HTTPServer.h | |
parent | Fixed leaking HTTPRequest objects (diff) | |
download | cuberite-5cf8fc12ae000cd2d2b54a2bf158f82bdb8a0e67.tar cuberite-5cf8fc12ae000cd2d2b54a2bf158f82bdb8a0e67.tar.gz cuberite-5cf8fc12ae000cd2d2b54a2bf158f82bdb8a0e67.tar.bz2 cuberite-5cf8fc12ae000cd2d2b54a2bf158f82bdb8a0e67.tar.lz cuberite-5cf8fc12ae000cd2d2b54a2bf158f82bdb8a0e67.tar.xz cuberite-5cf8fc12ae000cd2d2b54a2bf158f82bdb8a0e67.tar.zst cuberite-5cf8fc12ae000cd2d2b54a2bf158f82bdb8a0e67.zip |
Diffstat (limited to 'source/HTTPServer/HTTPServer.h')
-rw-r--r-- | source/HTTPServer/HTTPServer.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/HTTPServer/HTTPServer.h b/source/HTTPServer/HTTPServer.h index 2d0acc386..efe60809d 100644 --- a/source/HTTPServer/HTTPServer.h +++ b/source/HTTPServer/HTTPServer.h @@ -34,10 +34,31 @@ class cHTTPServer : public cListenThread::cCallback { public: + class cCallbacks + { + public: + /** Called when a new request arrives over a connection and its headers have been parsed. + The request body needn't have arrived yet. + */ + virtual void OnRequestBegun(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) = 0; + + /// Called when another part of request body has arrived. + virtual void OnRequestBody(cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, int a_Size) = 0; + + /// Called when the request body has been fully received in previous calls to OnRequestBody() + virtual void OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) = 0; + } ; + cHTTPServer(void); bool Initialize(cIniFile & a_IniFile); + /// Starts the server and assigns the callbacks to use for incoming requests + bool Start(cCallbacks & a_Callbacks); + + /// Stops the server, drops all current connections + void Stop(void); + protected: friend class cHTTPConnection; @@ -48,6 +69,10 @@ protected: cCriticalSection m_CSConnections; cHTTPConnections m_Connections; ///< All the connections that are currently being serviced + + /// The callbacks to call for various events + cCallbacks * m_Callbacks; + // cListenThread::cCallback overrides: virtual void OnConnectionAccepted(cSocket & a_Socket) override; |