diff options
author | Mattes D <github@xoft.cz> | 2016-02-20 11:50:52 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2016-03-01 16:19:58 +0100 |
commit | 52d18b4559cbaca949f722aa6901a6eb5f505f02 (patch) | |
tree | 614a441217b9ebcef17eb62e042223da1413b4aa /src/WebAdmin.h | |
parent | HTTP: Fixed response parser, unified API. (diff) | |
download | cuberite-52d18b4559cbaca949f722aa6901a6eb5f505f02.tar cuberite-52d18b4559cbaca949f722aa6901a6eb5f505f02.tar.gz cuberite-52d18b4559cbaca949f722aa6901a6eb5f505f02.tar.bz2 cuberite-52d18b4559cbaca949f722aa6901a6eb5f505f02.tar.lz cuberite-52d18b4559cbaca949f722aa6901a6eb5f505f02.tar.xz cuberite-52d18b4559cbaca949f722aa6901a6eb5f505f02.tar.zst cuberite-52d18b4559cbaca949f722aa6901a6eb5f505f02.zip |
Diffstat (limited to '')
-rw-r--r-- | src/WebAdmin.h | 54 |
1 files changed, 7 insertions, 47 deletions
diff --git a/src/WebAdmin.h b/src/WebAdmin.h index 29acb2664..5e48f597c 100644 --- a/src/WebAdmin.h +++ b/src/WebAdmin.h @@ -8,7 +8,7 @@ #include "Bindings/LuaState.h" #include "IniFile.h" #include "HTTP/HTTPServer.h" -#include "HTTP/HTTPFormParser.h" +#include "HTTP/HTTPMessage.h" @@ -171,46 +171,6 @@ public: static AString GetContentTypeFromFileExt(const AString & a_FileExtension); protected: - /** Common base class for request body data handlers */ - class cRequestData - { - public: - virtual ~cRequestData() {} // Force a virtual destructor in all descendants - - /** Called when a new chunk of body data is received */ - virtual void OnBody(const char * a_Data, size_t a_Size) = 0; - } ; - - /** The body handler for requests in the "/webadmin" and "/~webadmin" paths */ - class cWebadminRequestData : - public cRequestData, - public cHTTPFormParser::cCallbacks - { - public: - cHTTPFormParser m_Form; - - - cWebadminRequestData(cHTTPRequestParser & a_Request) : - m_Form(a_Request, *this) - { - } - - // cRequestData overrides: - virtual void OnBody(const char * a_Data, size_t a_Size) override; - - // cHTTPFormParser::cCallbacks overrides. Files are ignored: - virtual void OnFileStart(cHTTPFormParser &, const AString & a_FileName) override - { - UNUSED(a_FileName); - } - virtual void OnFileData(cHTTPFormParser &, const char * a_Data, size_t a_Size) override - { - UNUSED(a_Data); - UNUSED(a_Size); - } - virtual void OnFileEnd(cHTTPFormParser &) override {} - } ; - /** Set to true if Init() succeeds and the webadmin isn't to be disabled */ bool m_IsInitialized; @@ -236,18 +196,18 @@ protected: cHTTPServer m_HTTPServer; /** Handles requests coming to the "/webadmin" or "/~webadmin" URLs */ - void HandleWebadminRequest(cHTTPServerConnection & a_Connection, cHTTPRequestParser & a_Request); + void HandleWebadminRequest(cHTTPServerConnection & a_Connection, cHTTPIncomingRequest & a_Request); /** Handles requests for the root page */ - void HandleRootRequest(cHTTPServerConnection & a_Connection, cHTTPRequestParser & a_Request); + void HandleRootRequest(cHTTPServerConnection & a_Connection, cHTTPIncomingRequest & a_Request); /** Handles requests for a file */ - void HandleFileRequest(cHTTPServerConnection & a_Connection, cHTTPRequestParser & a_Request); + void HandleFileRequest(cHTTPServerConnection & a_Connection, cHTTPIncomingRequest & a_Request); // cHTTPServer::cCallbacks overrides: - virtual void OnRequestBegun (cHTTPServerConnection & a_Connection, cHTTPRequestParser & a_Request) override; - virtual void OnRequestBody (cHTTPServerConnection & a_Connection, cHTTPRequestParser & a_Request, const char * a_Data, size_t a_Size) override; - virtual void OnRequestFinished(cHTTPServerConnection & a_Connection, cHTTPRequestParser & a_Request) override; + virtual void OnRequestBegun (cHTTPServerConnection & a_Connection, cHTTPIncomingRequest & a_Request) override; + virtual void OnRequestBody (cHTTPServerConnection & a_Connection, cHTTPIncomingRequest & a_Request, const char * a_Data, size_t a_Size) override; + virtual void OnRequestFinished(cHTTPServerConnection & a_Connection, cHTTPIncomingRequest & a_Request) override; } ; // tolua_export |