> -----Original Message-----
> From: Dan Rench [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 23, 2000 12:33 PM
> To: Steve van der Burg
> Cc: [EMAIL PROTECTED]
> Subject: Re: Simple program _setting_ REMOTE_ADDR - SOLUTION
> 
> 
> On Fri, 23 Jun 2000, Steve van der Burg wrote:
> 
> > Taking your remote_ip hint, and reading the Eagle a bit 
> more closely,
> > I came up with this:
> > 
> > In httpd.conf:
> > 
> > <Location /cgi-bin/VENDOR>
> > PerlAccessHandler LHSC::FakeRemoteIP
> > </Location>
> 
> Why an Access handler?  I realize it works, but a more appropriate
> phase would be PerlFixupHandler, since you aren't doing any access
> control in your module.  A couple other nitpicky points: you probably
> should return 'DECLINED' at the end, not 'OK', in case there are more
> handlers that want to do something during that phase and it 

  returning OK is fine for a fixup handler - as many fixup handlers as are
enabled will be run (same with just about all the phases except
PerlTransHandler and PerlTypeHandler, with some minor caveats)

--Geoff

> also probably
> would be a good idea to restore the "real" address after so your logs
> show the actual client IP.  Something like this:
> 
> package FakeIP;
> use strict;
> use Apache::Constants 'DECLINED';
> 
> sub handler {
>     my $r = shift;
>     $r->notes('true_client_ip', $r->connection->remote_ip);
>     $r->connection->remote_ip('1.2.3.4');
>     $r->push_handlers('PerlLogHandler' =>
>         sub {
>             my $r = shift;
>             $r->connection->remote_ip($r->notes('true_client_ip'));
>             return DECLINED;
>         }
>     );
>     return DECLINED;
> }
> 1;
> 

Reply via email to