Apache2-CondProxy

 view release on metacpan or  search on metacpan

lib/Apache2/CondProxy.pm  view on Meta::CPAN

            # resource in an output filter, then pipe that out as our
            # response.

            return _do_proxy($r, 1);
        }
        else {
            my $uri = $r->unparsed_uri;
            $r->log->debug("Attempting lookup on $uri");
            my $subr = _make_subreq($r, $uri);

            # set the content-type and content-length in the subrequest
            my $ct = $r->headers_in->get('Content-Type');
            $subr->headers_in->set('Content-Type', $ct) if $ct;
            my $cl = $r->headers_in->get('Content-Length');
            $subr->headers_in->set('Content-Length', $cl) if $cl;

            # remove Accept-Encoding headers for proxy
            my $ae = $r->headers_in->get('Accept-Encoding');
            $r->headers_in->unset('Accept-Encoding');

            if ($subr->status == 404) {

lib/Apache2/CondProxy.pm  view on Meta::CPAN

    Apache2::Const::OK;
}

sub _make_subreq {
    my ($r, $uri) = @_;

    $uri = $r->unparsed_uri unless defined $uri;

    my $subr = $r->lookup_method_uri($r->method, $uri);

    # set the content-type and content-length in the subrequest
    my $ct = $r->headers_in->get('Content-Type');
    $subr->headers_in->set('Content-Type', $ct) if $ct;
    my $cl = $r->headers_in->get('Content-Length');
    $subr->headers_in->set('Content-Length', $cl) if $cl;

    # remove this so no gzip filter etc happens
    $subr->headers_in->unset('Accept-Encoding');

    $subr;
}



( run in 2.553 seconds using v1.01-cache-2.11-cpan-524268b4103 )