summaryrefslogtreecommitdiff
path: root/methods/http.cc
diff options
context:
space:
mode:
Diffstat (limited to 'methods/http.cc')
-rw-r--r--methods/http.cc16
1 files changed, 6 insertions, 10 deletions
diff --git a/methods/http.cc b/methods/http.cc
index ba86aa6b6..dbf2d1b43 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -58,6 +58,7 @@ unsigned long PipelineDepth = 10;
unsigned long TimeOut = 120;
bool Debug = false;
+
// CircleBuf::CircleBuf - Circular input buffer /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -95,7 +96,7 @@ bool CircleBuf::Read(int Fd)
// Woops, buffer is full
if (InP - OutP == Size)
return true;
-
+
// Write the buffer segment
int Res;
Res = read(Fd,Buf + (InP%Size),LeftRead());
@@ -204,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;