On Thu, Nov 29, 2007 at 03:08:12PM +0000, place wrote:
> No change in behavior is intended.
>
Yes, that code is getting hard to understand.
After a review, I wondered why Cache_parse_header() is dealing
with the message body, when it should only parse the header, and
why is it getting the (buf, bufsize) pair when it has the content
in entry->Header.
It looks that a cleaner way would be something like:
(not tested, just pseudo-code)
if (!(entry->Flags & CA_GotHeader)) {
while ((len = Cache_get_header(entry, buf + start, buf_size - start))) {
/* Let's scan, allocate, and set things according to header info */
Cache_parse_header(entry);
if (entry->Flags & CA_GotHeader) {
start += len;
} else
// Let the flow continue downward so the remaining
// of the buffer is processed
}
return;
}
and to get rid of the:
dbuf = a_Decode_process(entry->TransferDecoder, dbuf);
dbuf = a_Decode_process(entry->ContentDecoder, dbuf);
lines inside Cache_parse_header().
Please give it a try.
--
Cheers
Jorge.-