perl-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Förtsch <torsten.foert...@gmx.net>
Subject Re: svn commit: r1207758 - /perl/Apache-Test/trunk/lib/Apache/TestRequest.pm
Date Thu, 01 Jan 1970 00:00:00 GMT
On Tuesday, 29 November 2011 05:39:37 kbrand@apache.org wrote:
> @@ -620,11 +628,18 @@ sub set_client_cert {
>      if ($name) {
>          $ENV{HTTPS_CERT_FILE} = "$dir/certs/$name.crt";
>          $ENV{HTTPS_KEY_FILE}  = "$dir/keys/$name.pem";

better written as

  @ENV{qw/HTTPS_CERT_FILE HTTPS_KEY_FILE/} =
      ("$dir/certs/$name.crt", "$dir/keys/$name.pem");

> +        if ($LWP::VERSION >= 6.0) {
> +            # LWP 6 no longer honors HTTPS_{CERT,KEY}_FILE
> +            user_agent(reset => 1,
> +                       ssl_opts => { SSL_cert_file =>
> "$dir/certs/$name.crt",
> +                                     SSL_key_file  =>
> "$dir/keys/$name.pem" }); +        }
>      }
>      else {
>          for (qw(CERT KEY)) {
>              delete $ENV{"HTTPS_${_}_FILE"};
>          }
> +        user_agent(reset => 1) if $LWP::VERSION >= 6.0;

These calls to user_agent(reset=>1) are the actual reason for this mail. I 
think it is wrong to do that here. The user agent keeps a global state that is 
reset if user_agent() is called with reset=>1. set_client_cert() is called by 
prepare() which is called by GET, POST etc.

According to the documentation for Apache::TestRequest the way to make the UA 
not to follow redirects is

  Apache::TestRequest::user_agent(reset => 1,
                                  requests_redirectable => 0);

before calling GET.

If now GET itself calls user_agent(reset=>1) via prepare() and 
set_client_cert() wouldn't that clobber the "requests_redirectable => 0" 
setting made by the user?

Just a thought.

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net


Mime
View raw message