diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-04-27 15:35:27 +0200 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-04-27 15:35:27 +0200 |
commit | 57b8ee9163181920b634e475c781fe7764e11b98 (patch) | |
tree | 7d0675f8cda49a39b0b42eaaa928cfb66b57869a /src/HTTPServer/HTTPConnection.cpp | |
parent | Implemented Chunk Sparsing with segments (diff) | |
parent | Merge pull request #863 from mc-server/chunkysparsing (diff) | |
download | cuberite-57b8ee9163181920b634e475c781fe7764e11b98.tar cuberite-57b8ee9163181920b634e475c781fe7764e11b98.tar.gz cuberite-57b8ee9163181920b634e475c781fe7764e11b98.tar.bz2 cuberite-57b8ee9163181920b634e475c781fe7764e11b98.tar.lz cuberite-57b8ee9163181920b634e475c781fe7764e11b98.tar.xz cuberite-57b8ee9163181920b634e475c781fe7764e11b98.tar.zst cuberite-57b8ee9163181920b634e475c781fe7764e11b98.zip |
Diffstat (limited to 'src/HTTPServer/HTTPConnection.cpp')
-rw-r--r-- | src/HTTPServer/HTTPConnection.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/HTTPServer/HTTPConnection.cpp b/src/HTTPServer/HTTPConnection.cpp index 78b7ce4d9..da4df0e34 100644 --- a/src/HTTPServer/HTTPConnection.cpp +++ b/src/HTTPServer/HTTPConnection.cpp @@ -67,10 +67,10 @@ 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); + AppendPrintf(m_OutgoingData, SIZE_T_FMT_HEX "\r\n", a_Size); m_OutgoingData.append((const char *)a_Data, a_Size); m_OutgoingData.append("\r\n"); m_HTTPServer.NotifyConnectionWrite(*this); @@ -144,7 +144,7 @@ void cHTTPConnection::Terminate(void) -void cHTTPConnection::DataReceived(const char * a_Data, int a_Size) +void cHTTPConnection::DataReceived(const char * a_Data, size_t a_Size) { switch (m_State) { @@ -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,7 +174,7 @@ 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; @@ -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; } |