List Info

Thread: Bug with POSTs using cat 5.7007, and parse_on_demand = 1




Bug with POSTs using cat 5.7007, and parse_on_demand = 1
country flaguser name
United Kingdom
2007-05-18 16:06:33
Hi,

I have found a bug with catalyst, when
Catalyst::Engine::HTTP is used with 
parse_on_demand set to true, and POST content. when I post,
the 
connection 'hangs'. if i hit esc in the browser, I get the
following cat 
output:

Can't call FIRSTKEY method on handle DBI::db=HASH(0x9858670)
after 
take_imp_data() at
/usr/lib/perl5/site_perl/5.8.8/Data/Dump.pm line 251.
Can't call FIRSTKEY method on handle DBI::db=HASH(0x984a6ec)
after 
take_imp_data() at
/usr/lib/perl5/site_perl/5.8.8/Data/Dump.pm line 251.
[info] *** Request 1 (0.200/s) [17010] [Fri May 18 21:59:01
2007] ***
[debug] "POST" request for
"wedding/invite/add" from "127.0.0.1"
[debug] Path is "wedding/invite/add"
[debug] Found sessionid
"6b7b217cfca6320d5f6579dbe7b4087ce8102acb" in
cookie
[debug] Restored session
"6b7b217cfca6320d5f6579dbe7b4087ce8102acb"
[debug] Body Parameters are:
.-------------------------------------+---------------------
-----------------.
| Parameter                           | Value               
                |
+-------------------------------------+---------------------
-----------------+
| _submit                             | Add new invite      
                |
| _submitted_invite                   | 1                   
                |
| address                             |                     
                |
| email                               |                     
                |
| invited                             | 0                   
                |
| known_by                            | 639359              
                |
| name                                | blah                
                |
| type                                | service             
                |
'-------------------------------------+---------------------
-----------------'
[error] Caught exception in
Wedding::Controller::Root->end "Wrong 
Content-Length value: 107 at
/usr/lib/perl5/site_perl/5.8.8/Catalyst.pm line 
1611"
[debug] Found sessionid
"6b7b217cfca6320d5f6579dbe7b4087ce8102acb" in
cookie
[debug] Restored session
"6b7b217cfca6320d5f6579dbe7b4087ce8102acb"
[debug] Redirecting to "http:
//localhost:3000/wedding/invite/view"
[info] Request took 5.621478s (0.178/s)
.-----------------------------------------------------------
-----+-----------.
| Action                                                    
    | Time      |
+-----------------------------------------------------------
-----+-----------+
| /auto                                                     
    | 0.263820s |
| /wedding/auto                                             
    | 0.000924s |
| /wedding/invite/add                                       
    | 0.171354s |
| /end                                                      
    | 4.483848s |
'-----------------------------------------------------------
-----+-----------'

The FIRSTKEY stuff is some tied hash access to DBI (keys or
something), and 
I'm not sure why it is saying 'Wrong content-length value' -
this is perhaps 
the key to the error? When I run the server under perl -d,
and hit ^C when 
it's hanging, it shows it being this:

Catalyst::Engine::HTTP::read_chunk(/usr/lib/perl5/site_perl/
5.8.8/Catalyst/Engine/HTTP.pm:131):
131:            my $rc = *STDIN->sysread(_);

I guess cat is mis-parsing the amount of data that it
expects from the POST 
command? When i turn parse_on_demand off, it all works
fine...

Mark

_______________________________________________
List: Catalystlists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/

Re: Bug with POSTs using cat 5.7007, and parse_on_demand = 1
country flaguser name
United States
2007-05-18 16:18:52
On May 18, 2007, at 5:06 PM, Mark Zealey wrote:

>
Catalyst::Engine::HTTP::read_chunk(/usr/lib/perl5/site_perl/
5.8.8/ 
> Catalyst/Engine/HTTP.pm:131):
> 131:            my $rc = *STDIN->sysread(_);
>
> I guess cat is mis-parsing the amount of data that it
expects from  
> the POST
> command? When i turn parse_on_demand off, it all works
fine...

Hmm, you don't really need to use parse_on_demand, you can
just leave  
it disabled.

Still would like to track this down.  Can you make sure
you're also  
using the latest version of HTTP::Body?  Also, what browser
are you  
using?

_______________________________________________
List: Catalystlists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/

Re: Bug with POSTs using cat 5.7007, and parse_on_demand = 1
country flaguser name
United States
2007-05-18 16:24:17
One more thing, can you set the environment variable  
CATALYST_HTTP_DEBUG=1 and then run through your bad POST? 
This  
should give some helpful info.

_______________________________________________
List: Catalystlists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/

Re: Bug with POSTs using cat 5.7007, and parse_on_demand = 1
country flaguser name
United Kingdom
2007-05-18 18:41:57
After spending the past two hours looking through code etc,
I finally 
discovered this was a bug of my own making. Basically, I've
written a custom 
little FormBuilder controller module that loads .pm files
with formbuilder 
specs. As part of that, it specified that it wanted { params
=> $c->req }, 
which wouldn't normally be a problem except that then in the
base class, I do 
a Hash::Merge with some other values that I want. This by
default does a 
Clone on the hashes, hence cloning $c->req. This meant
that $c->req-> 
was read in the cloned version when ->param was called,
but it was then 
called again in the non-cloned version which caused it to
want to read the 
data again. Pfew!

Mark

On Friday 18 May 2007 10:24 pm, Andy Grundman wrote:
> One more thing, can you set the environment variable
> CATALYST_HTTP_DEBUG=1 and then run through your bad
POST?  This
> should give some helpful info.
>
> _______________________________________________
> List: Catalystlists.rawmode.org
> Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
> Dev site: http://dev.catalyst.per
l.org/

_______________________________________________
List: Catalystlists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )