From 927c393f1305925c1456c931e1e7b45afd6f051d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sun, 23 Oct 2005 11:12:54 +0000 Subject: * added http data corruption fix patch (#280844) --- methods/http.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'methods/http.cc') diff --git a/methods/http.cc b/methods/http.cc index e2337a9ba..dbf2d1b43 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -205,28 +205,23 @@ bool CircleBuf::WriteTillEl(string &Data,bool Single) if (Buf[I%Size] != '\n') continue; ++I; - if (I < InP && Buf[I%Size] == '\r') - ++I; if (Single == false) { - if (Buf[I%Size] != '\n') - continue; - ++I; if (I < InP && Buf[I%Size] == '\r') ++I; + if (I >= InP || Buf[I%Size] != '\n') + continue; + ++I; } - if (I > InP) - I = InP; - Data = ""; while (OutP < I) { unsigned long Sz = LeftWrite(); if (Sz == 0) return false; - if (I - OutP < LeftWrite()) + if (I - OutP < Sz) Sz = I - OutP; Data += string((char *)(Buf + (OutP%Size)),Sz); OutP += Sz; -- cgit v1.2.3