[prev in list] [next in list] [prev in thread] [next in thread]
List: apache-modperl
Subject: Re: reading multipart forms
From: jesse () vm ! com (Jesse Erlbaum)
Date: 1999-05-31 23:32:00
[Download RAW message or body]
korte@lite.msu.edu,Internet writes:
>Independently of "multipart", I had problems reading POST data into mod_perl
>modules, the $r->content would somehow not do the trick (could be me,
though).
>I ended up writing this:
>-----
> my $buffer;
> $r->read($buffer,$r->header_in('Content-length'));
> my @pairs=split(/&/,$buffer);
> my $pair; my $name; my $value; my %FORM;
> foreach $pair (@pairs) {
> ($name,$value) = split(/=/,$pair);
> $FORM{$name}=$value;
> }
>-----
Thanks for the pointer! I used the $r->read() method to get at the content,
and that did the trick. Perhaps the $r->content method can be adapted to
return an array of hashes containing multipart data, or something like that.
FYI, this is for a very interesting proxying system. Essentially, I needed to
build a passing proxy which would wait until the Handler phase -- until the
Authentication and Authorization phases had "done their thing." That way, I
could apply security rules to allow or disallow access to proxied directories,
dynamically. Once the proxy has been allowed, a proxy request is passed to a
localhost Apache HTTP caching proxy server (via LWP) to be executed.
One problem I'm still having is that mod_perl has to receive the entire
response before handing it back to the browser client. When downloading large
files, this is a pretty bad situation. Beyond the speed problem, if I
download a 20 MB file, my HTTPd process is now +20 MB! Not great.
It appears that the built-in Apache HTTPd proxy streams the data instead of
building up a large blob of data and passing it back to the client. I can't
think of a way to do this same thing in mod_perl. Any ideas?
Thanks!
-Jesse-
--
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Jesse Erlbaum ........... mailto:jesse@vm.com
Lead Programmer/IT Director .. Vanguard Media
data: 212.242.7685...voice: 212.242.5317 x115
+-+-+-+-+-+-+- http://www.vm.com/ +-+-+-+-+-+-+-+
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic