summaryrefslogtreecommitdiffstats
path: root/src/HTTPServer/HTTPConnection.h
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2016-02-06 11:37:34 +0100
committerJulian Laubstein <julianlaubstein@yahoo.de>2016-02-06 11:37:34 +0100
commit6fdd7194c81be7234a126bdc3b48f0291fce3567 (patch)
tree7d5ac74b7385ce4ebf77588d80549c884c2b993c /src/HTTPServer/HTTPConnection.h
parentMerge pull request #2958 from LogicParrot/fence (diff)
parentBulk clearing of whitespace (diff)
downloadcuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.gz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.bz2
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.lz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.xz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.zst
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.zip
Diffstat (limited to 'src/HTTPServer/HTTPConnection.h')
-rw-r--r--src/HTTPServer/HTTPConnection.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/HTTPServer/HTTPConnection.h b/src/HTTPServer/HTTPConnection.h
index e1ebeb9ee..414075411 100644
--- a/src/HTTPServer/HTTPConnection.h
+++ b/src/HTTPServer/HTTPConnection.h
@@ -28,7 +28,7 @@ class cHTTPConnection :
public cTCPLink::cCallbacks
{
public:
-
+
enum eState
{
wcsRecvHeaders, ///< Receiving request headers (m_CurrentRequest is created if nullptr)
@@ -37,48 +37,48 @@ public:
wcsSendingResp, ///< Sending response body (m_CurrentRequest == nullptr)
wcsInvalid, ///< The request was malformed, the connection is closing
} ;
-
+
cHTTPConnection(cHTTPServer & a_HTTPServer);
virtual ~cHTTPConnection();
-
+
/** Sends HTTP status code together with a_Reason (used for HTTP errors).
Sends the a_Reason as the body as well, so that browsers display it. */
void SendStatusAndReason(int a_StatusCode, const AString & a_Reason);
-
+
/** Sends the "401 unauthorized" reply together with instructions on authorizing, using the specified realm */
void SendNeedAuth(const AString & a_Realm);
-
+
/** Sends the headers contained in a_Response */
void Send(const cHTTPResponse & a_Response);
-
+
/** Sends the data as the response (may be called multiple times) */
void Send(const void * a_Data, size_t a_Size);
/** Sends the data as the response (may be called multiple times) */
void Send(const AString & a_Data) { Send(a_Data.data(), a_Data.size()); }
-
+
/** Indicates that the current response is finished, gets ready for receiving another request (HTTP 1.1 keepalive) */
void FinishResponse(void);
-
+
/** Resets the internal connection state for a new request.
Depending on the state, this will send an "InternalServerError" status or a "ResponseEnd" */
void AwaitNextRequest(void);
-
+
/** Terminates the connection; finishes any request being currently processed */
void Terminate(void);
-
+
protected:
typedef std::map<AString, AString> cNameValueMap;
-
+
/** The parent webserver that is to be notified of events on this connection */
cHTTPServer & m_HTTPServer;
-
+
/** All the incoming data until the entire request header is parsed */
AString m_IncomingHeaderData;
-
+
/** Status in which the request currently is */
eState m_State;
-
+
/** The request being currently received
Valid only between having parsed the headers and finishing receiving the body. */
cHTTPRequest * m_CurrentRequest;
@@ -89,18 +89,18 @@ protected:
/** The network link attached to this connection. */
cTCPLinkPtr m_Link;
-
-
+
+
// cTCPLink::cCallbacks overrides:
/** The link instance has been created, remember it. */
virtual void OnLinkCreated(cTCPLinkPtr a_Link) override;
/** Data is received from the client. */
virtual void OnReceivedData(const char * a_Data, size_t a_Size) override;
-
+
/** The socket has been closed for any reason. */
virtual void OnRemoteClosed(void) override;
-
+
/** An error has occurred on the socket. */
virtual void OnError(int a_ErrorCode, const AString & a_ErrorMsg) override;