Re: [mp2] Changing response code after access phase

2004-07-16 Thread Stas Bekman
Geoffrey Young wrote: I would investigate other methods before trying this (such as the ideas Stas had), but the short answer is that yes, you can call core functions directly. see recipe 8.9 in the mod_perl developer's cookbook. http://www.modperlcookbook.org/code/ch08/Cookbook/MIMEMagic.pm Ah,

Re: [mp2] Changing response code after access phase

2004-07-16 Thread Geoffrey Young
>> I would investigate other methods before trying this (such as the >> ideas Stas >> had), but the short answer is that yes, you can call core functions >> directly. see recipe 8.9 in the mod_perl developer's cookbook. >> >> http://www.modperlcookbook.org/code/ch08/Cookbook/MIMEMagic.pm > >

Re: [mp2] Changing response code after access phase

2004-07-16 Thread Stas Bekman
Geoffrey Young wrote: Well then my next question then becomes: is it possible with mod_perl to hook into other modules' calls (I'm trying to not duplicate all of mod_access, merely change the return value)? eg along the lines of: sub handler { my $r = shift; if ($r->api_call('check_dir_access') =

Re: [mp2] Changing response code after access phase

2004-07-16 Thread Geoffrey Young
> Well then my next question then becomes: is it possible with mod_perl > to hook into other modules' calls (I'm trying to not duplicate all of > mod_access, merely change the return value)? > > eg along the lines of: > > sub handler { > my $r = shift; > if ($r->api_call('check_dir_access')

Re: [mp2] Changing response code after access phase

2004-07-16 Thread Stas Bekman
I think an easy workaround in this case is to reset all the future handlers that may have been run, dynamically register a custom response handler, where you do the redirect, return OK for the access phase and you are done. -- __ S

Re: [mp2] Changing response code after access phase

2004-07-16 Thread Stas Bekman
Stas Bekman wrote: Try: use Apache::Response (); use Apache::Const -compile => qw(FORBIDDEN); sub handler { $r->custom_response(Apache::FORBIDDEN, $url); ... } Ah, no, that will just change the body of the response, not the HTTP status (still 403). -- _

Re: [mp2] Changing response code after access phase

2004-07-16 Thread Stas Bekman
Rob Bloodgood wrote: Friday, July 16, 2004, 12:54:06 PM, you wrote: GY> Rob Bloodgood wrote: I'm using mod_access for Allow/Deny, and on Deny it of course responds to the client with FORBIDDEN. I've experimented with using a fixup handler to change this to a REDIRECT, GY> I don't see how that cou

Re[2]: [mp2] Changing response code after access phase

2004-07-16 Thread Rob Bloodgood
Friday, July 16, 2004, 12:54:06 PM, you wrote: GY> Rob Bloodgood wrote: >> I'm using mod_access for Allow/Deny, and on Deny it of course responds >> to the client with FORBIDDEN. I've experimented with using a fixup >> handler to change this to a REDIRECT, GY> I don't see how that could happen -

Re: [mp2] Changing response code after access phase

2004-07-16 Thread Geoffrey Young
Rob Bloodgood wrote: > I'm using mod_access for Allow/Deny, and on Deny it of course responds > to the client with FORBIDDEN. I've experimented with using a fixup > handler to change this to a REDIRECT, I don't see how that could happen - once you return something other than OK, DECLINED, or DO

[mp2] Changing response code after access phase

2004-07-16 Thread Rob Bloodgood
I'm using mod_access for Allow/Deny, and on Deny it of course responds to the client with FORBIDDEN. I've experimented with using a fixup handler to change this to a REDIRECT, but when I access the request object, $r->status seems to *always* be 200 OK. I haven't been able to locate an API call th

Re: Filehandle and formats problem

2004-07-16 Thread Geoffrey Young
please keep discussions on list so that everyone can benefit :) Dermot Paikkos wrote: > Thanx Geoffrey, > > You probably noticed - due to my lack of real perl know-how - that I > scooped a lot of that code from your book so another thanx. sure thing :) > > Its works, problem is I am not sure

Re: index.pl weirdness

2004-07-16 Thread Colin JN Breame
Finally figured this one out, and I'm embarrassed to say that it was the browser caching the result.  *blush* Thanks for your help, Colin Wouter van Vliet wrote: On dinsdag 13 juli 2004 18:12, Colin JN Breame wrote: Geoffrey Young wrote: Colin JN Breame wrote:

Re: Filehandle and formats problem

2004-07-16 Thread Geoffrey Young
> I am pretty sure this is my ignorance on file handles, can anyone > spot my error? yes :) > > my ($tempfile,$fh) = Apache::File->tmpfile; in general, you should avoid using $tmpfile unless you absolutely need it. in this case you don't :) > open(CLOCK,">$tempfile") || die "

Filehandle and formats problem

2004-07-16 Thread Dermot Paikkos
Hi, Mod_perl 1.27 on linux OS. I am trying to create a small app that sends the user a file. I am using Apache::File->tmpfile to create a temporary file which is formatted using a simple format. However I can't seem to get it to work correctly and I am either getting an empty file or a server

Re: Replicating mod_autoindex's behaviour with a modperl handler

2004-07-16 Thread Geoffrey Young
> One more problem I'm now having with this is in the UserDir. Is there > any way for me to get the mapping from apache of the real directory that > /~user/ means? not really. mod_userdir applies some URI translations that you can't really see. but they are pretty easy to figure out and emulate

Re: Replicating mod_autoindex's behaviour with a modperl handler

2004-07-16 Thread Rando Christensen
On Thu, 15 Jul 2004 16:26:54 -0600 Rando Christensen <[EMAIL PROTECTED]> wrote: > Yes, in order to make it work, I ended up making the handler be called > > /virtual/indexer, created a /virtual dir, did a global alias of > /virtual to that dir, and created an empty file named indexer. > Director

Re: [mp2] $r->read() return negative value.

2004-07-16 Thread wood chen
I have just test it on mod_perl 1.99_14 with Apache 2.0.50, and it works fine now. On Fri, 9 Jul 2004 14:54:14 +0800, wood chen <[EMAIL PROTECTED]> wrote: > I'm using CGI.pm 3.05 with mod_per 1.99 and Apache 2.0.40 on a Red > Hat Linux 9 box. When uploading a large file to my perl script, > If I