Re: Simple program _setting_ REMOTE_ADDR - SOLUTION
Like that but work-around earlier today for Apache::Request to work around a MIME formatting but in IE on the Mac. Lame. 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 Here's the handler: #!/bin/perl package LHSC::FakeRemoteIP; use Apache::Constants qw /:common/; use strict; sub handler { my $r = shift; $r-connection-remote_ip("1.2.3.4"); return OK; } 1; I've tested it and it works perfectly. ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
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 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;
Re: Simple program _setting_ REMOTE_ADDR - SOLUTION
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 also probably would be a good idea to restore the "real" address after so your logs show the actual client IP. Something like this: Good points. This is my first real foray outside of content handlers, so I chose something early on in the request phase. I'll give the code you've provided a try this afternoon. ...Steve -- Steve van der Burg Information Services London Health Sciences Centre (519) 685-8300 ext 35559 [EMAIL PROTECTED]
RE: Simple program _setting_ REMOTE_ADDR - SOLUTION
-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;