You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2007/09/15 23:01:06 UTC
svn commit: r575977 - /spamassassin/trunk/masses/mass-check
Author: jm
Date: Sat Sep 15 14:01:05 2007
New Revision: 575977
URL: http://svn.apache.org/viewvc?rev=575977&view=rev
Log:
more handholding for IO::Socket::SSL
Modified:
spamassassin/trunk/masses/mass-check
Modified: spamassassin/trunk/masses/mass-check
URL: http://svn.apache.org/viewvc/spamassassin/trunk/masses/mass-check?rev=575977&r1=575976&r2=575977&view=diff
==============================================================================
--- spamassassin/trunk/masses/mass-check (original)
+++ spamassassin/trunk/masses/mass-check Sat Sep 15 14:01:05 2007
@@ -1656,22 +1656,24 @@
$opt_cs_max ||= 1000;
$opt_cs_timeout ||= 60 * 2;
- my($host, $uri);
+ my($host, $port, $uri);
if ($opt_client =~ /^http:\/\/([^\/]+)(\/.*)?/) {
($host, $uri) = ($1,$2);
- }
- else {
+ } else {
$host = $opt_client;
if ($host =~ /^:/) {
$host = 'localhost'.$host;
}
}
- my($http_host) = split(/:/, $host);
+ ($host, $port) = split(/:/, $host);
die "No host found in opt_client" unless $host;
$uri ||= "/";
+ # ::SSL needs resolved hostnames, at least on Solaris. note: not IPv6-aware
+ $host = Socket::inet_ntoa(Socket::inet_aton($host));
+
# use this to track how many messages we ought to be requesting
# start at 100 to get warmed up
my $msgnum = $opt_cs_max > 100 ? 100 : $opt_cs_max;
@@ -1702,13 +1704,17 @@
if ($opt_cs_ssl) {
$socket = IO::Socket::SSL->new(
PeerAddr => $host,
+ PeerPort => $port,
SSL_version => "TLSv1",
SSL_use_cert => 1,
SSL_key_file => "spamassassin/client-key.pem",
SSL_cert_file => "spamassassin/client-cert.pem",
);
} else {
- $socket = IO::Socket::INET->new($host);
+ $socket = IO::Socket::INET->new(
+ PeerAddr => $host,
+ PeerPort => $port
+ );
}
# last if connection fails
@@ -1718,7 +1724,7 @@
# make request, include and then drop results if there are any
my $result = http_make_request($socket, 'POST', $uri, {
- 'Host' => $http_host,
+ 'Host' => $host,
'Content-Type' => 'application/x-www-form-urlencoded',
'Content-Length' => length($POSTDATA),
},