All pastes #965909 Raw Edit

duke

public text v1 · immutable
·published 2008-04-01 09:52 UTC
rendered paste body
<Perl>
  package ProxyDav;

  use strict;

  use Apache2::RequestRec ();
  use APR::Table ();
  use URI;

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

  sub handler {
    my $r = shift;
    my $method = $r->method();
    if ($method eq 'MOVE' || $method eq 'COPY') {
      my $destination = $r->headers_in()->get('Destination');
      my $new_destination = URI->new($destination);
      $new_destination->scheme('http');
      $r->headers_in()->set('Destination', $new_destination);
    }
    print $r->content;

    return Apache2::Const::OK;
  }
  1;
</Perl>