dougm 01/11/15 14:20:46
Modified: perl-framework/Apache-Test/lib/Apache TestRequest.pm
Log:
add ssl support to Apache::TestRequest::vhost_socket()
Revision Changes Path
1.54 +17 -4
httpd-test/perl-framework/Apache-Test/lib/Apache/TestRequest.pm
Index: TestRequest.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRequest.pm,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- TestRequest.pm 2001/11/14 14:26:22 1.53
+++ TestRequest.pm 2001/11/15 22:20:46 1.54
@@ -10,6 +10,7 @@
use constant TRY_TIMES => 50;
use constant INTERP_KEY => 'X-PerlInterpreter';
+use constant UA_TIMEOUT => 60 * 10; #longer timeout for debugging
my $have_lwp = eval {
require LWP::UserAgent;
@@ -137,7 +138,7 @@
$self->proxy(http => "http://$proxy");
}
- $self->timeout(60 * 10); #longer timeout for debugging
+ $self->timeout(UA_TIMEOUT);
$self;
}
@@ -154,10 +155,22 @@
}
sub vhost_socket {
- local $Apache::TestRequest::Module = shift;
+ my $module = shift;
+ local $Apache::TestRequest::Module = $module;
+
my $hostport = hostport(Apache::Test::config());
- require IO::Socket;
- IO::Socket::INET->new($hostport);
+ my($host, $port) = split ':', $hostport;
+ my(%args) = (PeerAddr => $host, PeerPort => $port);
+
+ if ($module =~ /ssl/) {
+ require Net::SSL;
+ local $ENV{https_proxy} ||= ""; #else uninitialized value in
Net/SSL.pm
+ return Net::SSL->new(%args, Timeout => UA_TIMEOUT);
+ }
+ else {
+ require IO::Socket;
+ return IO::Socket::INET->new(%args);
+ }
}
sub prepare {