summaryrefslogtreecommitdiffstats
path: root/src/HTTPServer/HTTPConnection.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-04-01 16:36:00 +0200
committermadmaxoft <github@xoft.cz>2014-04-01 16:36:00 +0200
commit1795cca5522476006d33d0c276e27a50659c867a (patch)
treec4abcc1ac701bbaf092a729a093058601aae1e79 /src/HTTPServer/HTTPConnection.cpp
parentRemoved the exit-time-destructors flag from clang. (diff)
downloadcuberite-1795cca5522476006d33d0c276e27a50659c867a.tar
cuberite-1795cca5522476006d33d0c276e27a50659c867a.tar.gz
cuberite-1795cca5522476006d33d0c276e27a50659c867a.tar.bz2
cuberite-1795cca5522476006d33d0c276e27a50659c867a.tar.lz
cuberite-1795cca5522476006d33d0c276e27a50659c867a.tar.xz
cuberite-1795cca5522476006d33d0c276e27a50659c867a.tar.zst
cuberite-1795cca5522476006d33d0c276e27a50659c867a.zip
Diffstat (limited to 'src/HTTPServer/HTTPConnection.cpp')
-rw-r--r--src/HTTPServer/HTTPConnection.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/HTTPServer/HTTPConnection.cpp b/src/HTTPServer/HTTPConnection.cpp
index 78b7ce4d9..b8635d893 100644
--- a/src/HTTPServer/HTTPConnection.cpp
+++ b/src/HTTPServer/HTTPConnection.cpp
@@ -67,7 +67,7 @@ void cHTTPConnection::Send(const cHTTPResponse & a_Response)
-void cHTTPConnection::Send(const void * a_Data, int a_Size)
+void cHTTPConnection::Send(const void * a_Data, size_t a_Size)
{
ASSERT(m_State == wcsSendingResp);
AppendPrintf(m_OutgoingData, "%x\r\n", a_Size);
@@ -155,8 +155,8 @@ void cHTTPConnection::DataReceived(const char * a_Data, int a_Size)
m_CurrentRequest = new cHTTPRequest;
}
- int BytesConsumed = m_CurrentRequest->ParseHeaders(a_Data, a_Size);
- if (BytesConsumed < 0)
+ size_t BytesConsumed = m_CurrentRequest->ParseHeaders(a_Data, a_Size);
+ if (BytesConsumed == AString::npos)
{
delete m_CurrentRequest;
m_CurrentRequest = NULL;
@@ -174,16 +174,16 @@ void cHTTPConnection::DataReceived(const char * a_Data, int a_Size)
m_State = wcsRecvBody;
m_HTTPServer.NewRequest(*this, *m_CurrentRequest);
m_CurrentRequestBodyRemaining = m_CurrentRequest->GetContentLength();
- if (m_CurrentRequestBodyRemaining < 0)
+ if (m_CurrentRequestBodyRemaining == AString::npos)
{
// The body length was not specified in the request, assume zero
m_CurrentRequestBodyRemaining = 0;
}
// Process the rest of the incoming data into the request body:
- if (a_Size > BytesConsumed)
+ if (a_Size > (int)BytesConsumed)
{
- DataReceived(a_Data + BytesConsumed, a_Size - BytesConsumed);
+ DataReceived(a_Data + BytesConsumed, a_Size - (int)BytesConsumed);
}
else
{
@@ -197,7 +197,7 @@ void cHTTPConnection::DataReceived(const char * a_Data, int a_Size)
ASSERT(m_CurrentRequest != NULL);
if (m_CurrentRequestBodyRemaining > 0)
{
- int BytesToConsume = std::min(m_CurrentRequestBodyRemaining, a_Size);
+ size_t BytesToConsume = std::min(m_CurrentRequestBodyRemaining, (size_t)a_Size);
m_HTTPServer.RequestBody(*this, *m_CurrentRequest, a_Data, BytesToConsume);
m_CurrentRequestBodyRemaining -= BytesToConsume;
}