Re: [Catalyst] Wrong Content-Length value
see here: https://rt.cpan.org/Public/Bug/Display.html?id=53226 Am 09.09.2010 02:03, schrieb Nicholas Wehr: agree - seems to warrant more of a 'warn' than 'error'. On Wed, Sep 8, 2010 at 4:59 PM, Bill Moseley mose...@hank.org mailto:mose...@hank.org wrote: On Wed, Sep 8, 2010 at 4:13 PM, Nicholas Wehr catal...@bionikchickens.com mailto:catal...@bionikchickens.com wrote: okay - in this context I can understand your original message. I think catalyst is behaving okay. In your example, the client is disconnected so it cannot receive a response code. in my test telnet where I ran your example, I fed more data in than was expected - but since I left the client connected I got a response. the server went ahead and detected the content-length and failed gracefully, though cryptically... Correct, because it only checks: if ( $remaining 0 ) { Not sure why it's ok for the Content-Length to be less than the actual content and not the other way around. Regardless, my question was just is this the level of an error? Do we really care if a request is disconnected? I can downgrade the message to a warn in my logging code to avoid getting emails about it every few hours. -- Bill Moseley mose...@hank.org mailto:mose...@hank.org ___ List: Catalyst@lists.scsys.co.uk mailto:Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- Mit freundlichen Grüßen Felix Antonius Wilhelm Ostmann --- Websuche Search Technology GmbH Co. KG Martinistraße 3, D-49080 Osnabrück, Germany --- Tel.: +49 541 40666-0, Fax: +49 541 40666-22 Email: i...@websuche.de, Web: www.websuche.de --- AG Osnabrück - HRA 200252, Ust-IdNr.: DE814737310 --- Komplementärin: Websuche Search Technology Verwaltungs GmbH AG Osnabrück - HRB 200359, Geschäftsführer: Ansas Meyer --- ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Wrong Content-Length value
We have exactly the same problem. Every error triggers emails to the dev-team. And this occure ~20 times a day. Perhaps it is not paranoid and a simple 410 (or similar) will be a better answer without sending errors to the app? Am 09.09.2010 01:59, schrieb Bill Moseley: On Wed, Sep 8, 2010 at 4:13 PM, Nicholas Wehr catal...@bionikchickens.com mailto:catal...@bionikchickens.com wrote: okay - in this context I can understand your original message. I think catalyst is behaving okay. In your example, the client is disconnected so it cannot receive a response code. in my test telnet where I ran your example, I fed more data in than was expected - but since I left the client connected I got a response. the server went ahead and detected the content-length and failed gracefully, though cryptically... Correct, because it only checks: if ( $remaining 0 ) { Not sure why it's ok for the Content-Length to be less than the actual content and not the other way around. Regardless, my question was just is this the level of an error? Do we really care if a request is disconnected? I can downgrade the message to a warn in my logging code to avoid getting emails about it every few hours. -- Bill Moseley mose...@hank.org mailto:mose...@hank.org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- Mit freundlichen Grüßen Felix Antonius Wilhelm Ostmann --- Websuche Search Technology GmbH Co. KG Martinistraße 3, D-49080 Osnabrück, Germany --- Tel.: +49 541 40666-0, Fax: +49 541 40666-22 Email: i...@websuche.de, Web: www.websuche.de --- AG Osnabrück - HRA 200252, Ust-IdNr.: DE814737310 --- Komplementärin: Websuche Search Technology Verwaltungs GmbH AG Osnabrück - HRB 200359, Geschäftsführer: Ansas Meyer --- ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Wrong Content-Length value
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. # 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 ); } Shouldn't that just return 411, 413, or just a 400? And then there's: eval { }; if ( my $error = $@ ) { chomp $error; $class-log-error(qq/Caught exception in engine $error/); } Should check return value from eval instead. -- Bill Moseley mose...@hank.org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Wrong Content-Length value
so which engine and version are you using? apache? built-in http? fastcgi? On Wed, Sep 8, 2010 at 2:08 PM, Bill Moseley mose...@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. # 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 ); } Shouldn't that just return 411, 413, or just a 400? And then there's: eval { }; if ( my $error = $@ ) { chomp $error; $class-log-error(qq/Caught exception in engine $error/); } Should check return value from eval instead. -- Bill Moseley mose...@hank.org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Wrong Content-Length value
On Wed, Sep 8, 2010 at 2:16 PM, Nicholas Wehr catal...@bionikchickens.comwrote: so which engine and version are you using? apache? built-in http? fastcgi? Apache, but that message is in Catalyst::Engine parent class. -- Bill Moseley mose...@hank.org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Wrong Content-Length value
interesting problem. so the client is making byte-range requests on dynamic content? if it's static - I'd recommend you defer this functionality to apache. On Wed, Sep 8, 2010 at 2:30 PM, Bill Moseley mose...@hank.org wrote: On Wed, Sep 8, 2010 at 2:16 PM, Nicholas Wehr catal...@bionikchickens.com wrote: so which engine and version are you using? apache? built-in http? fastcgi? Apache, but that message is in Catalyst::Engine parent class. -- Bill Moseley mose...@hank.org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Wrong Content-Length value
On Wed, Sep 8, 2010 at 2:30 PM, Bill Moseley mose...@hank.org wrote: On Wed, Sep 8, 2010 at 2:16 PM, Nicholas Wehr catal...@bionikchickens.com wrote: so which engine and version are you using? apache? built-in http? fastcgi? Apache, but that message is in Catalyst::Engine parent class. FWIW, this was plaguing me in FastCGI too. I got around it there by running the script with env, --unset=HTTP_CONTENT_LENGTH. It's been months though and whatever understanding of the issue I had gained, I've since lost. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Wrong Content-Length value
On Wed, Sep 8, 2010 at 2:38 PM, Nicholas Wehr catal...@bionikchickens.comwrote: interesting problem. so the client is making byte-range requests on dynamic content? if it's static - I'd recommend you defer this functionality to apache. No, it's not that. It's simply that the client is sending a content-length header and after Catalyst / HTTP::Body slurps in the body Catalyst does a sanity check to see if the length of the body really was the length specified in the header. Watch: mose...@bumby2:~$ catalyst.pl Length mose...@bumby2:~$ CATALYST_DEBUG=0 Length/script/length_server.pl You can connect to your server at http://bumby2:3000 mose...@bumby2:~$ telnet localhost 3000 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. POST /foo HTTP/1.1 Host: localhost:3000 Content-Type: application/octet-stream Content-Length: 40 just some stuff ^] telnet quit Connection closed. Results in: [error] Caught exception in engine Wrong Content-Length value: 40 -- Bill Moseley mose...@hank.org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Wrong Content-Length value
okay - in this context I can understand your original message. I think catalyst is behaving okay. In your example, the client is disconnected so it cannot receive a response code. in my test telnet where I ran your example, I fed more data in than was expected - but since I left the client connected I got a response. the server went ahead and detected the content-length and failed gracefully, though cryptically... POST /foo HTTP/1.1 Host: localhost:3000 Content-Type: application/octet-stream Content-Length: 4 asdfgasdfasdf HTTP/1.0 404 Not Found Connection: close Date: Wed, 08 Sep 2010 23:09:47 GMT Content-Length: 14 Content-Type: text/html; charset=utf-8 Status: 404 X-Catalyst: 5.80024 Page not found On Wed, Sep 8, 2010 at 3:16 PM, Bill Moseley mose...@hank.org wrote: On Wed, Sep 8, 2010 at 2:38 PM, Nicholas Wehr catal...@bionikchickens.com wrote: interesting problem. so the client is making byte-range requests on dynamic content? if it's static - I'd recommend you defer this functionality to apache. No, it's not that. It's simply that the client is sending a content-length header and after Catalyst / HTTP::Body slurps in the body Catalyst does a sanity check to see if the length of the body really was the length specified in the header. Watch: mose...@bumby2:~$ catalyst.pl Length mose...@bumby2:~$ CATALYST_DEBUG=0 Length/script/length_server.pl You can connect to your server at http://bumby2:3000 mose...@bumby2:~$ telnet localhost 3000 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. POST /foo HTTP/1.1 Host: localhost:3000 Content-Type: application/octet-stream Content-Length: 40 just some stuff ^] telnet quit Connection closed. Results in: [error] Caught exception in engine Wrong Content-Length value: 40 -- Bill Moseley mose...@hank.org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Wrong Content-Length value
On Wed, Sep 8, 2010 at 4:13 PM, Nicholas Wehr catal...@bionikchickens.comwrote: okay - in this context I can understand your original message. I think catalyst is behaving okay. In your example, the client is disconnected so it cannot receive a response code. in my test telnet where I ran your example, I fed more data in than was expected - but since I left the client connected I got a response. the server went ahead and detected the content-length and failed gracefully, though cryptically... Correct, because it only checks: if ( $remaining 0 ) { Not sure why it's ok for the Content-Length to be less than the actual content and not the other way around. Regardless, my question was just is this the level of an error? Do we really care if a request is disconnected? I can downgrade the message to a warn in my logging code to avoid getting emails about it every few hours. -- Bill Moseley mose...@hank.org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Wrong Content-Length value
agree - seems to warrant more of a 'warn' than 'error'. On Wed, Sep 8, 2010 at 4:59 PM, Bill Moseley mose...@hank.org wrote: On Wed, Sep 8, 2010 at 4:13 PM, Nicholas Wehr catal...@bionikchickens.com wrote: okay - in this context I can understand your original message. I think catalyst is behaving okay. In your example, the client is disconnected so it cannot receive a response code. in my test telnet where I ran your example, I fed more data in than was expected - but since I left the client connected I got a response. the server went ahead and detected the content-length and failed gracefully, though cryptically... Correct, because it only checks: if ( $remaining 0 ) { Not sure why it's ok for the Content-Length to be less than the actual content and not the other way around. Regardless, my question was just is this the level of an error? Do we really care if a request is disconnected? I can downgrade the message to a warn in my logging code to avoid getting emails about it every few hours. -- Bill Moseley mose...@hank.org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Wrong Content-Length value: 392918
I see these errors a few times a day. I wonder why this is happening -- could the browser really send the wrong content length? I seem to see it often in ajax calls for a progress bar, but also during file uploads and sometimes for just a normal post. Is there any additional info that could be included in the exception message that would help explain this? Perhaps the length of data actual read in addition to the content-length -- and maybe even the last few bytes read and the content-type? Could a failed or closed connection be causing this (and reported in the message)? # 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 ); } -- Bill Moseley mose...@hank.org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/