rfminelli / lusca-cache

Automatically exported from code.google.com/p/lusca-cache
GNU General Public License v2.0
0 stars 0 forks source link

Problem with POST and Continue "handling" #132

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
From Roelf:

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?

Original issue reported on code.google.com by adrian.c...@gmail.com on 19 Nov 2010 at 5:40

GoogleCodeExporter commented 8 years ago

Here's the fix I'm currently testing

Index: http.c
===================================================================
--- http.c      (revision 14819)
+++ http.c      (working copy)
@@ -1148,6 +1148,7 @@
        if (reply->sline.status >= 100 && reply->sline.status < 200)
{
               debug(1, 1) ("httpReadReply: FD %d: skipping 1xx
response!\n", fd);
               httpReplyReset(reply);
+               storeEntryReset(entry);
               httpState->reply_hdr_state = 0;
               po += done;             /* Skip the reply in the
incoming buffer */
               done = 0;               /* So we don't double-account
*/

Original comment by adrian.c...@gmail.com on 19 Nov 2010 at 5:41

GoogleCodeExporter commented 8 years ago
Another example, from a TPROXY list member (hugo):

Thank you

example one : www.deacentavos.com

the login form as this structure:

<form
action="https://www.deacentavos.com/index/signin/return/aL0F1Y3Rpb25DZW50a"
method="post" clientside="1" enctype="application/x-www-form-urlencoded"

i compiled squid 3.1.8 whith all helpers possible options,
but the site, or not permit to login or tell you that always
are logged.

yes , the programming quality is really poor , but is that i have rounding
sudamerica.

other (the more complicated) is www.cnxplus.com.ar, site dedicated to
authorize oncological prescriptions to clincals.

mainly are based on IIS.

i think that better is to have a way to bypass them , because are only
the 0.03% of total traffic.

Original comment by adrian.c...@gmail.com on 19 Nov 2010 at 6:05

GoogleCodeExporter commented 8 years ago
Specific case tested and fixed in r14827

Original comment by roelf.di...@gmail.com on 19 Nov 2010 at 9:04

GoogleCodeExporter commented 8 years ago
i'm use lusca r14827, 
squid -v
configure options:  '--prefix=/usr' '--libexecdir=/usr/lib/squid' 
'--datadir=/usr/lib/squid' '--sysconfdir=/etc/squid' '--enable-async-io' 
'--with-aufs-threads=32' '--with-pthreads' '--with-aio' '--with-dl' 
'--enable-removal-policies=lru,heap' '--enable-storeio=aufs,coss' 
'--enable-epoll' '--enable-delay-pools' '--enable-large-cache-files' 
'--with-large-files' '--enable-x-accelerator-vary' 
'--enable-follow-x-forwarded-for' '--enable-select' '--enable-arp-acl' 
'--enable-stacktraces' '--with-maxfd=65536' '--disable-dependency-tracking' 
'--disable-ident-lookups' '--enable-linux-netfilter' 
'--enable-kill-parent-hack' '--enable-cache-digests' '--enable-leakfinder' 
'--enable-truncate' '--enable-snmp' '--disable-unlinkd' '--disable-wccp' 
'--disable-wccpv2' '--disable-caps' '--disable-referer-log' 
'--enable-http-gzip' '--enable-err-languages=Indonesia' 
'--enable-default-err-language=Indonesia' 
'--enable-ntlm-auth-helpers=SMB,fakeauth' '--enable-auth=basic,digest,ntlm'

but still have that problem what wrong .. ?

Original comment by hedy.joe@gmail.com on 26 Nov 2010 at 4:37