How to set the uri with ::XS::HTTPHeaders?

Bill Moseley moseley at hank.org
Thu May 29 22:08:48 UTC 2008


I'm learning about plugins and I have a hook that will remove a prefix
from the request.

For example:

    my $start_http_request_hook =  sub {
        my Perlbal::ClientHTTPBase $client = shift;
        my Perlbal::HTTPHeaders $hds = $client->{req_headers};

        my $uri = $hds->request_uri;

        # Remove a cache-busting version string:
        $hds->set_request_uri( $uri ) if $uri =~ s{^/r\d+/}{/};

        return 0;
    };

The problem is that set_request_uri() is not a method in
Perlbal::XS::HTTPHeaders.  Works ok if I don't enable the xs headers,
though.


This is basic URL rewriting.  Is there a way to alter the request
using the XS version?  Or, am I looking at the wrong hook?  I want to
be able to rewrite before I proxy to the back end.  (And no,
mod_rewrite is not available on the back end.)



Thanks,




-- 
Bill Moseley
moseley at hank.org
Sent from my iMutt



More information about the perlbal mailing list