summaryrefslogtreecommitdiffstats
path: root/src/HTTPServer
diff options
context:
space:
mode:
authorTycho Bickerstaff <work.tycho@gmail.com>2013-12-20 16:33:04 +0100
committerTycho Bickerstaff <work.tycho@gmail.com>2013-12-20 16:33:04 +0100
commit32e6be002d70f8fec486f0127fc307a21f1ff43e (patch)
tree5601738de3331ff3bfa70bd286784bdd4ba60055 /src/HTTPServer
parentmade LUA shared unless STATIC_LUA is set (diff)
parentFixed warnings in HTTP parser. (diff)
downloadcuberite-32e6be002d70f8fec486f0127fc307a21f1ff43e.tar
cuberite-32e6be002d70f8fec486f0127fc307a21f1ff43e.tar.gz
cuberite-32e6be002d70f8fec486f0127fc307a21f1ff43e.tar.bz2
cuberite-32e6be002d70f8fec486f0127fc307a21f1ff43e.tar.lz
cuberite-32e6be002d70f8fec486f0127fc307a21f1ff43e.tar.xz
cuberite-32e6be002d70f8fec486f0127fc307a21f1ff43e.tar.zst
cuberite-32e6be002d70f8fec486f0127fc307a21f1ff43e.zip
Diffstat (limited to 'src/HTTPServer')
-rw-r--r--src/HTTPServer/HTTPConnection.h2
-rw-r--r--src/HTTPServer/HTTPFormParser.cpp5
-rw-r--r--src/HTTPServer/HTTPMessage.h3
-rw-r--r--src/HTTPServer/NameValueParser.cpp10
4 files changed, 15 insertions, 5 deletions
diff --git a/src/HTTPServer/HTTPConnection.h b/src/HTTPServer/HTTPConnection.h
index 14603bb70..00941f2ae 100644
--- a/src/HTTPServer/HTTPConnection.h
+++ b/src/HTTPServer/HTTPConnection.h
@@ -39,7 +39,7 @@ public:
} ;
cHTTPConnection(cHTTPServer & a_HTTPServer);
- ~cHTTPConnection();
+ virtual ~cHTTPConnection();
/// Sends HTTP status code together with a_Reason (used for HTTP errors)
void SendStatusAndReason(int a_StatusCode, const AString & a_Reason);
diff --git a/src/HTTPServer/HTTPFormParser.cpp b/src/HTTPServer/HTTPFormParser.cpp
index 596db424e..01c68881a 100644
--- a/src/HTTPServer/HTTPFormParser.cpp
+++ b/src/HTTPServer/HTTPFormParser.cpp
@@ -109,6 +109,11 @@ bool cHTTPFormParser::Finish(void)
ParseFormUrlEncoded();
break;
}
+ default:
+ {
+ // Nothing needed for other formats
+ break;
+ }
}
return (m_IsValid && m_IncomingData.empty());
}
diff --git a/src/HTTPServer/HTTPMessage.h b/src/HTTPServer/HTTPMessage.h
index f5284c535..2a4c2879e 100644
--- a/src/HTTPServer/HTTPMessage.h
+++ b/src/HTTPServer/HTTPMessage.h
@@ -32,6 +32,9 @@ public:
cHTTPMessage(eKind a_Kind);
+ // Force a virtual destructor in all descendants
+ virtual ~cHTTPMessage() {};
+
/// Adds a header into the internal map of headers. Recognizes special headers: Content-Type and Content-Length
void AddHeader(const AString & a_Key, const AString & a_Value);
diff --git a/src/HTTPServer/NameValueParser.cpp b/src/HTTPServer/NameValueParser.cpp
index a27f07d19..fd56f6b24 100644
--- a/src/HTTPServer/NameValueParser.cpp
+++ b/src/HTTPServer/NameValueParser.cpp
@@ -97,15 +97,17 @@ void cNameValueParser::Parse(const char * a_Data, int a_Size)
{
ASSERT(m_State != psFinished); // Calling Parse() after Finish() is wrong!
- if ((m_State == psInvalid) || (m_State == psFinished))
- {
- return;
- }
int Last = 0;
for (int i = 0; i < a_Size;)
{
switch (m_State)
{
+ case psInvalid:
+ case psFinished:
+ {
+ return;
+ }
+
case psKeySpace:
{
// Skip whitespace until a non-whitespace is found, then start the key: