Fixed HTTP chunked data receiving.

This commit is contained in:
Thulinma 2014-05-29 13:29:35 +02:00
parent 5973e7ebe1
commit 97d2fc864c

View file

@ -313,7 +313,7 @@ void HTTP::Parser::SetVar(std::string i, std::string v){
/// \return True if a whole request or response was read, false otherwise. /// \return True if a whole request or response was read, false otherwise.
bool HTTP::Parser::Read(Socket::Connection & conn){ bool HTTP::Parser::Read(Socket::Connection & conn){
//Make sure the received data ends in a newline (\n). //Make sure the received data ends in a newline (\n).
while ( !seenHeaders && *(conn.Received().get().rbegin()) != '\n'){ while ((!seenHeaders || (getChunks && !doingChunk)) && *(conn.Received().get().rbegin()) != '\n'){
if (conn.Received().size() > 1){ if (conn.Received().size() > 1){
//make a copy of the first part //make a copy of the first part
std::string tmp = conn.Received().get(); std::string tmp = conn.Received().get();