in reply to Re: mod-perl2 re-using $ENV{REMOTE_ADDR}
in thread mod-perl2 re-using $ENV{REMOTE_ADDR}
ScriptAlias /cgi-bin/ /var/www/perl-cgi/ PerlSwitches -wT <Directory /var/www/perl-cgi> SetHandler perl-script PerlHandler ModPerl::Registry PerlSendHeader On AllowOverride None Options +ExecCGI -MultiViews </Directory>
use Data::Validate::IP qw(is_ip is_public_ip is_loopback_ip); @IPs=''; undef $ip; if (defined $ENV{HTTP_X_FORWARDED_FOR}) { @IPs=split /,/, $ENV{HTTP_X_FORWARDED_FOR}; }; unshift (@IPs, $ENV{REMOTE_ADDR}); foreach $check (@IPs) { $check =~ s/^\s*(.*?)\s*$/\1/g; if (is_ip($check)) { if (defined $ip) { if (not is_public_ip($check)) { $check = $ip; }; if (is_loopback_ip($check)) { $check = $ip; }; if ($check eq "41.79.21.90") { $check = $ip; }; }; $ip = $check; }; }; print "Content-type: text/html\nCache-Control: max-age=0,no-cache,no-s +tore,post-check=0,pre-check=0\n\n<html><head><title>Current IP Check< +/title></head><body>Current IP Address: $ip</body></html>";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: mod-perl2 re-using $ENV{REMOTE_ADDR}
by Corion (Patriarch) on May 01, 2023 at 16:00 UTC |