On Friday 03 August 2007 14:02, Jen mlists wrote: > No. To which part of my answer to your question relates that "No"?
> Here both PHP and CGI scripts can get the X_FORWARDED_FOR ip,but
> modperl can't.Is the %ENV hash not useful under modperl?
Apache maintains an internal representation of the environment that it calls
subprocesses with that is accessible in Perl via $r->subprocess_env. So all
values set in this table are visible through %ENV to CGI subprocesses.
If you run your Perl CGI script as registry script then the registry wrapper
populates %ENV for you (from $r->subprocess_env) just before calling the
actual script.
HTTP_X_FORWARDED_FOR is set this way according to the incoming X-Forwarded-For
HTTP header. Under mod_perl all incoming headers are accessed via
$r->headers_in. So the value you are looking for is in
$r->headers_in->{'X-Forwarded-For'}
Torsten
pgpHT8OlMzfQY.pgp
Description: PGP signature
