You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by st...@apache.org on 2002/08/16 12:11:17 UTC

cvs commit: modperl-2.0/ModPerl-Registry/t/cgi-bin redirect.pl

stas        2002/08/16 03:11:17

  Added:       ModPerl-Registry/t redirect.t
               ModPerl-Registry/t/cgi-bin redirect.pl
  Log:
  test external redirects
  
  Revision  Changes    Path
  1.1                  modperl-2.0/ModPerl-Registry/t/redirect.t
  
  Index: redirect.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestRequest qw(GET_BODY HEAD);
  
  plan tests => 2;
  
  my $base_url = "/registry/redirect.pl";
  
  {
      my $redirect_path = "/registry/basic.pl";
      my $url = "$base_url?$redirect_path";
  
      ok t_cmp(
          "ok",
          GET_BODY($url),
          "test redirect: existing target",
         );
  }
  
  {
      my $redirect_path = "/registry/does_not_exists.pl";
      my $url = "$base_url?$redirect_path";
  
      ok t_cmp(
          404,
          HEAD($url)->code,
          "test redirect: non-existing target",
         );
  }
  
  
  
  1.1                  modperl-2.0/ModPerl-Registry/t/cgi-bin/redirect.pl
  
  Index: redirect.pl
  ===================================================================
  # test env vars
  
  use Apache::URI ();
  
  my $r = shift;
  my $path = $r->args || '';
  $server = $r->construct_server;
  
  print "Location: http://$server$path\n\n";
  warn "Location: http://$server$path\n\n";
  
  __END__