Bug#152711: apt has problems with chunked encoding or publicfile?
while i can't be sure that i'm experiencing exactly the same problem
it's suspiciously similar so i'll post this here.
at work i am behind a proxy that chunks everything it sends to me.
while updating one of my Packages.gz sources consistently fails and it
is frustratingly difficult to try and install packages with apt as they
will fairly regularly fail on the check of the md5.
however, after looking into it, i found that apt seemed to be gobbling
up carriage returns after reading the chunk-size. so, in a situation
where you have:
chunk-size CRLF chunk-data CRLF,
and chunk-data begins with a CR, apt will corrupt the data.
an examination of the source suggested that CircleBuf::WriteTillEl()
will in fact potentially gobble up lots of CRs, and changing this
behavior to strictly consume one CRLF pair (two when (Single == false))
appears to have solved the problem for me.