Mailing List

Flat
Apache HTTP protocol handlers with modern Perl?
User: zjt
Date: 4/30/2012 12:28 pm
Views: 323
Rating: 0
Is there a "modern Perl" way to implement HTTP protocol handlers in
Apache?  https://perl.apache.org/docs/2.0/user/handlers/http.html

Jesse

Re: Apache HTTP protocol handlers with modern Perl?
User: mcholste
Date: 4/30/2012 1:02 pm
Views: 0
Rating: 0
Plack

On Mon, Apr 30, 2012 at 12:28 PM,   wrote:
> zjt wrote:
>
> Is there a "modern Perl" way to implement HTTP protocol handlers in
> Apache?  https://perl.apache.org/docs/2.0/user/handlers/http.html
>
> Jesse
>
> View Online
>
>
>
> Madison Area Perl Mongers - MadMongers
> http://www.madmongers.org
Re: Apache HTTP protocol handlers with modern Perl?
User: zjt
Date: 4/30/2012 2:35 pm
Views: 0
Rating: 0
For whatever reason, I wasn't having much luck with something like the
following, so I just want to make sure I'm not barking up the wrong tree
before I invest more time.

PerlPostReadRequestHandler Plack::Handler::Apache2
PerlSetVar psgi_app /path/to/app.pl

Is something like mod_psgi going to offer hooks into the HTTP request
phases?  The docs don't seem to say so.

Jesse

On 4/30/12 1:03 PM, mcholste@gmail.com wrote:
> mcholste wrote:
>
> Plack
>
> On Mon, Apr 30, 2012 at 12:28 PM, wrote:
>  > zjt wrote:
>  >
>  > Is there a "modern Perl" way to implement HTTP protocol handlers in
>  > Apache?  https://perl.apache.org/docs/2.0/user/handlers/http.html
>  >
>  > Jesse
>  >
>  > View Online
>  >
>  >
>  >
>  > Madison Area Perl Mongers - MadMongers
>  > http://www.madmongers.org
>
> View Online
>
>
>
>
> Madison Area Perl Mongers - MadMongers
> http://www.madmongers.org

Re: Apache HTTP protocol handlers with modern Perl?
User: mcholste
Date: 4/30/2012 2:53 pm
Views: 0
Rating: 0
I'm using Plack with PerlResponseHandler, a la:
http://code.google.com/p/enterprise-log-search-and-archive/source/browse/trunk/elsa/web/conf/apache_site.conf
.  The PSGI is at:
http://code.google.com/p/enterprise-log-search-and-archive/source/browse/trunk/elsa/web/lib/Web.psgi
.  It gives Plack full control over everything that happens.  I even
use it for file uploads and downloads, via the direct filehandle glob,
which is really handy.  In the future, I may use it to do some
HTML5-style streaming, etc.

On Mon, Apr 30, 2012 at 2:35 PM,   wrote:
> zjt wrote:
>
> For whatever reason, I wasn't having much luck with something like the
> following, so I just want to make sure I'm not barking up the wrong tree
> before I invest more time.
>
> PerlPostReadRequestHandler Plack::Handler::Apache2
> PerlSetVar psgi_app /path/to/app.pl
>
> Is something like mod_psgi going to offer hooks into the HTTP request
> phases?  The docs don't seem to say so.
>
> Jesse
>
>
> On 4/30/12 1:03 PM, mcholste@gmail.com wrote:
>> mcholste wrote:
>>
>> Plack
>>
>> On Mon, Apr 30, 2012 at 12:28 PM, wrote:
>>  > zjt wrote:
>>  >
>>  > Is there a "modern Perl" way to implement HTTP protocol handlers in
>>  > Apache?  https://perl.apache.org/docs/2.0/user/handlers/http.html
>>  >
>>  > Jesse
>>  >
>>  > View Online
>>  >
>>  >
>>  >
>>  > Madison Area Perl Mongers - MadMongers
>>  > http://www.madmongers.org
>>
>> View Online
>>
>>
>>
>>
>> Madison Area Perl Mongers - MadMongers
>> http://www.madmongers.org
>
> View Online
>
>
>
> Madison Area Perl Mongers - MadMongers
> http://www.madmongers.org
Re: Apache HTTP protocol handlers with modern Perl?
User: zjt
Date: 4/30/2012 3:13 pm
Views: 0
Rating: 0
Must be pebcak then.  Thanks!

Jesse

On 4/30/12 2:53 PM, mcholste@gmail.com wrote:
> mcholste wrote:
>
> I'm using Plack with PerlResponseHandler, a la:
> http://code.google.com/p/enterprise-log-search-and-archive/source/browse/trunk/elsa/web/conf/apache_site.conf
> . The PSGI is at:
> http://code.google.com/p/enterprise-log-search-and-archive/source/browse/trunk/elsa/web/lib/Web.psgi
> . It gives Plack full control over everything that happens. I even
> use it for file uploads and downloads, via the direct filehandle glob,
> which is really handy. In the future, I may use it to do some
> HTML5-style streaming, etc.
>
> On Mon, Apr 30, 2012 at 2:35 PM, wrote:
>  > zjt wrote:
>  >
>  > For whatever reason, I wasn't having much luck with something like the
>  > following, so I just want to make sure I'm not barking up the wrong tree
>  > before I invest more time.
>  >
>  > PerlPostReadRequestHandler Plack::Handler::Apache2
>  > PerlSetVar psgi_app /path/to/app.pl
>  >
>  > Is something like mod_psgi going to offer hooks into the HTTP request
>  > phases?  The docs don't seem to say so.
>  >
>  > Jesse
>  >
>  >
>  > On 4/30/12 1:03 PM, mcholste@gmail.com wrote:
>  >> mcholste wrote:
>  >>
>  >> Plack
>  >>
>  >> On Mon, Apr 30, 2012 at 12:28 PM, wrote:
>  >> > zjt wrote:
>  >> >
>  >> > Is there a "modern Perl" way to implement HTTP protocol handlers in
>  >> > Apache?  https://perl.apache.org/docs/2.0/user/handlers/http.html
>  >> >
>  >> > Jesse
>  >> >
>  >> > View Online
>  >> >
>  >> >
>  >> >
>  >> > Madison Area Perl Mongers - MadMongers
>  >> > http://www.madmongers.org
>  >>
>  >> View Online
>  >>
>  >>
>  >>
>  >>
>  >> Madison Area Perl Mongers - MadMongers
>  >> http://www.madmongers.org
>  >
>  > View Online
>  >
>  >
>  >
>  > Madison Area Perl Mongers - MadMongers
>  > http://www.madmongers.org
>
> View Online
>
>
>
>
> Madison Area Perl Mongers - MadMongers
> http://www.madmongers.org

Re: Apache HTTP protocol handlers with modern Perl?
User: tmurray
Date: 4/30/2012 1:16 pm
Views: 0
Rating: 0
I implemented Apache::GopherHandler, though its been a long time since I
touched that or any other Protocol Handler.

I don't know that there is any specific advice about Modern Perl and
Protocol Handlers.  Protocol Handlers aren't used very much, so I'm
guessing that everybody just follows general Modern Perl style (keep
namespaces separate, use strict, lexical vars, etc.) and makes up the
rest as they go.

My only recommendation is that like Apache::GopherHandler and
Gopher::Server, have a standalone backend module that handles the
protocol on its own (which is what Gopher::Sever is), then have a
separate code base that glues that and Apache together (done by
Apache::GopherHandler).

On 4/30/2012 12:28 PM, jesse.thompson@doit.wisc.edu wrote:
> zjt wrote:
>
> Is there a "modern Perl" way to implement HTTP protocol handlers in
> Apache? https://perl.apache.org/docs/2.0/user/handlers/http.html
>
> Jesse
>
> View Online
>
>
>
>
> Madison Area Perl Mongers - MadMongers
> http://www.madmongers.org

Re: Apache HTTP protocol handlers with modern Perl?
User: zjt
Date: 4/30/2012 2:58 pm
Views: 0
Rating: 0
On a tangent... Interestingly, in my application where I need to
maintain some sort of state to determine if there are tons of requests
from the same IP to the same URI, it's very handy to use a global var.
I only need to know if X requested Y more than Z times during an Apache
process's lifetime.  Using a global var for state appears to work
exceedingly well, especially since I don't need to actually "save" the
state anywhere.  Although, I'm reserving the possibility that my
assumptions will be different with a heavily loaded server.

Jesse

On 4/30/12 1:16 PM, tmurray@wumpus-cave.net wrote:
> everybody just follows general Modern Perl style (keep
> namespaces separate, use strict, lexical vars, etc.) and makes up the
> rest as they go.

Re: Apache HTTP protocol handlers with modern Perl?
User: haarg
Date: 4/30/2012 1:39 pm
Views: 0
Rating: 0
Depends on what handlers you want to use.

If you are handling the response in perl, there's little reason to use
any of them, and it's simpler to deal with everything in perl directly
using PSGI via FastCGI or a reverse proxy.

If you want to use some of the other handlers to wrap a standard
Apache response (static files or some other Apache module), then you'd
just use the normal way of creating/configuring a mod_perl handler.
I'm not aware of any more friendly or more 'modern' alternative.
Re: Apache HTTP protocol handlers with modern Perl?
User: zjt
Date: 4/30/2012 2:39 pm
Views: 0
Rating: 0
My specific application involves implementing DOS protection from
misconfigured Mozilla Lightning clients for an upstream proprietary
CalDAV server.  I can't modify the CalDAV server, so I need to hook into
the HTTP request cycle in Apache prior to the request being proxied.

I have a proof of concept implementation of a standard mod_perl app that
hooks in via "PerlAccessHandler".  I was just wondering what options I
have to make it more plack-ish.

Jesse

On 4/30/12 1:39 PM, haarg@haarg.org wrote:
> haarg wrote:
>
> Depends on what handlers you want to use.
>
> If you are handling the response in perl, there's little reason to use
> any of them, and it's simpler to deal with everything in perl directly
> using PSGI via FastCGI or a reverse proxy.
>
> If you want to use some of the other handlers to wrap a standard
> Apache response (static files or some other Apache module), then you'd
> just use the normal way of creating/configuring a mod_perl handler.
> I'm not aware of any more friendly or more 'modern' alternative.
>
> View Online
>
>
>
>
> Madison Area Perl Mongers - MadMongers
> http://www.madmongers.org

Re: Apache HTTP protocol handlers with modern Perl?
User: haarg
Date: 4/30/2012 2:50 pm
Views: 0
Rating: 0
Plack/PSGI is the modern alternative for writing a Perl web
application.  For your needs, they aren't appropriate, and you'd just
use  normal mod_perl handlers.
Re: Apache HTTP protocol handlers with modern Perl?
User: zjt
Date: 4/30/2012 2:58 pm
Views: 0
Rating: 0
Thanks!

On 4/30/12 2:50 PM, haarg@haarg.org wrote:
> haarg wrote:
>
> Plack/PSGI is the modern alternative for writing a Perl web
> application. For your needs, they aren't appropriate, and you'd just
> use normal mod_perl handlers.
>
> View Online
>
>
>
>
> Madison Area Perl Mongers - MadMongers
> http://www.madmongers.org

Re: Apache HTTP protocol handlers with modern Perl?
User: afbach
Date: 4/30/2012 8:11 pm
Views: 0
Rating: 0
On Mon, Apr 30, 2012 at 2:39 PM,   wrote:
> My specific application involves implementing DOS protection from
> misconfigured Mozilla Lightning clients for an upstream proprietary
> CalDAV server.  I can't modify the CalDAV server, so I need to hook into
> the HTTP request cycle in Apache prior to the request being proxied.

I wish I could help but I'm just trying to get my jaw back up enough
to close my mouth - wow! if I ever think *I'm* having troubles ... ;->

I think this should be a lightening talk (no pun intended) though I'd
not understand a word of it, I'd bet.

Good luck!

--

a

Andy Bach,
afbach@gmail.com
608 658-1890 cell
608 261-5738 wk
Re: Apache HTTP protocol handlers with modern Perl?
User: zjt
Date: 5/1/2012 4:13 pm
Views: 0
Rating: 0
I can do a lightning talk on it next meeting.  This capability of
mod_perl is very handy.

Jesse

On 4/30/12 8:11 PM, afbach@gmail.com wrote:
> afbach wrote:
>
> On Mon, Apr 30, 2012 at 2:39 PM, wrote:
>  > My specific application involves implementing DOS protection from
>  > misconfigured Mozilla Lightning clients for an upstream proprietary
>  > CalDAV server.  I can't modify the CalDAV server, so I need to hook into
>  > the HTTP request cycle in Apache prior to the request being proxied.
>
> I wish I could help but I'm just trying to get my jaw back up enough
> to close my mouth - wow! if I ever think *I'm* having troubles ... ;->
>
> I think this should be a lightening talk (no pun intended) though I'd
> not understand a word of it, I'd bet.
>
> Good luck!
>
> --
>
> a
>
> Andy Bach,
> afbach@gmail.com
> 608 658-1890 cell
> 608 261-5738 wk
>
> View Online
>
>
>
>
> Madison Area Perl Mongers - MadMongers
> http://www.madmongers.org

PreviousNext
Madison Area Perl Mongers