I'd like some discussion before filing an issue and the appropriate
fix.
Referencing this bug:
http://code.google.com/p/lusca-cache/issues/detail?id=16&q=skip
The whole "Skipping over 100-Continue replies" thing seems to have
been open for a while and I've found in some of my tests that:
1.) Microsoft Windows Server 2003 can sometimes send "HTTP/1.1 100
Continue" replies, without the client having requested it by adding a
"Expect: 100-continue" header during the request. Theres an open KB
entry about it.
2.)When "HTTP/1.1 100 Continue" is received by Lusca from a server the
resulting reply to the client has additional data in they body that
shouldn't be there.
3.) This appears to be due to the "Skipping" of 1xx replies in http.c
httpReadReply, as the malformed body that my clients received has
exactly the length of junk added to it as the length of the "HTTP/1.1
100 Continue" reply.
I've had a long hard read thru the code for httpReadReply in http.c
and it appears that during the "Handle 1xx response skipping here "
loop, when httpProcessReplyHeader is called stuff is appended using
storeAppend to the entry
When a full 100-Continue reply is read, httpReplyReset is called, to
reset the reply structures and to start looking for another header.
However the store entry is still sitting with some data in it, and
this appears to leak into the body later. I've tested a fix by adding
a "storeEntryReset(entry);" right after the httpReplyReset(reply) and
it seems to fix my bug.
I've tested one website
http://www.dsg.co.za/ that seems to exhibit
this problem with Lusca. One of the "rotating flashy flashy" goodies
on that site makes an HTTP POST, and via Lusca the response is always
broken due to about 24 extra bytes being added to the body.
The logic in httpReadReply confounds me a bit, but my suspicion is
that the following patch should fix things nicely. It certainly has --
for me, but hasn't been tested in topend production use.
Adrian, since the rewritten httpReadReply seems to be largely your
doing, could you give me an opinion on the above?