diff options
author | Mattes D <github@xoft.cz> | 2016-02-20 12:33:27 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2016-03-01 16:19:59 +0100 |
commit | 71a1fa81f00cf897d91e8f76cc7e646dd61cc2ff (patch) | |
tree | 5fb4f8639032691b3a09a20b81692ae304693578 | |
parent | WebAdmin uses the new HTTP parser framework. (diff) | |
download | cuberite-71a1fa81f00cf897d91e8f76cc7e646dd61cc2ff.tar cuberite-71a1fa81f00cf897d91e8f76cc7e646dd61cc2ff.tar.gz cuberite-71a1fa81f00cf897d91e8f76cc7e646dd61cc2ff.tar.bz2 cuberite-71a1fa81f00cf897d91e8f76cc7e646dd61cc2ff.tar.lz cuberite-71a1fa81f00cf897d91e8f76cc7e646dd61cc2ff.tar.xz cuberite-71a1fa81f00cf897d91e8f76cc7e646dd61cc2ff.tar.zst cuberite-71a1fa81f00cf897d91e8f76cc7e646dd61cc2ff.zip |
Diffstat (limited to '')
-rw-r--r-- | src/HTTP/HTTPMessage.cpp | 4 | ||||
-rw-r--r-- | src/HTTP/HTTPMessage.h | 8 | ||||
-rw-r--r-- | src/HTTP/HTTPServer.h | 1 | ||||
-rw-r--r-- | src/HTTP/HTTPServerConnection.cpp | 2 | ||||
-rw-r--r-- | src/HTTP/HTTPServerConnection.h | 4 | ||||
-rw-r--r-- | src/WebAdmin.cpp | 8 |
6 files changed, 13 insertions, 14 deletions
diff --git a/src/HTTP/HTTPMessage.cpp b/src/HTTP/HTTPMessage.cpp index 5a7b86315..a535108e3 100644 --- a/src/HTTP/HTTPMessage.cpp +++ b/src/HTTP/HTTPMessage.cpp @@ -69,7 +69,7 @@ void cHTTPMessage::AddHeader(const AString & a_Key, const AString & a_Value) //////////////////////////////////////////////////////////////////////////////// // cHTTPResponse: -cHTTPResponse::cHTTPResponse(void) : +cHTTPOutgoingResponse::cHTTPOutgoingResponse(void) : super(mkResponse) { } @@ -78,7 +78,7 @@ cHTTPResponse::cHTTPResponse(void) : -void cHTTPResponse::AppendToData(AString & a_DataStream) const +void cHTTPOutgoingResponse::AppendToData(AString & a_DataStream) const { a_DataStream.append("HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\nContent-Type: "); a_DataStream.append(m_ContentType); diff --git a/src/HTTP/HTTPMessage.h b/src/HTTP/HTTPMessage.h index 683734b67..9afcd5b97 100644 --- a/src/HTTP/HTTPMessage.h +++ b/src/HTTP/HTTPMessage.h @@ -65,17 +65,17 @@ protected: -class cHTTPResponse : +/** Stores outgoing response headers and serializes them to an HTTP data stream. */ +class cHTTPOutgoingResponse : public cHTTPMessage { typedef cHTTPMessage super; public: - cHTTPResponse(void); + cHTTPOutgoingResponse(void); /** Appends the response to the specified datastream - response line and headers. - The body will be sent later directly through cConnection::Send() - */ + The body will be sent later directly through cConnection::Send() */ void AppendToData(AString & a_DataStream) const; } ; diff --git a/src/HTTP/HTTPServer.h b/src/HTTP/HTTPServer.h index d06e13cac..1de0a6ce9 100644 --- a/src/HTTP/HTTPServer.h +++ b/src/HTTP/HTTPServer.h @@ -23,7 +23,6 @@ class cHTTPMessage; class cHTTPRequestParser; class cHTTPIncomingRequest; -class cHTTPResponse; class cHTTPServerConnection; diff --git a/src/HTTP/HTTPServerConnection.cpp b/src/HTTP/HTTPServerConnection.cpp index 0439c8b93..9edec2886 100644 --- a/src/HTTP/HTTPServerConnection.cpp +++ b/src/HTTP/HTTPServerConnection.cpp @@ -59,7 +59,7 @@ void cHTTPServerConnection::SendNeedAuth(const AString & a_Realm) -void cHTTPServerConnection::Send(const cHTTPResponse & a_Response) +void cHTTPServerConnection::Send(const cHTTPOutgoingResponse & a_Response) { ASSERT(m_CurrentRequest != nullptr); AString toSend; diff --git a/src/HTTP/HTTPServerConnection.h b/src/HTTP/HTTPServerConnection.h index 62d3b7182..4390471d0 100644 --- a/src/HTTP/HTTPServerConnection.h +++ b/src/HTTP/HTTPServerConnection.h @@ -18,7 +18,7 @@ // fwd: class cHTTPServer; -class cHTTPResponse; +class cHTTPOutgoingResponse; class cHTTPIncomingRequest; @@ -45,7 +45,7 @@ public: void SendNeedAuth(const AString & a_Realm); /** Sends the headers contained in a_Response */ - void Send(const cHTTPResponse & a_Response); + void Send(const cHTTPOutgoingResponse & a_Response); /** Sends the data as the response (may be called multiple times) */ void Send(const void * a_Data, size_t a_Size); diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp index 95a1bcdbd..08e90ea13 100644 --- a/src/WebAdmin.cpp +++ b/src/WebAdmin.cpp @@ -314,7 +314,7 @@ void cWebAdmin::HandleWebadminRequest(cHTTPServerConnection & a_Connection, cHTT { if (m_TemplateScript.Call("ShowPage", this, &TemplateRequest, cLuaState::Return, Template)) { - cHTTPResponse Resp; + cHTTPOutgoingResponse Resp; Resp.SetContentType("text/html"); a_Connection.Send(Resp); a_Connection.Send(Template.c_str(), Template.length()); @@ -373,7 +373,7 @@ void cWebAdmin::HandleWebadminRequest(cHTTPServerConnection & a_Connection, cHTT Printf(NumChunks, "%d", cRoot::Get()->GetTotalChunkCount()); ReplaceString(Template, "{NUMCHUNKS}", NumChunks); - cHTTPResponse Resp; + cHTTPOutgoingResponse Resp; Resp.SetContentType("text/html"); a_Connection.Send(Resp); a_Connection.Send(Template.c_str(), Template.length()); @@ -388,7 +388,7 @@ void cWebAdmin::HandleRootRequest(cHTTPServerConnection & a_Connection, cHTTPInc { UNUSED(a_Request); - cHTTPResponse Resp; + cHTTPOutgoingResponse Resp; Resp.SetContentType("text/html"); a_Connection.Send(Resp); a_Connection.Send(m_LoginTemplate); @@ -441,7 +441,7 @@ void cWebAdmin::HandleFileRequest(cHTTPServerConnection & a_Connection, cHTTPInc } // Send the response: - cHTTPResponse Resp; + cHTTPOutgoingResponse Resp; Resp.SetContentType(ContentType); a_Connection.Send(Resp); a_Connection.Send(Content); |