diff options
author | Florian Scheibner <flo.de@hotmail.de> | 2015-11-12 14:29:42 +0100 |
---|---|---|
committer | Florian Scheibner <flo.de@hotmail.de> | 2015-11-12 14:29:42 +0100 |
commit | 2f857ce94ae9fe80bb0d0bd96aa40e262a24f30a (patch) | |
tree | 1e6062b822b03d18b47d3a400ec89e1a9dbb663d /src/net | |
parent | e96015a3043f7da0359dc8887b543803041ceef9 (diff) |
Remove leading \r\n\r\n before actual json string
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/HttpParser.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/net/HttpParser.cpp b/src/net/HttpParser.cpp index 7c4f9e2..4b57bc1 100644 --- a/src/net/HttpParser.cpp +++ b/src/net/HttpParser.cpp @@ -196,11 +196,15 @@ string HttpParser::parseHttp(bool isRequest, const string& data, map<string, str string HttpParser::parseHttp(bool isRequest, const string& data) { size_t headerEnd = data.find("\r\n\r\n"); - if (headerEnd == data.npos) { + if (headerEnd != data.npos) { + headerEnd += 4; + } else { headerEnd = data.find("\n\n"); - } - if (headerEnd == data.npos) { - headerEnd = 0; + if (headerEnd != data.npos) { + headerEnd += 2; + } else { + headerEnd = 0; + } } return data.substr(headerEnd); } |