Re: [SLUG] Apache mod_perl handlers

From: Dylan William Hardison (dylanwh@tampabay.rr.com)
Date: Thu May 29 2003 - 00:57:18 EDT


I'm writing a apache module to process requested .html
files with the Template Toolkit.
In one of the template files, I use $r->status(HTTP_FORBIDDEN),
when the HTTP referer doesn't match the hostname.
I could just make the page say "Forbidden. You're a bad person!"
But I thought it would be nicer (g) to set 403 page forbidden thingy.

The problem happens when I set the status with $r->status
and my handler returns OK.

Apache::Registry has given me a hint, it does the following:

--- Apache/Registry.pm ---
my $old_status = $r->status;

# ... lots of other stuff.

return $r->status($old_status);
--- end ---

So, I'm going to do that, I guess.

Also, OK != HTTP_OK. OK == 0, and HTTP_OK is, of course,
200.

Thanks anyway. :)

On Thursday, May 29, 2003 at 01:10AM -0400, btt@nethouse.com wrote:
> Hey there,
>
> I've used perl handlers in Apache a couple of times. In those couple
> of times, I've never needed to call $r->status() either to set or get
> the current status code. I would always just return the http response
> code in symbolic form (from Apache::Constants) right from the handler
> subroutine.
>
> I guess there's probably a very specific use for $r->status(), but
> sure beats me what it could be... maybe it is one of those 'because
> you can' functions. :)
>
> Well I hope this answered the question, i was a little unclear on what
> exactly you're trying to do...
>
> Cheers..
>

-- 
Bad men live that they may eat and drink, whereas good men eat and drink
that they may live.
                -- Socrates
GPG Fingerprint=D67D 2B75 53C6 9769 30E4  D390 239F C833 F32C F6F6
GPG KeyID=F32CF6F6



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:24:34 EDT