mod_perl

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

replace the slow implementation of anon handlers using B::Deparse,
with per-interpreter cache of compiled CODE refs (sort of emulating
named subroutines for anonymous handlers) [Stas].

avoid segfaults when a bogus $r object is used [Stas]

Remove magicness of PerlLoadModule and implement Apache::Module::add()
for modules that implement their own configuration directives [Gozer]

Apache::Connection::remote_ip is now settable (needed to set the
remote_ip record based on proxy's X-Forwarded-For header) [Stas]

Fix Modperl::Util::unload_package() [Gozer]
  - Mistakenly skipping small entries of size 2 and less
  - Leave entries from other packages alone

$filter->remove now works with native (non-modperl) filters + test
[Torsten Förtsch <torsten.foertsch gmx.net>]



docs/user/handlers/http.pod  view on Meta::CPAN




=head1 Misc Notes

These items will need to be extended and integrated in this or other
HTTP related documents:

=over

=item * front-end back-end setup: mod_proxy+X-Forwarded-For

apache-1.3:

frontend: mod_proxy_add_forward http://develooper.com/code/mpaf/

backend: mod_rpaf (reverse proxy add forward):
http://stderr.net/apache/rpaf/

apache-2.x:

t/hooks/TestHooks/access.pm  view on Meta::CPAN

use Apache2::RequestRec ();
use Apache::TestTrace;

use Apache2::Const -compile => qw(OK FORBIDDEN);

my $allowed_ips = qr{^(10|127)\.};

sub handler {
    my $r = shift;

    my $fake_ip = $r->headers_in->get('X-Forwarded-For') || "";

    debug "access: " . ($fake_ip =~ $allowed_ips ? "OK\n" : "FORBIDDEN\n");

    return Apache2::Const::FORBIDDEN unless $fake_ip =~ $allowed_ips;

    Apache2::Const::OK;
}

sub fixup { debug "fixup\n"; Apache2::Const::OK }
sub init  { debug "init\n";  Apache2::Const::OK }

t/hooks/access.t  view on Meta::CPAN

plan tests => 4, need 'HTML::HeadParser';

my $location = "/TestHooks__access";

ok ! GET_OK $location;

my $rc = GET_RC $location;

ok $rc == 403;

ok GET_OK $location, 'X-Forwarded-For' => '127.0.0.1';

ok ! GET_OK $location, 'X-Forwarded-For' => '666.0.0.1';




( run in 0.483 second using v1.01-cache-2.11-cpan-26ccb49234f )