Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

StoneTable's scratchpad

by StoneTable (Beadle)
on Sep 16, 2004 at 20:37 UTC ( [id://391562]=scratchpad: print w/replies, xml ) Need Help??

use APR::Brigade (); use APR::Bucket (); use Apache2::Filter (); use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::Const -compile => qw(MODE_READBYTES); use APR::Const -compile => qw(BLOCK_READ); use constant IOBUFSIZE => 8192; sub parse_http_params { my $r = shift; # Apache2::RequestRec object my %params = (); my $args = ''; if ($r->method eq "POST") { my $bb = APR::Brigade->new($r->pool, $r->connection->bucket_alloc); my $seen_eos = 0; do { $r->input_filters->get_brigade($bb, Apache2::Const::MODE_R +EADBYTES, APR::Const::BLOCK_READ, IOBUFSIZE); for (my $b = $bb->first; $b; $b = $bb->next($b)) { if ($b->is_eos) { $seen_eos++; last; } if ($b->read(my $buf)) { $args .= $buf; } $b->remove; # optimization to reuse memory } } while (!$seen_eos); $bb->destroy; } elsif ($r->method eq "GET") { $args = $r->args; } if (length($args) > 0) { my @rawparams = split /&/, $args; foreach my $param (@rawparams) { my @p = split /=/, $param; $params{$p[0]} = $p[1]; } } return %params; }
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2024-04-19 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found