summaryrefslogtreecommitdiffstats
path: root/src/HTTP/HTTPResponseParser.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-01-03 15:59:55 +0100
committerMattes D <github@xoft.cz>2016-03-01 16:19:56 +0100
commitfea556ca1b8aeec975f5276d5d829ee6275841d9 (patch)
tree9a61a61edbb232c01bfb34e1c2959542d470887e /src/HTTP/HTTPResponseParser.cpp
parentAdded HTTPResponseParser. (diff)
downloadcuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar
cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.gz
cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.bz2
cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.lz
cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.xz
cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.zst
cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.zip
Diffstat (limited to '')
-rw-r--r--src/HTTP/HTTPResponseParser.cpp (renamed from src/HTTPServer/HTTPResponseParser.cpp)8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/HTTPServer/HTTPResponseParser.cpp b/src/HTTP/HTTPResponseParser.cpp
index b3ce9dab6..9411208e2 100644
--- a/src/HTTPServer/HTTPResponseParser.cpp
+++ b/src/HTTP/HTTPResponseParser.cpp
@@ -13,6 +13,7 @@
cHTTPResponseParser::cHTTPResponseParser(cHTTPResponseParser::cCallbacks & a_Callbacks):
Super(mkResponse),
m_Callbacks(a_Callbacks),
+ m_HasHadError(false),
m_IsInHeaders(true),
m_IsFinished(false),
m_EnvelopeParser(*this)
@@ -56,7 +57,7 @@ size_t cHTTPResponseParser::Parse(const char * a_Data, size_t a_Size)
if (!m_Buffer.empty())
{
// Headers finished and there's still data left in the buffer, process it as message body:
- m_IsInHeaders = false;
+ HeadersFinished();
return ParseBody(m_Buffer.data(), m_Buffer.size());
}
return 0;
@@ -132,6 +133,10 @@ void cHTTPResponseParser::HeadersFinished(void)
{
m_TransferEncodingParser = cTransferEncodingParser::Create(*this, "identity", m_ContentLength);
}
+ else
+ {
+ m_TransferEncodingParser = cTransferEncodingParser::Create(*this, transferEncoding->second, m_ContentLength);
+ }
}
@@ -169,6 +174,7 @@ void cHTTPResponseParser::OnBodyData(const void * a_Data, size_t a_Size)
void cHTTPResponseParser::OnBodyFinished(void)
{
+ m_IsFinished = true;
m_Callbacks.OnBodyFinished();
}