Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Request: Wrong Content-Length value: 2628941

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


moseley at hank

Nov 15, 2009, 6:55 AM

Post #1 of 5 (1187 views)
Permalink
Request: Wrong Content-Length value: 2628941

I see this error every once in a while. It does not seem like an aborted
connection (I get a different error for that). Is there any other reason
why the read() method might returning false before done.

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

I suppose if $buffer just happened to be zero. Probably should be checking
defined there.


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.

--
Bill Moseley
moseley [at] hank


bobtfish at bobtfish

Nov 15, 2009, 8:07 AM

Post #2 of 5 (1118 views)
Permalink
Re: Request: Wrong Content-Length value: 2628941 [In reply to]

On 15 Nov 2009, at 14:55, Bill Moseley wrote:

> I see this error every once in a while. It does not seem like an
> aborted connection (I get a different error for that). Is there any
> other reason why the read() method might returning false before done.
>
> while ( my $buffer = $self->read($c) ) {
> $c->prepare_body_chunk($buffer);
> }
>
> I suppose if $buffer just happened to be zero. Probably should be
> checking defined there.
>

Yep, that should be fixed.

>
> 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?

Cheers
t0m


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


moseley at hank

Nov 15, 2009, 4:00 PM

Post #3 of 5 (1119 views)
Permalink
Re: Request: Wrong Content-Length value: 2628941 [In reply to]

On Sun, Nov 15, 2009 at 8:07 AM, Tomas Doran <bobtfish [at] bobtfish> 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 = $self->read($c) ) {
$c->prepare_body_chunk($buffer);
}

# paranoia against wrong Content-Length header
my $remaining = $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


bobtfish at bobtfish

Nov 30, 2009, 6:21 PM

Post #4 of 5 (910 views)
Permalink
Re: Request: Wrong Content-Length value: 2628941 [In reply to]

On 15 Nov 2009, at 16:07, Tomas Doran wrote:

>> I suppose if $buffer just happened to be zero. Probably should be
>> checking defined there.
>>
>
> Yep, that should be fixed.

This has been fixed in trunk, r12100

http://dev.catalystframework.org/svnweb/Catalyst/revision?rev=12100

Does that look sane to you?

On 16 Nov 2009, at 00:00, Bill Moseley wrote:
>
> Did you miss the subject of the message?

Yes, sorry, I was being dumb :)

> 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.
<snip>

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

Taken onboard and on my list :_)

Cheers
t0m


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


moseley at hank

Nov 30, 2009, 8:51 PM

Post #5 of 5 (912 views)
Permalink
Re: Request: Wrong Content-Length value: 2628941 [In reply to]

On Mon, Nov 30, 2009 at 6:21 PM, Tomas Doran <bobtfish [at] bobtfish> wrote:

> On 15 Nov 2009, at 16:07, Tomas Doran wrote:
>
> I suppose if $buffer just happened to be zero. Probably should be
>>> checking defined there.
>>>
>>>
>> Yep, that should be fixed.
>>
>
> This has been fixed in trunk, r12100
>
> http://dev.catalystframework.org/svnweb/Catalyst/revision?rev=12100
>
> Does that look sane to you?


Sure. Always good to have sane code. Thanks for taking time for this.

Like I said, I get these errors every so often, and it would be nice to
understand why -- not sure if it's a broken client or perhaps some encoding
error. Not sure what additional error message would be helpful, though.


Thanks again,




--
Bill Moseley
moseley [at] hank

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.