diff options
author | Mattes D <github@xoft.cz> | 2016-01-03 15:59:55 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2016-03-01 16:19:56 +0100 |
commit | fea556ca1b8aeec975f5276d5d829ee6275841d9 (patch) | |
tree | 9a61a61edbb232c01bfb34e1c2959542d470887e /src/HTTPServer/HTTPServer.h | |
parent | Added HTTPResponseParser. (diff) | |
download | cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.gz cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.bz2 cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.lz cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.xz cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.zst cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.zip |
Diffstat (limited to 'src/HTTPServer/HTTPServer.h')
-rw-r--r-- | src/HTTPServer/HTTPServer.h | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/src/HTTPServer/HTTPServer.h b/src/HTTPServer/HTTPServer.h deleted file mode 100644 index 15202a50e..000000000 --- a/src/HTTPServer/HTTPServer.h +++ /dev/null @@ -1,101 +0,0 @@ - -// HTTPServer.h - -// Declares the cHTTPServer class representing a HTTP webserver that uses cListenThread and cSocketThreads for processing - - - - - -#pragma once - -#include "../OSSupport/Network.h" -#include "../IniFile.h" -#include "PolarSSL++/RsaPrivateKey.h" -#include "PolarSSL++/CryptoKey.h" -#include "PolarSSL++/X509Cert.h" - - - - - -// fwd: -class cHTTPMessage; -class cHTTPRequestParser; -class cHTTPResponse; -class cHTTPServerConnection; - - - - - - -class cHTTPServer -{ -public: - class cCallbacks - { - public: - virtual ~cCallbacks() {} - - /** Called when a new request arrives over a connection and all its headers have been parsed. - The request body needn't have arrived yet. */ - virtual void OnRequestBegun(cHTTPServerConnection & a_Connection, cHTTPRequestParser & a_Request) = 0; - - /** Called when another part of request body has arrived. - May be called multiple times for a single request. */ - virtual void OnRequestBody(cHTTPServerConnection & a_Connection, cHTTPRequestParser & a_Request, const char * a_Data, size_t a_Size) = 0; - - /** Called when the request body has been fully received in previous calls to OnRequestBody() */ - virtual void OnRequestFinished(cHTTPServerConnection & a_Connection, cHTTPRequestParser & a_Request) = 0; - } ; - - cHTTPServer(void); - virtual ~cHTTPServer(); - - /** Initializes the server - reads the cert files etc. */ - bool Initialize(void); - - /** Starts the server and assigns the callbacks to use for incoming requests */ - bool Start(cCallbacks & a_Callbacks, const AStringVector & a_Ports); - - /** Stops the server, drops all current connections */ - void Stop(void); - -protected: - friend class cHTTPServerConnection; - friend class cSslHTTPServerConnection; - friend class cHTTPServerListenCallbacks; - - /** The cNetwork API handle for the listening socket. */ - cServerHandlePtrs m_ServerHandles; - - /** The callbacks to call for various events */ - cCallbacks * m_Callbacks; - - /** The server certificate to use for the SSL connections */ - cX509CertPtr m_Cert; - - /** The private key for m_Cert. */ - cCryptoKeyPtr m_CertPrivKey; - - - /** Called by cHTTPServerListenCallbacks when there's a new incoming connection. - Returns the connection instance to be used as the cTCPLink callbacks. */ - cTCPLink::cCallbacksPtr OnIncomingConnection(const AString & a_RemoteIPAddress, UInt16 a_RemotePort); - - /** Called by cHTTPServerConnection when it finishes parsing the request header */ - void NewRequest(cHTTPServerConnection & a_Connection, cHTTPRequestParser & a_Request); - - /** Called by cHTTPConenction when it receives more data for the request body. - May be called multiple times for a single request. */ - void RequestBody(cHTTPServerConnection & a_Connection, cHTTPRequestParser & a_Request, const char * a_Data, size_t a_Size); - - /** Called by cHTTPServerConnection when it detects that the request has finished (all of its body has been received) */ - void RequestFinished(cHTTPServerConnection & a_Connection, cHTTPRequestParser & a_Request); -} ; - - - - - |