.namespace [ 'MyAuthHandler' ]
# handler.imc
.sub _handler
.local pmc r
.local pmc ap_const
.local string pw
.local int status
find_global ap_const, 'Apache::Constants', 'ap_constants'
# get the request_rec object
find_type $I0, 'Apache::RequestRec'
r = new $I0
# decline if not the initial request
$I1 = r.'is_initial_req'( )
if $I1 != 1 goto auth_declined
(status, pw) = r.'get_basic_auth_pw'( )
if pw != 'squawk' goto auth_failure
$I0 = ap_const['OK']
goto auth_return_status
auth_failure:
$I0 = ap_const['HTTP_UNAUTHORIZED']
goto auth_return_status
auth_declined:
$I0 = ap_const['DECLINED']
goto auth_return_status
auth_return_status:
.pcc_begin_return
.return $I0
.pcc_end_return
.end
-----
# httpd.conf
ParrotInit /tmp/init.pbc
ParrotLoad /tmp/Constants.pbc
ParrotLoad /tmp/RequestRec.pbc
ParrotLoad /tmp/handler.pbc
<Directory /usr/local/apache2/htdocs/parrot/private>
ParrotAuthenHandler MyAuthHandler
AuthType Basic
AuthName "Parrot Test"
Require valid-user
</Directory>
-jeff
for sure. but it's actually been quite a smooth ride so far. i have a
short list of problems i've had to deal with, and i'll forward them to the
list when i get the chance.
what i'd really like to see is a language that utilizes parrot objects
(AFAIK there isn't one right now). once we have this, we can start
writing handlers in a high level language and REALLY have something to
show off. ;-)
-jeff
On Wed, 20 Oct 2004, Dan Sugalski wrote:
> At 2:27 PM -0400 10/20/04, Jeff Horwitz wrote:
> >mod_parrot now supports authentication handlers. i'm planning a release
> >in the next few days, including a whitepaper on its architecture, but
> >here's an example of what you can now do.
>
> Wow. That's... cool. And a bit scary. But definitely cool. I could
> have an excessive amount of fun with this.
>
> --
> Dan
>
> --------------------------------------it's like this-------------------
> Dan Sugalski even samurai
> d...@sidhe.org have teddy bears and even
> teddy bears get drunk
>
awesome
> -jeff
leo
Great.
>what i'd really like to see is a language that utilizes parrot objects
>(AFAIK there isn't one right now). once we have this, we can start
>writing handlers in a high level language and REALLY have something to
>show off. ;-)
Well, actually.... scary though it may be, my Work Project uses
parrot objects for everything. Whether this is a useful thing or
not's an open question (the language lacks subroutines, for example)
but...
in general, anything that can generate bytecode/PIR/PASM containing a
_handler subroutine in a parrot namespace would fit the bill.
-jeff
Hrm. I may have to introduce subs into the grammar for the language
just so I can make this work.