[Catalyst] Request: Wrong Content-Length value: 2628941

Bill Moseley moseley at hank.org
Mon Nov 16 00:00:52 GMT 2009


On Sun, Nov 15, 2009 at 8:07 AM, Tomas Doran <bobtfish at bobtfish.net> wrote:

>
>
>> Could this message be updated to report the length of the body read, too?
>>  And maybe display the last X bytes of data read might be useful in some
>> cases.
>>
>
> You haven't told us what the error actually is?


Did you miss the subject of the message?  Or do you mean why I got the error
I quoted in the subject?  I'm not sure why I got the error.  I see it
somewhat often, but I'm not sure if it's a client overstating the content
length or something else.  That's why I was asking about having the error
provide more info.

        while ( my $buffer =3D $self->read($c) ) {
            $c->prepare_body_chunk($buffer);
        }

        # 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" );
        }

So, either read returned false before it should have (seems unlikely it
would be empty string or zero) or client overstated.  Again, I tend to get a
separate error if the client aborts.

Can you think of how that error might be more informative?  Might be
somewhat helpful to see the last chunk from read or the body.

E.g.  Expected $content_length bytes but read only $body_length.  Last 100
bytes are: $last_chunk.





-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20091115/16165=
261/attachment.htm


More information about the Catalyst mailing list