[Catalyst] Re: "Wrong Content-Length value"

Bill Moseley moseley at hank.org
Mon Sep 13 23:02:15 GMT 2010

On Wed, Sep 8, 2010 at 2:08 PM, Bill Moseley <moseley at hank.org> wrote:

> The problem I have with this code is that requests can trigger an error on
> demand.  Errors eventually trigger an email to a bunch of people. But it's
> for an error nobody can fix.

"Wrong Content-Length value: $length"

I've received hundreds of these in the last day.  Many seem to be AJAX
requests (many PUTs) which makes me wonder if there's some broken clients
that are failing to send the body.  Also, a lot of OPTIONS request.  And
some I suspect are people fooling around as I see content lengths like 55,
555, 55555 from the same IP address for the same request in a short amount
of time.

I use Log4perl and send "error" level messages off to a separate file which
then a cron job will mail off every few minutes.  I can filter them by
adding regular expressions to my config which downgrades the message to a
warn, but I have to push out new config to all the web servers.

I need a smarter system where the logs get filtered by an external process
that can be updated dynamically with filters.  After I see 100 similar
messages I can probably afford to suppress that message so other more
important messages don't get lost in the noise.

Anyone have a system that does something like that?

>         # paranoia against wrong Content-Length header
>         my $remaining =3D $length - $self->read_position;
>         if ( $remaining > 0 ) {
>             $self->finalize_read($c);
>             Catalyst::Exception->throw(
>                 "Wrong Content-Length value: $length" );
>         }
> Shouldn't that just return 411, 413, or just a 400?
> And then there's:
>      eval {
>       ....
>     };
>     if ( my $error =3D $@ ) {
>         chomp $error;
>         $class->log->error(qq/Caught exception in engine "$error"/);
>     }
> Should check return value from eval instead.
> --
> Bill Moseley
> moseley at hank.org

-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100913/4243a=

More information about the Catalyst mailing list