RRD-Simple

 view release on metacpan or  search on metacpan

examples/rrd-server/cgi-bin/rrd-server.cgi  view on Meta::CPAN

my $param = get_query($ENV{QUERY_STRING});
my $remote_addr = $ENV{REMOTE_ADDR};

# Take the host from the "target" if they know the "secret"
if (defined($ENV{RRD_SECRET}) && defined($param->{secret} && defined($param->{target}))
		&& "$ENV{RRD_SECRET}" eq "$param->{secret}") {
	$host = $param->{target};

} else {
	# Check for HTTP proxy source addresses
	for (qw(HTTP_X_FORWARDED_FOR HTTP_VIA HTTP_CLIENT_IP HTTP_PROXY_CONNECTION
			FORWARDED_FOR X_FORWARDED_FOR X_HTTP_FORWARDED_FOR HTTP_FORWARDED)) {
		if (defined $ENV{$_} && $ENV{$_} =~ /([\d\.]+)/) {
			my $ip = $1;
			if (isIP($ip)) {
				$remote_addr = $ip;
				last;
			}
		}
	}



( run in 0.888 second using v1.01-cache-2.11-cpan-71847e10f99 )