summaryrefslogtreecommitdiffstats
path: root/src/HTTPServer
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-10-20 22:55:07 +0200
committerarchshift <admin@archshift.com>2014-10-23 05:12:49 +0200
commita26541a7c3ced0569098edd0aae61c097c2912f4 (patch)
tree4b7bea204c0ddd18bb4f95357f9eb77590bc2e8d /src/HTTPServer
parentComposableGenerator: Removed nullptr initializers. (diff)
downloadcuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.gz
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.bz2
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.lz
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.xz
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.zst
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.zip
Diffstat (limited to '')
-rw-r--r--src/HTTPServer/HTTPConnection.cpp16
-rw-r--r--src/HTTPServer/HTTPConnection.h6
-rw-r--r--src/HTTPServer/HTTPFormParser.cpp4
-rw-r--r--src/HTTPServer/HTTPMessage.cpp2
-rw-r--r--src/HTTPServer/HTTPServer.cpp10
5 files changed, 19 insertions, 19 deletions
diff --git a/src/HTTPServer/HTTPConnection.cpp b/src/HTTPServer/HTTPConnection.cpp
index bf46bb241..d5dbf0199 100644
--- a/src/HTTPServer/HTTPConnection.cpp
+++ b/src/HTTPServer/HTTPConnection.cpp
@@ -15,7 +15,7 @@
cHTTPConnection::cHTTPConnection(cHTTPServer & a_HTTPServer) :
m_HTTPServer(a_HTTPServer),
m_State(wcsRecvHeaders),
- m_CurrentRequest(NULL),
+ m_CurrentRequest(nullptr),
m_CurrentRequestBodyRemaining(0)
{
// LOGD("HTTP: New connection at %p", this);
@@ -29,7 +29,7 @@ cHTTPConnection::~cHTTPConnection()
{
// LOGD("HTTP: Connection deleting: %p", this);
delete m_CurrentRequest;
- m_CurrentRequest = NULL;
+ m_CurrentRequest = nullptr;
}
@@ -136,7 +136,7 @@ void cHTTPConnection::AwaitNextRequest(void)
void cHTTPConnection::Terminate(void)
{
- if (m_CurrentRequest != NULL)
+ if (m_CurrentRequest != nullptr)
{
m_HTTPServer.RequestFinished(*this, *m_CurrentRequest);
}
@@ -153,7 +153,7 @@ bool cHTTPConnection::DataReceived(const char * a_Data, size_t a_Size)
{
case wcsRecvHeaders:
{
- if (m_CurrentRequest == NULL)
+ if (m_CurrentRequest == nullptr)
{
m_CurrentRequest = new cHTTPRequest;
}
@@ -162,7 +162,7 @@ bool cHTTPConnection::DataReceived(const char * a_Data, size_t a_Size)
if (BytesConsumed == AString::npos)
{
delete m_CurrentRequest;
- m_CurrentRequest = NULL;
+ m_CurrentRequest = nullptr;
m_State = wcsInvalid;
m_HTTPServer.CloseConnection(*this);
return true;
@@ -196,7 +196,7 @@ bool cHTTPConnection::DataReceived(const char * a_Data, size_t a_Size)
case wcsRecvBody:
{
- ASSERT(m_CurrentRequest != NULL);
+ ASSERT(m_CurrentRequest != nullptr);
if (m_CurrentRequestBodyRemaining > 0)
{
size_t BytesToConsume = std::min(m_CurrentRequestBodyRemaining, (size_t)a_Size);
@@ -214,7 +214,7 @@ bool cHTTPConnection::DataReceived(const char * a_Data, size_t a_Size)
return true;
}
delete m_CurrentRequest;
- m_CurrentRequest = NULL;
+ m_CurrentRequest = nullptr;
}
break;
}
@@ -243,7 +243,7 @@ void cHTTPConnection::GetOutgoingData(AString & a_Data)
void cHTTPConnection::SocketClosed(void)
{
- if (m_CurrentRequest != NULL)
+ if (m_CurrentRequest != nullptr)
{
m_HTTPServer.RequestFinished(*this, *m_CurrentRequest);
}
diff --git a/src/HTTPServer/HTTPConnection.h b/src/HTTPServer/HTTPConnection.h
index 6ea8a1ae8..ccbf26466 100644
--- a/src/HTTPServer/HTTPConnection.h
+++ b/src/HTTPServer/HTTPConnection.h
@@ -31,10 +31,10 @@ public:
enum eState
{
- wcsRecvHeaders, ///< Receiving request headers (m_CurrentRequest is created if NULL)
+ wcsRecvHeaders, ///< Receiving request headers (m_CurrentRequest is created if nullptr)
wcsRecvBody, ///< Receiving request body (m_CurrentRequest is valid)
- wcsRecvIdle, ///< Has received the entire body, waiting to send the response (m_CurrentRequest == NULL)
- wcsSendingResp, ///< Sending response body (m_CurrentRequest == NULL)
+ wcsRecvIdle, ///< Has received the entire body, waiting to send the response (m_CurrentRequest == nullptr)
+ wcsSendingResp, ///< Sending response body (m_CurrentRequest == nullptr)
wcsInvalid, ///< The request was malformed, the connection is closing
} ;
diff --git a/src/HTTPServer/HTTPFormParser.cpp b/src/HTTPServer/HTTPFormParser.cpp
index c50c6dcf2..72872078b 100644
--- a/src/HTTPServer/HTTPFormParser.cpp
+++ b/src/HTTPServer/HTTPFormParser.cpp
@@ -86,7 +86,7 @@ void cHTTPFormParser::Parse(const char * a_Data, size_t a_Size)
}
case fpkMultipart:
{
- ASSERT(m_MultipartParser.get() != NULL);
+ ASSERT(m_MultipartParser.get() != nullptr);
m_MultipartParser->Parse(a_Data, a_Size);
break;
}
@@ -145,7 +145,7 @@ bool cHTTPFormParser::HasFormData(const cHTTPRequest & a_Request)
void cHTTPFormParser::BeginMultipart(const cHTTPRequest & a_Request)
{
- ASSERT(m_MultipartParser.get() == NULL);
+ ASSERT(m_MultipartParser.get() == nullptr);
m_MultipartParser.reset(new cMultipartParser(a_Request.GetContentType(), *this));
}
diff --git a/src/HTTPServer/HTTPMessage.cpp b/src/HTTPServer/HTTPMessage.cpp
index 65d73fd87..f6c0204ae 100644
--- a/src/HTTPServer/HTTPMessage.cpp
+++ b/src/HTTPServer/HTTPMessage.cpp
@@ -70,7 +70,7 @@ cHTTPRequest::cHTTPRequest(void) :
super(mkRequest),
m_EnvelopeParser(*this),
m_IsValid(true),
- m_UserData(NULL),
+ m_UserData(nullptr),
m_HasAuth(false),
m_AllowKeepAlive(false)
{
diff --git a/src/HTTPServer/HTTPServer.cpp b/src/HTTPServer/HTTPServer.cpp
index 0c41b54b2..9ab030a1f 100644
--- a/src/HTTPServer/HTTPServer.cpp
+++ b/src/HTTPServer/HTTPServer.cpp
@@ -44,7 +44,7 @@ class cDebugCallbacks :
UNUSED(a_Connection);
cHTTPFormParser * FormParser = (cHTTPFormParser *)(a_Request.GetUserData());
- if (FormParser != NULL)
+ if (FormParser != nullptr)
{
FormParser->Parse(a_Data, a_Size);
}
@@ -54,7 +54,7 @@ class cDebugCallbacks :
virtual void OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) override
{
cHTTPFormParser * FormParser = (cHTTPFormParser *)(a_Request.GetUserData());
- if (FormParser != NULL)
+ if (FormParser != nullptr)
{
if (FormParser->Finish())
{
@@ -124,7 +124,7 @@ class cDebugCallbacks :
cHTTPServer::cHTTPServer(void) :
m_ListenThreadIPv4(*this, cSocket::IPv4, "WebServer"),
m_ListenThreadIPv6(*this, cSocket::IPv6, "WebServer"),
- m_Callbacks(NULL)
+ m_Callbacks(nullptr)
{
}
@@ -168,7 +168,7 @@ bool cHTTPServer::Initialize(const AString & a_PortsIPv4, const AString & a_Port
}
// Notify the admin about the HTTPS / HTTP status
- if (m_Cert.get() == NULL)
+ if (m_Cert.get() == nullptr)
{
LOGWARNING("WebServer: The server is running in unsecured HTTP mode.");
LOGINFO("Put a valid HTTPS certificate in file 'webadmin/httpscert.crt' and its corresponding private key to 'webadmin/httpskey.pem' (without any password) to enable HTTPS support");
@@ -235,7 +235,7 @@ void cHTTPServer::Stop(void)
void cHTTPServer::OnConnectionAccepted(cSocket & a_Socket)
{
cHTTPConnection * Connection;
- if (m_Cert.get() != NULL)
+ if (m_Cert.get() != nullptr)
{
Connection = new cSslHTTPConnection(*this, m_Cert, m_CertPrivKey);
}