summaryrefslogtreecommitdiffstats
path: root/src/HTTPServer/EnvelopeParser.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:45:45 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:50:18 +0100
commitca6ef58b1ee8521e4b940ee4883dee714960e413 (patch)
tree8532add455224b07c07a759e3d906f50c0695888 /src/HTTPServer/EnvelopeParser.cpp
parentMerge pull request #2972 from marvinkopf/PlayerAutoComplete (diff)
downloadcuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.gz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.bz2
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.lz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.xz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.zst
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.zip
Diffstat (limited to 'src/HTTPServer/EnvelopeParser.cpp')
-rw-r--r--src/HTTPServer/EnvelopeParser.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/HTTPServer/EnvelopeParser.cpp b/src/HTTPServer/EnvelopeParser.cpp
index fd4f3836d..407e9dcfc 100644
--- a/src/HTTPServer/EnvelopeParser.cpp
+++ b/src/HTTPServer/EnvelopeParser.cpp
@@ -26,20 +26,20 @@ size_t cEnvelopeParser::Parse(const char * a_Data, size_t a_Size)
{
return 0;
}
-
+
// Start searching 1 char from the end of the already received data, if available:
size_t SearchStart = m_IncomingData.size();
SearchStart = (SearchStart > 1) ? SearchStart - 1 : 0;
-
+
m_IncomingData.append(a_Data, a_Size);
-
+
size_t idxCRLF = m_IncomingData.find("\r\n", SearchStart);
if (idxCRLF == AString::npos)
{
// Not a complete line yet, all input consumed:
return a_Size;
}
-
+
// Parse as many lines as found:
size_t Last = 0;
do
@@ -61,7 +61,7 @@ size_t cEnvelopeParser::Parse(const char * a_Data, size_t a_Size)
idxCRLF = m_IncomingData.find("\r\n", idxCRLF + 2);
} while (idxCRLF != AString::npos);
m_IncomingData.erase(0, Last);
-
+
// Parsed all lines and still expecting more
return a_Size;
}
@@ -110,7 +110,7 @@ bool cEnvelopeParser::ParseLine(const char * a_Data, size_t a_Size)
m_LastValue.append(a_Data, a_Size);
return true;
}
-
+
// This is a line with a new key:
NotifyLast();
for (size_t i = 0; i < a_Size; i++)
@@ -122,7 +122,7 @@ bool cEnvelopeParser::ParseLine(const char * a_Data, size_t a_Size)
return true;
}
} // for i - a_Data[]
-
+
// No colon was found, key-less header??
return false;
}