PUT handler

Greetings.

I would like to create a mod_perl PUT handler, but I don't really
understand if I have for that to do anything special in the handler()
method (apart from dealing with the PUT data itself).
Is there an example somewhere ?

In particular, I don't understand this page :
http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html# C_allowed_

Does that mean that I have to tell Apacher somehow in advance that I do
accept PUT requests, or does it mean the opposite ?

Thanks.
aw [ Fr, 24 April 2009 15:51 ] [ ID #1999067 ]

Re: PUT handler

Hello,

You do not have to 'tell' apache your going to do anything...in fact, =

there are no mechanisms or reasons to do something like that with the =

mod_perl architecture. You simply handle the request as you want to...

There are some stipulations handling PUT requests, if you read it
directly from stream you can only do it once, for example. Ensure you =

read the mod_perl docs on it and try it out.

Ps. If you find the dogs cryptic, feel free to share your experience
through blogs or documentation contributions!

Thanks,

S

On Apr 24, 2009, at 6:51 AM, Andr=C3=A9 Warnier <aw [at] ice-sa.com> wrote:

> Greetings.
>
> I would like to create a mod_perl PUT handler, but I don't really
> understand if I have for that to do anything special in the
> handler() method (apart from dealing with the PUT data itself).
> Is there an example somewhere ?
>
> In particular, I don't understand this page :
> http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html# C_allowed_
>
> Does that mean that I have to tell Apacher somehow in advance that I =

> do accept PUT requests, or does it mean the opposite ?
>
> Thanks.
ELINTPimp [ Fr, 24 April 2009 16:22 ] [ ID #1999068 ]

Re: PUT handler

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..


Steve Siebert wrote:
> Hello,
>
> You do not have to 'tell' apache your going to do anything...in fact,
> there are no mechanisms or reasons to do something like that with the
> mod_perl architecture. You simply handle the request as you want to...
>
> There are some stipulations handling PUT requests, if you read it
> directly from stream you can only do it once, for example. Ensure you
> read the mod_perl docs on it and try it out.
>
> Ps. If you find the dogs cryptic, feel free to share your experience
> through blogs or documentation contributions!
>
aw [ Fr, 24 April 2009 16:39 ] [ ID #1999069 ]

Re: PUT handler

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) = [at] _;
if ($r->method eq 'PUT') {
return $self->handle_put($r);
}
return DECLINED; #or whatever
}

sub handle_put {
my ($self,$r) = [at] _;

# 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
Adam Prime [ Fr, 24 April 2009 17:12 ] [ ID #1999070 ]

Re: PUT handler

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) = [at] _;
> if ($r->method eq 'PUT') {
> return $self->handle_put($r);
> }
> return DECLINED; #or whatever
> }
>
> sub handle_put {
> my ($self,$r) = [at] _;
>
> # 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
>
aw [ Fr, 24 April 2009 17:25 ] [ ID #1999071 ]
Webserver » gmane.comp.apache.mod-perl » PUT handler

Vorheriges Thema: PerlIO :APR / apr_file_open() flag issue
Nächstes Thema: cannot LoadModule mod_perl on apache2.2