Bug#152711: apt: chunked encoding bug
On Thu, Dec 11, 2003 at 08:07:28PM -0700, Jason Gunthorpe wrote:
> Oh blah. No wonder this is so hard to reproduce.
>
> The problem is this little bit:
>
> do
> {
> if (In.WriteTillEl(Data,true) == true)
> break;
> }
> while ((Last = Owner->Go(false,this)) == true);
>
> Which reads the chunk length, but 'WriteTillEl' gobbles the extra ^M.
> It should work if you make the inner for loop in WriteTillEl an if
> statement so it doesn't gobble.
>
> Hopefully Matt can fix this now :>
I assume the change should apply to both of those inner loops...is something
like this what you meant? I'm not entirely sure what the meaning of Single is.
--- http.cc.~1.58.~ 2004-02-26 16:52:41.000000000 -0800
+++ http.cc 2004-05-04 20:26:24.000000000 -0700
@@ -203,13 +203,17 @@
{
if (Buf[I%Size] != '\n')
continue;
- for (I++; I < InP && Buf[I%Size] == '\r'; I++);
+ ++I;
+ if (I < InP && Buf[I%Size] == '\r')
+ ++I;
if (Single == false)
{
if (Buf[I%Size] != '\n')
continue;
- for (I++; I < InP && Buf[I%Size] == '\r'; I++);
+ ++I;
+ if (I < InP && Buf[I%Size] == '\r')
+ ++I;
}
if (I > InP)
--
- mdz
Reply to: