]> git.saurik.com Git - apt.git/blobdiff - methods/http.cc
* merged from mainline
[apt.git] / methods / http.cc
index dc3f0b7639f7d5f34530b65a1adea7bb5b0eddcc..cb63ada499f9df866f96f143a0eec53608fbf7ad 100644 (file)
@@ -58,7 +58,6 @@ unsigned long PipelineDepth = 10;
 unsigned long TimeOut = 120;
 bool Debug = false;
 
-
 unsigned long CircleBuf::BwReadLimit=0;
 unsigned long CircleBuf::BwTickReadData=0;
 struct timeval CircleBuf::BwReadTick={0,0};
@@ -241,28 +240,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;