perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: PUT handler
Date Fri, 24 Apr 2009 15:25:56 GMT
Thanks.

That is pretty much what I've seen so far in my browsing.
I was just feeling uneasy because it looks somewhat /too/ simple.

For a special problem, I have to "disguise" a multi-part POST request 
from a client into a PUT request, and handle it as such on the server.

It's an interesting problem, but I feel a bit uneasy about it, don't 
know why really.


Adam Prime wrote:
> André Warnier wrote:
>> Thanks.
>> Do you happen to know /where/ in the on-line mod_perl docs there is 
>> information about handling a PUT request.
>> (I found a nice article in German on the web, here :
>> http://www.farid-hajji.net/books/de/Hajji_Farid/pbv2/ew/cgi-upload.html
>> )
>> Searching for "+mod_perl +"put handler" gives some interesting 
>> historical material..
> 
> I don't think i've ever seen anything about PUT requests directly, but 
> i'd imagine you'd just do something like (completely untested):
> 
> sub handler :method {
>     my ($self,$r) = @_;
>     if ($r->method eq 'PUT') {
>         return $self->handle_put($r);
>     }
>     return DECLINED; #or whatever
> }
> 
> sub handle_put {
>     my ($self,$r) = @_;
> 
>     # read the content with $r->read and the content-length header
> 
>     # do whatever you want to do with the content of the put request.
> 
>     return OK;
> }
> 
> Using a handler anyway.
> 
> Adam
> 


Mime
View raw message