[Catalyst] [patch] Wrong Content-Length value error - Catalyst::Engine::CGI

Kazuma Shiraiwa cyberlib at gmail.com
Thu May 10 17:33:10 GMT 2007


Thanks for your attention.
Sorry.My explanation was insufficient.

CPU: Xeon2.6GHz
OS: CentOS4 Server -x86_64 - upgrade CentOS4.4 for yum
(Linux 2.6.9-42.0.3.ELsmp x86_64 GNU/Linux)
Perl: v5.8.8 built for x86_64-linux
WebServer: Apache/2.0.52

It doesn't happen every POST.
POST size is about 4096 byte over.
It happen form style <form method=3D"post">.
It doesn't happen form style <form method=3D"post"
enctype=3D"multipart/form-data"> up to now.

I understand.
read FILEHANDLE, SCALAR, LENGTH
  After it saves buffer to LENGTH, it returns.LENGTH is return size.
sysread FILEHANDLE, SCALAR, LENGTH
  As soon as return buffer.LENGTH is max size.

sysread return values, and read return value isn't same always.
Is it a misunderstanding?

Attached file:
sysread_check.cgi
read_check.cgi

It checked it now.
The following are the results.

result - sysread_check.cgi
 strings_length: 41101
 content_length: 41101
 count: 24
  1 : 2730
  2 : 1402
  3 : 4096
  4 : 3904
  5 : 1814
  6 : 1402
  7 : 1402
  8 : 1292
  9 : 1402
 10 : 1402
 11 : 1402
 12 : 1402
 13 : 1402
 14 : 1402
 15 : 1402
 16 : 1402
 17 : 1402
 18 : 1402
 19 : 1402
 20 : 1402
 21 : 1402
 22 : 1402
 23 : 1402
 24 : 2029

result - read_check.cgi
 content_length: 41101
 total_length: 41101
 count: 6
  1 : 7000
  2 : 7000
  3 : 7000
  4 : 7000
  5 : 7000
  6 : 6101

Sysread and read return same value on another machine.
CPU: Celeron 500MHz
OS: CentOS4.4-i386 - clean install
(Linux 2.6.18-8.1.3.el5 i686 i386 GNU/Linux)
Perl: v5.8.8 built for i386-linux-thread-multi
WebServer: Apache/2.2.3

result - read_check.cgi & sysread_check.cgi
 content_length: 41101
 total_length: 41101
 count: 6
  1 : 7000
  2 : 7000
  3 : 7000
  4 : 7000
  5 : 7000
  6 : 6101

This difference happen because of the machine.
I thought that it resulted the same if it was "read".

thanks.

--
Kazuma Shiraiwa


2007/5/10, Andy Grundman <andy at hybridized.org>:
>
> On May 10, 2007, at 5:56 AM, Kazuma Shiraiwa wrote:
>
> > Hi,
> >
> > (Catalyst-Runtime-5.7007)
> > Wrong Content-Length value: 4387 at
> > /usr/lib/perl5/site_perl/5.8.8/Catalyst.pm line 1584
> >
> > I worried because of this error.
> > I was using Catalyst::Engine::CGI.
> > (Xeon2.6GHz CentOS4.4-x86_64-smp Perl5.8.8-x86_64-linux)
> >
> > in Catalyst::Engine::CGI
> > sub read_chunk { shift; shift; *STDIN->sysread(@_); }
> >
> > I think that "*STDIN->read" is better.
> > (Because "sysread" has what doesn't return the expected value.)
> > So I wrote this patch.
> > Wrong Content-Length value error did not occur when this patch was
> > applied.
> > Please use this patch when it is good.
>
> What web server are you using?  Did it happen on every POST?  Was the
> POST body truncated?
>
> Both sysread and read should return the same values, and I think we
> need to stick with sysread here.
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.or=
g/
> Dev site: http://dev.catalyst.perl.org/
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: read_check.cgi
Type: application/octet-stream
Size: 799 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070511/c978=
24bc/read_check-0001.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sysread_check.cgi
Type: application/octet-stream
Size: 808 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070511/c978=
24bc/sysread_check-0001.obj


More information about the Catalyst mailing list