perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject cvs commit: modperl-2.0/t/response/TestUser
Date Sun, 18 Apr 2004 01:31:21 GMT
stas        2004/04/17 18:31:21

  Added:       t/user   .cvsignore
  - start a new group of tests for user-side code techiques
  - add the first test to rewrite the uri namespace
  Revision  Changes    Path
  1.1                  modperl-2.0/t/user/.cvsignore
  Index: .cvsignore
  1.1                  modperl-2.0/t/response/TestUser/
  package TestUser::rewrite;
  # test here the technique of rewriting the URI namespace and
  # pushing/changing the query string (args). Note that in this test we
  # use a custom maptostorage handler so Apache won't complain that we
  # didn't set r->filename in the core maptostorage handler. the custom
  # handler simply shortcuts that phase, with the added benefit of
  # skipping the ap_directory_walk's stat() calls which speeds up the
  # whole thing.
  # an alternative solution is to return Apache::DECLINED from the trans
  # handler, in which case map2storage is not required (but it'll do a
  # bunch of stat() calls then, which you may want to avoid)
  use strict;
  use warnings FATAL => 'all';
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::RequestRec ();
  use Apache::RequestIO ();
  use Apache::URI ();
  use Apache::Const -compile => qw(DECLINED OK);
  my $uri_real = "/TestUser__rewrite_real";
  my $args_real = "foo=bar&boo=tar";
  sub trans {
      my $r = shift;
      return Apache::DECLINED unless $r->uri eq '/TestUser__rewrite';
      return Apache::OK;
  sub map2storage {
      my $r = shift;
      return Apache::DECLINED unless $r->uri eq $uri_real;
      # skip ap_directory_walk stat() calls
      return Apache::OK;
  sub response {
      my $r = shift;
      plan $r, tests => 1;
      my $args = $r->args();
      ok t_cmp($args_real, $args, "args");
      return Apache::OK;
      PerlModule              TestUser::rewrite
      PerlTransHandler        TestUser::rewrite::trans
      PerlMapToStorageHandler TestUser::rewrite::map2storage
      <Location /TestUser__rewrite_real>
          SetHandler modperl
          PerlResponseHandler TestUser::rewrite::response

View raw message