You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Mark Maunder <ma...@ziptree.com> on 2003/07/16 21:49:52 UTC

Double erroneous requests in POST with multipart/form-data

This has got me stumped, any help is much appreciated:

I'm using IE6 and mod_perl 1.27 with apache 1.3.27. I have mod_rewrite
and mod_proxy and mod_gzip compiled into the server, but have now
disabled all of them until I sort this problem out. IE generates a
request who's headers look like this from a sniffer's point of view:

POST /e/myg HTTP/1.1
Accept: */*
Referer: http://ziptree.com/e/myg
Accept-Language: en-us
Content-Type: multipart/form-data;
boundary=---------------------------7d31a435d08
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)
Host: ziptree.com
Content-Length: 797
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ztid=52616e646f6d4956aca247f49143acab646412868d6eda23;
ztid=52616e646f6d495616e14f825d3799273ac52995e708d08b


It's only generating on request - I've double checked that. But in my
access log I see this:
68.5.106.9 - - [16/Jul/2003:14:37:51 -0500] "POST /e/myg HTTP/1.1" 200
16
68.5.106.9 - - [16/Jul/2003:14:37:51 -0500]
"-----------------------------7d31a435d08" 501 -

(The two lines above have probably been split by your mail reader, but
they both start with the ip 68.5...)

Also, intermittently I get "Invalid method in request" reported in the
error_log like this:
[Wed Jul 16 14:37:51 2003] [error] [client 68.5.106.9] Invalid method in
request -----------------------------7d31a435d08

It looks like Apache is getting confused by the boundary data and thinks
it's another request. It's occured to me that this could be a bug in IE
incorrectly specifying the boundry?

One of the unpleasant side effects of this is that my user loses their
session because what Apache considers the first 'request' does not
contain a cookie, so we just issue a fresh session ID which overwrites
the previous one.

I found these in the list archives, but no replies to either.
http://groups.yahoo.com/group/modperl/message/34118
http://groups.yahoo.com/group/modperl/message/52778

-- 
Mark Maunder <ma...@ziptree.com>



Re: Double erroneous requests in POST with multipart/form-data

Posted by Mark Maunder <ma...@ziptree.com>.
Thanks for all the feedback. This problem is strange in that I haven't
been able to duplicate it. IE got itself in a wierd situation where I
would hit Reload (and press OK to confirm a rePOST) and the problem
would consistently occur. Once I took IE out of that loop, I couldn't
duplicate it. 

The thing that bugged me is that when I google'd it I found a few other
people who had the same problem with POSTed multipart data. So I suspect
it's just some IE strangeness that causes the 'boundary' spec in the
header to be malformed in some circumstances and causes Apache to think
it's two pipelined requests, the second one which is asking for '/'.

I'll re-post if I come up with anything useful or am able to reproduce
this.

On Thu, 2003-07-17 at 04:39, Stas Bekman wrote:
> Mark Maunder wrote:
> > I'm running all scripts under Apache::Registry and using Apache::Request
> > because I'm handling file uploads. Sorry, should have included that. 
> > 
> > I did test this: I modified the Apache::Registry script that was being
> > posted to so that it didn't create an Apache::Registry request object,
> > but simply did a print "Content-type: text/html\n\nTesting123\n"; And I
> > got the same double request problem.  So it seems that it's Apache not
> > liking that particular request for some reason. 
> > 
> > Here's something wierd. I telnetted to my server's port 80 and pasted
> > the request, and it didn't reproduce the problem. 
> 
> Try using the command line user agent, e.g. lwp, lynx or else, where you can 
> control the involvement of the user agent. For example you can see response 
> headers, which probably aren't available under IE.
> 
> [...]
> 
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
-- 
Mark Maunder <ma...@ziptree.com>
ZipTree Inc.


Re: Double erroneous requests in POST with multipart/form-data

Posted by Stas Bekman <st...@stason.org>.
Mark Maunder wrote:
> I'm running all scripts under Apache::Registry and using Apache::Request
> because I'm handling file uploads. Sorry, should have included that. 
> 
> I did test this: I modified the Apache::Registry script that was being
> posted to so that it didn't create an Apache::Registry request object,
> but simply did a print "Content-type: text/html\n\nTesting123\n"; And I
> got the same double request problem.  So it seems that it's Apache not
> liking that particular request for some reason. 
> 
> Here's something wierd. I telnetted to my server's port 80 and pasted
> the request, and it didn't reproduce the problem. 

Try using the command line user agent, e.g. lwp, lynx or else, where you can 
control the involvement of the user agent. For example you can see response 
headers, which probably aren't available under IE.

[...]

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Double erroneous requests in POST with multipart/form-data

Posted by Mark Maunder <ma...@ziptree.com>.
I'm running all scripts under Apache::Registry and using Apache::Request
because I'm handling file uploads. Sorry, should have included that. 

I did test this: I modified the Apache::Registry script that was being
posted to so that it didn't create an Apache::Registry request object,
but simply did a print "Content-type: text/html\n\nTesting123\n"; And I
got the same double request problem.  So it seems that it's Apache not
liking that particular request for some reason. 

Here's something wierd. I telnetted to my server's port 80 and pasted
the request, and it didn't reproduce the problem. 

Also, this doesn't happen on every POST to that script. Just that
particular one. So I kept hitting Reload and got prompted by IE whether
I wanted to retry the POST (in less technical terms) and said yes. And
every time it would kick out the errors described. Then when I left that
page and went back in, everything was fine. 

It's one of those toughies that is hard to reproduce, but my gut feel
says it's going to come up again.

On Wed, 2003-07-16 at 13:18, David Dick wrote:
> What are you using to parse the request? CGI.pm?
> 
> Mark Maunder wrote:
> 
> >This has got me stumped, any help is much appreciated:
> >
> >I'm using IE6 and mod_perl 1.27 with apache 1.3.27. I have mod_rewrite
> >and mod_proxy and mod_gzip compiled into the server, but have now
> >disabled all of them until I sort this problem out. IE generates a
> >request who's headers look like this from a sniffer's point of view:
> >
> >POST /e/myg HTTP/1.1
> >Accept: */*
> >Referer: http://ziptree.com/e/myg
> >Accept-Language: en-us
> >Content-Type: multipart/form-data;
> >boundary=---------------------------7d31a435d08
> >Accept-Encoding: gzip, deflate
> >User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)
> >Host: ziptree.com
> >Content-Length: 797
> >Connection: Keep-Alive
> >Cache-Control: no-cache
> >Cookie: ztid=52616e646f6d4956aca247f49143acab646412868d6eda23;
> >ztid=52616e646f6d495616e14f825d3799273ac52995e708d08b
> >
> >
> >It's only generating on request - I've double checked that. But in my
> >access log I see this:
> >68.5.106.9 - - [16/Jul/2003:14:37:51 -0500] "POST /e/myg HTTP/1.1" 200
> >16
> >68.5.106.9 - - [16/Jul/2003:14:37:51 -0500]
> >"-----------------------------7d31a435d08" 501 -
> >
> >(The two lines above have probably been split by your mail reader, but
> >they both start with the ip 68.5...)
> >
> >Also, intermittently I get "Invalid method in request" reported in the
> >error_log like this:
> >[Wed Jul 16 14:37:51 2003] [error] [client 68.5.106.9] Invalid method in
> >request -----------------------------7d31a435d08
> >
> >It looks like Apache is getting confused by the boundary data and thinks
> >it's another request. It's occured to me that this could be a bug in IE
> >incorrectly specifying the boundry?
> >
> >One of the unpleasant side effects of this is that my user loses their
> >session because what Apache considers the first 'request' does not
> >contain a cookie, so we just issue a fresh session ID which overwrites
> >the previous one.
> >
> >I found these in the list archives, but no replies to either.
> >http://groups.yahoo.com/group/modperl/message/34118
> >http://groups.yahoo.com/group/modperl/message/52778
> >
> >  
> >
-- 
Mark Maunder <ma...@ziptree.com>
ZipTree Inc.


Re: Double erroneous requests in POST with multipart/form-data

Posted by David Dick <da...@iprimus.com.au>.
What are you using to parse the request? CGI.pm?

Mark Maunder wrote:

>This has got me stumped, any help is much appreciated:
>
>I'm using IE6 and mod_perl 1.27 with apache 1.3.27. I have mod_rewrite
>and mod_proxy and mod_gzip compiled into the server, but have now
>disabled all of them until I sort this problem out. IE generates a
>request who's headers look like this from a sniffer's point of view:
>
>POST /e/myg HTTP/1.1
>Accept: */*
>Referer: http://ziptree.com/e/myg
>Accept-Language: en-us
>Content-Type: multipart/form-data;
>boundary=---------------------------7d31a435d08
>Accept-Encoding: gzip, deflate
>User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)
>Host: ziptree.com
>Content-Length: 797
>Connection: Keep-Alive
>Cache-Control: no-cache
>Cookie: ztid=52616e646f6d4956aca247f49143acab646412868d6eda23;
>ztid=52616e646f6d495616e14f825d3799273ac52995e708d08b
>
>
>It's only generating on request - I've double checked that. But in my
>access log I see this:
>68.5.106.9 - - [16/Jul/2003:14:37:51 -0500] "POST /e/myg HTTP/1.1" 200
>16
>68.5.106.9 - - [16/Jul/2003:14:37:51 -0500]
>"-----------------------------7d31a435d08" 501 -
>
>(The two lines above have probably been split by your mail reader, but
>they both start with the ip 68.5...)
>
>Also, intermittently I get "Invalid method in request" reported in the
>error_log like this:
>[Wed Jul 16 14:37:51 2003] [error] [client 68.5.106.9] Invalid method in
>request -----------------------------7d31a435d08
>
>It looks like Apache is getting confused by the boundary data and thinks
>it's another request. It's occured to me that this could be a bug in IE
>incorrectly specifying the boundry?
>
>One of the unpleasant side effects of this is that my user loses their
>session because what Apache considers the first 'request' does not
>contain a cookie, so we just issue a fresh session ID which overwrites
>the previous one.
>
>I found these in the list archives, but no replies to either.
>http://groups.yahoo.com/group/modperl/message/34118
>http://groups.yahoo.com/group/modperl/message/52778
>
>  
>