[Catalyst] Wrong content-length value (since 5.7001?)
Adam Sjøgren
adsj at novozymes.com
Sun Sep 10 23:45:16 CEST 2006
On Sun, 10 Sep 2006 22:20:50 +0100, Paul wrote:
>> A guess: Your browser does not re-send the files you have chosen in
>> file-type INPUT-elements when you do a reload+confirm instead of
>> back+submit?
> Why would it not do that? I'm using Firefox 1.5.
I don't know. Maybe it's a bug, maybe it's a security thing?
> I've been using this reload-to-resend-the-data technique for months,
> and it's only just broken. There's been no changes to that bit of my
> code and when I upgraded to 5.7001 I started seeing these errors. It's
> possible there's some other issue but the timing is intriguing.
Indeed.
Here is a test I just did: First I click submit in a simple form; this
is what happens on the wire:
$ sudo ngrep -Wbyline -dlo port 3000
interface: lo (127.0.0.0/255.0.0.0)
filter: (ip or ip6) and ( port 3000 )
####
T 127.0.0.1:34438 -> 127.0.0.1:3000 [AP]
POST / HTTP/1.1.
Host: topper:3000.
User-Agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6 (Debian-1.5.dfsg+1.5.0.6-3).
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5.
Accept-Language: en,en-gb;q=0.8,sv;q=0.5,da;q=0.3.
Accept-Encoding: gzip,deflate.
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7.
Keep-Alive: 300.
Connection: keep-alive.
Referer: http://topper:3000/.
##
T 127.0.0.1:34438 -> 127.0.0.1:3000 [AP]
Content-Type: multipart/form-data; boundary=---------------------------1832925122708485651154490992.
##
T 127.0.0.1:34438 -> 127.0.0.1:3000 [AP]
Content-Length: 228.
.
##
T 127.0.0.1:34438 -> 127.0.0.1:3000 [AP]
-----------------------------1832925122708485651154490992.
Content-Disposition: form-data; name="upload"; filename="test.txt".
Content-Type: text/plain.
.
##
T 127.0.0.1:34438 -> 127.0.0.1:3000 [AP]
Test text
##
T 127.0.0.1:34438 -> 127.0.0.1:3000 [AP]
.
-----------------------------1832925122708485651154490992--.
##
T 127.0.0.1:3000 -> 127.0.0.1:34438 [AP]
HTTP/1.0 200 OK.
##
T 127.0.0.1:3000 -> 127.0.0.1:34438 [AP]
Connection: close.
Date: Sun, 10 Sep 2006 21:36:10 GMT.
Content-Length: 176.
Content-Type: text/html; charset=utf-8.
Status: 200.
X-Catalyst: 5.7001.
##
T 127.0.0.1:3000 -> 127.0.0.1:34438 [AP]
.
##
T 127.0.0.1:3000 -> 127.0.0.1:34438 [AP]
<html><head><title>Test</title><body><form action="./" method="post" enctype="multipart/form-data"><input type="file" name="upload" /><input type="submit"></form></body></html>
####
As you can see, the contents of the file I selected called "test.txt",
"Test text" is sent by Firefox.
Then I click Reload and "Ok" in the window that pops up asking me
whether to resubmit the data, and this happens on the wire:
####
T 127.0.0.1:34439 -> 127.0.0.1:3000 [AP]
POST / HTTP/1.1.
Host: topper:3000.
User-Agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6 (Debian-1.5.dfsg+1.5.0.6-3).
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5.
Accept-Language: en,en-gb;q=0.8,sv;q=0.5,da;q=0.3.
Accept-Encoding: gzip,deflate.
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7.
Keep-Alive: 300.
Connection: keep-alive.
Referer: http://topper:3000/.
Cache-Control: max-age=0.
##
T 127.0.0.1:34439 -> 127.0.0.1:3000 [AP]
Content-Type: multipart/form-data; boundary=---------------------------1832925122708485651154490992.
##
T 127.0.0.1:34439 -> 127.0.0.1:3000 [AP]
Content-Length: 228.
.
##
T 127.0.0.1:34439 -> 127.0.0.1:3000 [AP]
-----------------------------1832925122708485651154490992.
Content-Disposition: form-data; name="upload"; filename="test.txt".
Content-Type: text/plain.
.
#####exit
As you can see, Firefox omits the contents of the file this time, and
Catalyst reports the problem:
[error] Caught exception in engine "Wrong Content-Length value: 230 at /usr/share/perl5/Catalyst.pm line 1565"
If I click back and then submit the form again, the file's contents
are sent and there is no [error].
I'm using Firefox 1.5.dfsg+1.5.0.6-3 (Debian GNU/Linux unstable on
PPC).
I may be way off, but that is what it looks like to me.
Best regards,
Adam
--
Adam Sjøgren
adsj at novozymes.com
More information about the Catalyst
mailing list