X-Git-Url: http://git.jankratochvil.net/?a=blobdiff_plain;f=Web.pm;h=5c2dd070b49e1f4ada9fe8001d75b77069031e6b;hb=78f388d9ac02352188212893f17080c272889b8a;hp=f9d6d62507e56413e29d635847c39f5ade3d33eb;hpb=cd853c0664010679a7015ba21831d56802be8455;p=MyWeb.git diff --git a/Web.pm b/Web.pm index f9d6d62..5c2dd07 100644 --- a/Web.pm +++ b/Web.pm @@ -121,6 +121,7 @@ require Data::Compare; use Data::Dumper; require Encode; use Apache2::Filter; +use Apache2::Connection; #our $W; @@ -237,7 +238,7 @@ my($class,%args)=@_; $W->{"headers_in"}=My::Hash::Merge->new( $W->{"headers_in"}, My::Hash::Sub->new({ - "_get_remote_host"=>sub { return $W->{"r"}->get_remote_host(); }, + "_remote_ip"=>sub { return $W->{"r"}->connection()->remote_ip(); }, }), ); $W->{"headers_in"}=My::Hash::Readonly->new($W->{"headers_in"}); @@ -671,7 +672,7 @@ sub remote_ip () # As 'Apache2::ForwardedFor' takes the first of $ENV{"HTTP_X_FORWARDED_FOR"} # while the contents is '127.0.0.1, 213.220.195.171' if client has its own proxy. # We must take the last item ourselves. - my $r=$W->{"headers_in"}{"X-Forwarded-For"} || $W->{"headers_in"}{"_get_remote_host"}; + my $r=$W->{"headers_in"}{"X-Forwarded-For"} || $W->{"headers_in"}{"_remote_ip"}; $r=~s/^.*,\s*//; return $r; }