diff options
author | madmaxoft <github@xoft.cz> | 2013-10-04 20:28:30 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-10-04 20:28:30 +0200 |
commit | db3d83b38dd61b90466a0721fa9104e742f3fb8b (patch) | |
tree | ba45a5a87eb7a688cbbe05587abaf1bea667371f /source/HTTPServer/HTTPConnection.cpp | |
parent | HTTP Server can now parse multipart/form-data forms; better architecture. (diff) | |
download | cuberite-db3d83b38dd61b90466a0721fa9104e742f3fb8b.tar cuberite-db3d83b38dd61b90466a0721fa9104e742f3fb8b.tar.gz cuberite-db3d83b38dd61b90466a0721fa9104e742f3fb8b.tar.bz2 cuberite-db3d83b38dd61b90466a0721fa9104e742f3fb8b.tar.lz cuberite-db3d83b38dd61b90466a0721fa9104e742f3fb8b.tar.xz cuberite-db3d83b38dd61b90466a0721fa9104e742f3fb8b.tar.zst cuberite-db3d83b38dd61b90466a0721fa9104e742f3fb8b.zip |
Diffstat (limited to '')
-rw-r--r-- | source/HTTPServer/HTTPConnection.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/HTTPServer/HTTPConnection.cpp b/source/HTTPServer/HTTPConnection.cpp index 61f4b3a31..e3a6be494 100644 --- a/source/HTTPServer/HTTPConnection.cpp +++ b/source/HTTPServer/HTTPConnection.cpp @@ -26,6 +26,18 @@ void cHTTPConnection::SendStatusAndReason(int a_StatusCode, const AString & a_Re { AppendPrintf(m_OutgoingData, "%d %s\r\n\r\n", a_StatusCode, a_Response.c_str()); m_HTTPServer.NotifyConnectionWrite(*this); + m_State = wcsRecvHeaders; +} + + + + + +void cHTTPConnection::SendNeedAuth(const AString & a_Realm) +{ + AppendPrintf(m_OutgoingData, "HTTP/1.1 401 Unauthorized\r\nWWW-Authenticate: Basic realm=\"%s\"\r\n\r\n", a_Realm.c_str()); + m_HTTPServer.NotifyConnectionWrite(*this); + m_State = wcsRecvHeaders; } @@ -73,6 +85,12 @@ void cHTTPConnection::AwaitNextRequest(void) { switch (m_State) { + case wcsRecvHeaders: + { + // Nothing has been received yet, or a special response was given (SendStatusAndReason() or SendNeedAuth() ) + break; + } + case wcsRecvIdle: { // The client is waiting for a response, send an "Internal server error": |