Is this patch OK for TestRequest.pm? --- Apache-Test/lib/Apache/TestRequest.pm 28 Nov 2003 18:19:45 -0000 1.93 +++ Apache-Test/lib/Apache/TestRequest.pm 18 Feb 2004 10:06:32 -0000 @@ -214,7 +214,7 @@ } sub vhost_socket { - my $module = shift; + my ($module, $nossl) = @_; local $Apache::TestRequest::Module = $module if $module; my $hostport = hostport(Apache::Test::config()); @@ -224,7 +224,7 @@ my($host, $port) = split ':', $hostport; my(%args) = (PeerAddr => $host, PeerPort => $port); - if ($module and $module =~ /ssl/) { + if (!$nossl and $module and $module =~ /ssl/) { require Net::SSL; local $ENV{https_proxy} ||= ""; #else uninitialized value in Net/SSL.pm return Net::SSL->new(%args, Timeout => UA_TIMEOUT);
This allows a fix for the ssl/http.t failure which has been around forever: --- t/ssl/http.t 3 Apr 2002 09:14:48 -0000 1.10 +++ t/ssl/http.t 18 Feb 2004 10:07:03 -0000 @@ -14,24 +14,39 @@ if (Apache::TestConfig::WIN32) { print "\n#ap_core_translate() chokes on ':' here\n", "#where r->uri = /mod_ssl:error:HTTP-request\n"; - @todo = (todo => [2]); + @todo = (todo => [1]); } -plan tests => 2, @todo; +plan tests => 1, @todo; my $config = Apache::Test::config(); my $ssl_module = $config->{vars}->{ssl_module_name}; my $hostport = $config->{vhosts}->{$ssl_module}->{hostport}; -my $rurl = "http://$hostport$url"; +my $rurl = "http://$hostport/"; +my $CRLF = "\015\012"; -my $res = GET($rurl); -ok t_cmp(400, - $res->code, - "Expected bad request from 'GET $rurl'" - ); - -ok t_cmp(qr{speaking plain HTTP to an SSL-enabled server port}, - $res->content, - "that error document contains the proper hint" - ); +my $s = Apache::TestRequest::vhost_socket($ssl_module, 1); + +unless ($s) { + warn "cannot connect to $hostport: $!"; + return undef; +} + +my $req = join $CRLF, + "GET / HTTP/1.1", + "Host: $hostport", $CRLF; + +$s->write($req); + +my $res = 0; + +while (<$s>) { + print "# read: $_"; + $res = 1 if /speaking plain HTTP to an SSL-enabled server port/; +} + +ok t_cmp(1, + $res, + "expected error document hint from HTTP request on SSL port" + );