You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-cvs@httpd.apache.org by jw...@apache.org on 2002/05/02 21:25:53 UTC

cvs commit: httpd-test/perl-framework/t/ssl proxy.t

jwoolley    02/05/02 12:25:52

  Modified:    perl-framework/t/conf/ssl proxyssl.conf.in
               perl-framework/t/ssl proxy.t
  Log:
  test https->http as well as http->https and https->https
  
  Revision  Changes    Path
  1.11      +10 -2     httpd-test/perl-framework/t/conf/ssl/proxyssl.conf.in
  
  Index: proxyssl.conf.in
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/t/conf/ssl/proxyssl.conf.in,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -d -u -r1.10 -r1.11
  --- proxyssl.conf.in	3 Apr 2002 23:19:59 -0000	1.10
  +++ proxyssl.conf.in	2 May 2002 19:25:52 -0000	1.11
  @@ -3,7 +3,7 @@
   <IfModule mod_proxy.c>
   
       #here we can test http <-> https
  -    <VirtualHost proxyssl>
  +    <VirtualHost proxy_http_https>
           #these are not on by default in the 1.x based mod_ssl
           <IfDefine APACHE2>
               SSLProxyEngine On
  @@ -28,7 +28,7 @@
   
   
       #here we can test https <-> https
  -    <VirtualHost proxyssl_ssl>
  +    <VirtualHost proxy_https_https>
           SSLEngine on
   
           #these are not on by default in the 1.x based mod_ssl
  @@ -45,6 +45,14 @@
   
           ProxyPass        / https://@proxyssl_url@/
           ProxyPassReverse / https://@proxyssl_url@/
  +    </VirtualHost>
  +
  +    #here we can test https <-> http
  +    <VirtualHost proxy_https_http>
  +        SSLEngine on
  +
  +        ProxyPass        / http://@servername@:@port@/
  +        ProxyPassReverse / http://@servername@:@port@/
       </VirtualHost>
   
   </IfModule>
  
  
  
  1.9       +61 -44    httpd-test/perl-framework/t/ssl/proxy.t
  
  Index: proxy.t
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/t/ssl/proxy.t,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -d -u -r1.8 -r1.9
  --- proxy.t	23 Apr 2002 15:44:22 -0000	1.8
  +++ proxy.t	2 May 2002 19:25:52 -0000	1.9
  @@ -6,26 +6,42 @@
   use Apache::TestUtil;
   use Apache::TestCommon ();
   
  -my %modules = (
  -    proxyssl     => 'http',
  -    proxyssl_ssl => 'https',
  +my %frontend = (
  +    proxy_http_https  => 'http',
  +    proxy_https_https => 'https',
  +    proxy_https_http  => 'https',
  +);
  +my %backend = (
  +    proxy_http_https  => 'https',
  +    proxy_https_https => 'https',
  +    proxy_https_http  => 'http',
   );
   
  -my $num_modules = scalar keys %modules;
  +my $num_modules = scalar keys %frontend;
   my $post_module = 'eat_post';
   
   my $post_tests = have_module($post_module) ?
     Apache::TestCommon::run_post_test_sizes() : 0;
   
  -plan tests => (7 + $post_tests) * $num_modules, [qw(mod_proxy proxy_http.c)];
  +my $num_http_backends = 0;
  +for my $module (sort keys %backend) {
  +    if ($backend{$module} eq "http") {
  +        $num_http_backends++;
  +    }
  +}
   
  -for my $module (sort keys %modules) {
  +plan tests => (7 + $post_tests) * $num_modules - 5 * $num_http_backends,
  +              [qw(mod_proxy proxy_http.c)];
   
  -    my $scheme = $modules{$module};
  +for my $module (sort keys %frontend) {
  +
  +    my $scheme = $frontend{$module};
       Apache::TestRequest::module($module);
       Apache::TestRequest::scheme($scheme);
   
       my $hostport = Apache::TestRequest::hostport();
  +    my $res;
  +    my %vars;
   
       sok {
           t_cmp(200,
  @@ -33,44 +49,45 @@
                 "/ with $module ($scheme)");
       };
   
  -    sok {
  -        t_cmp(200,
  -              GET('/verify')->code,
  -              "using valid proxyssl client cert");
  -    };
  +    if ($backend{$module} eq "https") {
  +        sok {
  +            t_cmp(200,
  +                  GET('/verify')->code,
  +                  "using valid proxyssl client cert");
  +        };
   
  -    sok {
  -        t_cmp(403,
  -              GET('/require/snakeoil')->code,
  -              "using invalid proxyssl client cert");
  -    };
  +        sok {
  +            t_cmp(403,
  +                  GET('/require/snakeoil')->code,
  +                  "using invalid proxyssl client cert");
  +        };
   
  -    my $res = GET('/require-ssl-cgi/env.pl');
  +        $res = GET('/require-ssl-cgi/env.pl');
   
  -    sok {
  -        t_cmp(200, $res->code, "protected cgi script");
  -    };
  +        sok {
  +            t_cmp(200, $res->code, "protected cgi script");
  +        };
   
  -    my $body = $res->content || "";
  +        my $body = $res->content || "";
   
  -    my %vars;
  -    for my $line (split /\s*\r?\n/, $body) {
  -        my($key, $val) = split /\s*=\s*/, $line, 2;
  -        next unless $key;
  -        $vars{$key} = $val || "";
  -    }
  +        for my $line (split /\s*\r?\n/, $body) {
  +            my($key, $val) = split /\s*=\s*/, $line, 2;
  +            next unless $key;
  +            $vars{$key} = $val || "";
  +        }
   
  -    sok {
  -        t_cmp($hostport,
  -              $vars{HTTP_X_FORWARDED_HOST},
  -              "X-Forwarded-Host header");
  -    };
  +        sok {
  +            t_cmp($hostport,
  +                  $vars{HTTP_X_FORWARDED_HOST},
  +                  "X-Forwarded-Host header");
  +        };
   
  -    sok {
  -        t_cmp('client_ok',
  -              $vars{SSL_CLIENT_S_DN_CN},
  -              "client subject common name");
  -    };
  +        sok {
  +            t_cmp('client_ok',
  +                  $vars{SSL_CLIENT_S_DN_CN},
  +                  "client subject common name");
  +        };
  +    }
   
       sok {
           #test that ProxyPassReverse rewrote the Location header