gopher tests: use sws and adjusted to more standard style
This commit is contained in:
parent
6ed72fd7fa
commit
ecb3fe63d7
@ -10,11 +10,11 @@ INDEX
|
|||||||
#
|
#
|
||||||
# Server-side
|
# Server-side
|
||||||
<reply>
|
<reply>
|
||||||
<datacheck>
|
<data>
|
||||||
iMenu results error.host 1
|
iMenu results error.host 1
|
||||||
0Selector /bar bar.foo.invalid 70
|
0Selector /bar bar.foo.invalid 70
|
||||||
.
|
.
|
||||||
</datacheck>
|
</data>
|
||||||
</reply>
|
</reply>
|
||||||
|
|
||||||
# Client-side
|
# Client-side
|
||||||
@ -26,7 +26,7 @@ gopher
|
|||||||
Gopher index
|
Gopher index
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
gopher://%HOSTIP:%GOPHERPORT
|
gopher://%HOSTIP:%GOPHERPORT/1/1200
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ gopher://%HOSTIP:%GOPHERPORT
|
|||||||
# Verify data after the test has been "shot"
|
# Verify data after the test has been "shot"
|
||||||
<verify>
|
<verify>
|
||||||
<protocol>
|
<protocol>
|
||||||
|
/1200
|
||||||
</protocol>
|
</protocol>
|
||||||
</verify>
|
</verify>
|
||||||
</testcase>
|
</testcase>
|
||||||
|
@ -10,11 +10,11 @@ SELECTOR
|
|||||||
#
|
#
|
||||||
# Server-side
|
# Server-side
|
||||||
<reply>
|
<reply>
|
||||||
<datacheck>
|
<data>
|
||||||
iMenu results error.host 1
|
iMenu results error.host 1
|
||||||
0Selector /selector/SELECTOR /bar bar.foo.invalid 70
|
0Selector /selector/SELECTOR /bar bar.foo.invalid 70
|
||||||
.
|
.
|
||||||
</datacheck>
|
</data>
|
||||||
</reply>
|
</reply>
|
||||||
|
|
||||||
# Client-side
|
# Client-side
|
||||||
@ -26,7 +26,7 @@ gopher
|
|||||||
Gopher selector
|
Gopher selector
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
gopher://%HOSTIP:%GOPHERPORT/1/selector/SELECTOR
|
gopher://%HOSTIP:%GOPHERPORT/1/selector/SELECTOR/1201
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ gopher://%HOSTIP:%GOPHERPORT/1/selector/SELECTOR
|
|||||||
# Verify data after the test has been "shot"
|
# Verify data after the test has been "shot"
|
||||||
<verify>
|
<verify>
|
||||||
<protocol>
|
<protocol>
|
||||||
/selector/SELECTOR
|
/selector/SELECTOR/1201
|
||||||
</protocol>
|
</protocol>
|
||||||
</verify>
|
</verify>
|
||||||
</testcase>
|
</testcase>
|
||||||
|
@ -10,12 +10,12 @@ QUERY
|
|||||||
#
|
#
|
||||||
# Server-side
|
# Server-side
|
||||||
<reply>
|
<reply>
|
||||||
<datacheck>
|
<data>
|
||||||
iSearch results error.host 1
|
iSearch results error.host 1
|
||||||
0Query query succeeded /foo foo.bar.invalid 70
|
0Query query succeeded /foo foo.bar.invalid 70
|
||||||
0Selector /the/search/engine /bar bar.foo.invalid 70
|
0Selector /the/search/engine /bar bar.foo.invalid 70
|
||||||
.
|
.
|
||||||
</datacheck>
|
</data>
|
||||||
</reply>
|
</reply>
|
||||||
|
|
||||||
# Client-side
|
# Client-side
|
||||||
@ -27,7 +27,7 @@ gopher
|
|||||||
Gopher query
|
Gopher query
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
gopher://%HOSTIP:%GOPHERPORT/7/the/search/engine?query%20succeeded
|
gopher://%HOSTIP:%GOPHERPORT/7/the/search/engine?query%20succeeded/1202
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ gopher://%HOSTIP:%GOPHERPORT/7/the/search/engine?query%20succeeded
|
|||||||
# Verify data after the test has been "shot"
|
# Verify data after the test has been "shot"
|
||||||
<verify>
|
<verify>
|
||||||
<protocol>
|
<protocol>
|
||||||
/the/search/engine query succeeded
|
/the/search/engine query succeeded/1202
|
||||||
</protocol>
|
</protocol>
|
||||||
</verify>
|
</verify>
|
||||||
</testcase>
|
</testcase>
|
||||||
|
@ -11,11 +11,11 @@ INDEX
|
|||||||
#
|
#
|
||||||
# Server-side
|
# Server-side
|
||||||
<reply>
|
<reply>
|
||||||
<datacheck>
|
<data>
|
||||||
iMenu results error.host 1
|
iMenu results error.host 1
|
||||||
0Selector /bar bar.foo.invalid 70
|
0Selector /bar bar.foo.invalid 70
|
||||||
.
|
.
|
||||||
</datacheck>
|
</data>
|
||||||
</reply>
|
</reply>
|
||||||
|
|
||||||
# Client-side
|
# Client-side
|
||||||
@ -27,7 +27,7 @@ gopher-ipv6
|
|||||||
Gopher IPv6 index
|
Gopher IPv6 index
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
-g "gopher://%HOSTIP:%GOPHER6PORT"
|
-g "gopher://%HOSTIP:%GOPHER6PORT/1/moo/1203"
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ Gopher IPv6 index
|
|||||||
# Verify data after the test has been "shot"
|
# Verify data after the test has been "shot"
|
||||||
<verify>
|
<verify>
|
||||||
<protocol>
|
<protocol>
|
||||||
|
/moo/1203
|
||||||
</protocol>
|
</protocol>
|
||||||
</verify>
|
</verify>
|
||||||
</testcase>
|
</testcase>
|
||||||
|
@ -42,6 +42,7 @@ my $pidfile; # http server pid file
|
|||||||
my $logfile; # http server log file
|
my $logfile; # http server log file
|
||||||
my $srcdir;
|
my $srcdir;
|
||||||
my $fork;
|
my $fork;
|
||||||
|
my $gopher = 0;
|
||||||
|
|
||||||
my $flags = "";
|
my $flags = "";
|
||||||
my $path = '.';
|
my $path = '.';
|
||||||
@ -72,6 +73,9 @@ while(@ARGV) {
|
|||||||
elsif($ARGV[0] eq '--ipv6') {
|
elsif($ARGV[0] eq '--ipv6') {
|
||||||
$ipvnum = 6;
|
$ipvnum = 6;
|
||||||
}
|
}
|
||||||
|
elsif($ARGV[0] eq '--gopher') {
|
||||||
|
$gopher = 1;
|
||||||
|
}
|
||||||
elsif($ARGV[0] eq '--port') {
|
elsif($ARGV[0] eq '--port') {
|
||||||
if($ARGV[1] =~ /^(\d+)$/) {
|
if($ARGV[1] =~ /^(\d+)$/) {
|
||||||
$port = $1;
|
$port = $1;
|
||||||
@ -106,6 +110,7 @@ if(!$logfile) {
|
|||||||
$logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
|
$logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$flags .= "--gopher " if($gopher);
|
||||||
$flags .= "--fork " if(defined($fork));
|
$flags .= "--fork " if(defined($fork));
|
||||||
$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
|
$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
|
||||||
$flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\"";
|
$flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\"";
|
||||||
|
@ -676,6 +676,7 @@ sub verifyhttp {
|
|||||||
my ($proto, $ipvnum, $idnum, $ip, $port) = @_;
|
my ($proto, $ipvnum, $idnum, $ip, $port) = @_;
|
||||||
my $server = servername_id($proto, $ipvnum, $idnum);
|
my $server = servername_id($proto, $ipvnum, $idnum);
|
||||||
my $pid = 0;
|
my $pid = 0;
|
||||||
|
my $bonus;
|
||||||
|
|
||||||
my $verifyout = "$LOGDIR/".
|
my $verifyout = "$LOGDIR/".
|
||||||
servername_canon($proto, $ipvnum, $idnum) .'_verify.out';
|
servername_canon($proto, $ipvnum, $idnum) .'_verify.out';
|
||||||
@ -685,13 +686,18 @@ sub verifyhttp {
|
|||||||
servername_canon($proto, $ipvnum, $idnum) .'_verify.log';
|
servername_canon($proto, $ipvnum, $idnum) .'_verify.log';
|
||||||
unlink($verifylog) if(-f $verifylog);
|
unlink($verifylog) if(-f $verifylog);
|
||||||
|
|
||||||
|
if($proto eq "gopher") {
|
||||||
|
# gopher is funny
|
||||||
|
$bonus="1/";
|
||||||
|
}
|
||||||
|
|
||||||
my $flags = "--max-time $server_response_maxtime ";
|
my $flags = "--max-time $server_response_maxtime ";
|
||||||
$flags .= "--output $verifyout ";
|
$flags .= "--output $verifyout ";
|
||||||
$flags .= "--silent ";
|
$flags .= "--silent ";
|
||||||
$flags .= "--verbose ";
|
$flags .= "--verbose ";
|
||||||
$flags .= "--globoff ";
|
$flags .= "--globoff ";
|
||||||
$flags .= "--insecure " if($proto eq 'https');
|
$flags .= "--insecure " if($proto eq 'https');
|
||||||
$flags .= "\"$proto://$ip:$port/verifiedserver\"";
|
$flags .= "\"$proto://$ip:$port/${bonus}verifiedserver\"";
|
||||||
|
|
||||||
my $cmd = "$VCURL $flags 2>$verifylog";
|
my $cmd = "$VCURL $flags 2>$verifylog";
|
||||||
|
|
||||||
@ -732,8 +738,8 @@ sub verifyhttp {
|
|||||||
logmsg "RUN: failed to resolve host ($proto://$ip:$port/verifiedserver)\n";
|
logmsg "RUN: failed to resolve host ($proto://$ip:$port/verifiedserver)\n";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
elsif($data || ($res != 7)) {
|
elsif($data || ($res && ($res != 7))) {
|
||||||
logmsg "RUN: Unknown server on our $server port: $port\n";
|
logmsg "RUN: Unknown server on our $server port: $port ($res)\n";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return $pid;
|
return $pid;
|
||||||
@ -992,7 +998,7 @@ my %protofunc = ('http' => \&verifyhttp,
|
|||||||
'tftp' => \&verifyftp,
|
'tftp' => \&verifyftp,
|
||||||
'ssh' => \&verifyssh,
|
'ssh' => \&verifyssh,
|
||||||
'socks' => \&verifysocks,
|
'socks' => \&verifysocks,
|
||||||
'gopher' => \&verifyftp);
|
'gopher' => \&verifyhttp);
|
||||||
|
|
||||||
sub verifyserver {
|
sub verifyserver {
|
||||||
my ($proto, $ipvnum, $idnum, $ip, $port) = @_;
|
my ($proto, $ipvnum, $idnum, $ip, $port) = @_;
|
||||||
@ -1023,10 +1029,8 @@ sub verifyserver {
|
|||||||
# start the http server
|
# start the http server
|
||||||
#
|
#
|
||||||
sub runhttpserver {
|
sub runhttpserver {
|
||||||
my ($verbose, $ipv6) = @_;
|
my ($proto, $verbose, $ipv6, $port) = @_;
|
||||||
my $port = $HTTPPORT;
|
|
||||||
my $ip = $HOSTIP;
|
my $ip = $HOSTIP;
|
||||||
my $proto = 'http';
|
|
||||||
my $ipvnum = 4;
|
my $ipvnum = 4;
|
||||||
my $idnum = 1;
|
my $idnum = 1;
|
||||||
my $server;
|
my $server;
|
||||||
@ -1035,10 +1039,10 @@ sub runhttpserver {
|
|||||||
my $logfile;
|
my $logfile;
|
||||||
my $flags = "";
|
my $flags = "";
|
||||||
|
|
||||||
|
|
||||||
if($ipv6) {
|
if($ipv6) {
|
||||||
# if IPv6, use a different setup
|
# if IPv6, use a different setup
|
||||||
$ipvnum = 6;
|
$ipvnum = 6;
|
||||||
$port = $HTTP6PORT;
|
|
||||||
$ip = $HOST6IP;
|
$ip = $HOST6IP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1062,6 +1066,7 @@ sub runhttpserver {
|
|||||||
$logfile = server_logfilename($LOGDIR, $proto, $ipvnum, $idnum);
|
$logfile = server_logfilename($LOGDIR, $proto, $ipvnum, $idnum);
|
||||||
|
|
||||||
$flags .= "--fork " if($forkserver);
|
$flags .= "--fork " if($forkserver);
|
||||||
|
$flags .= "--gopher " if($proto eq "gopher");
|
||||||
$flags .= "--verbose " if($debugprotocol);
|
$flags .= "--verbose " if($debugprotocol);
|
||||||
$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
|
$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
|
||||||
$flags .= "--id $idnum " if($idnum > 1);
|
$flags .= "--id $idnum " if($idnum > 1);
|
||||||
@ -1184,7 +1189,7 @@ sub runhttpsserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# start the pingpong server (FTP, POP3, IMAP, SMTP, GOPHER)
|
# start the pingpong server (FTP, POP3, IMAP, SMTP)
|
||||||
#
|
#
|
||||||
sub runpingpongserver {
|
sub runpingpongserver {
|
||||||
my ($proto, $id, $verbose, $ipv6) = @_;
|
my ($proto, $id, $verbose, $ipv6) = @_;
|
||||||
@ -1215,9 +1220,6 @@ sub runpingpongserver {
|
|||||||
elsif($proto eq "smtp") {
|
elsif($proto eq "smtp") {
|
||||||
$port = ($ipvnum==6) ? $SMTP6PORT : $SMTPPORT;
|
$port = ($ipvnum==6) ? $SMTP6PORT : $SMTPPORT;
|
||||||
}
|
}
|
||||||
elsif($proto eq "gopher") {
|
|
||||||
$port = ($ipvnum==6) ? $GOPHER6PORT : $GOPHERPORT;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
print STDERR "Unsupported protocol $proto!!\n";
|
print STDERR "Unsupported protocol $proto!!\n";
|
||||||
return 0;
|
return 0;
|
||||||
@ -2041,15 +2043,14 @@ sub checksystem {
|
|||||||
if($sws[0] =~ /IPv6/) {
|
if($sws[0] =~ /IPv6/) {
|
||||||
# HTTP server has ipv6 support!
|
# HTTP server has ipv6 support!
|
||||||
$http_ipv6 = 1;
|
$http_ipv6 = 1;
|
||||||
|
$gopher_ipv6 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if the FTP server has it!
|
# check if the FTP server has it!
|
||||||
@sws = `server/sockfilt --version`;
|
@sws = `server/sockfilt --version`;
|
||||||
if($sws[0] =~ /IPv6/) {
|
if($sws[0] =~ /IPv6/) {
|
||||||
# FTP server has ipv6 support!
|
# FTP server has ipv6 support!
|
||||||
# and since the Gopher server descends from it, we have it too!
|
|
||||||
$ftp_ipv6 = 1;
|
$ftp_ipv6 = 1;
|
||||||
$gopher_ipv6 = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3227,7 +3228,6 @@ sub startservers {
|
|||||||
if(($what eq "pop3") ||
|
if(($what eq "pop3") ||
|
||||||
($what eq "ftp") ||
|
($what eq "ftp") ||
|
||||||
($what eq "imap") ||
|
($what eq "imap") ||
|
||||||
($what eq "gopher") ||
|
|
||||||
($what eq "smtp")) {
|
($what eq "smtp")) {
|
||||||
if(!$run{$what}) {
|
if(!$run{$what}) {
|
||||||
($pid, $pid2) = runpingpongserver($what, "", $verbose);
|
($pid, $pid2) = runpingpongserver($what, "", $verbose);
|
||||||
@ -3259,20 +3259,33 @@ sub startservers {
|
|||||||
$run{'ftp-ipv6'}="$pid $pid2";
|
$run{'ftp-ipv6'}="$pid $pid2";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elsif($what eq "gopher") {
|
||||||
|
if(!$run{'gopher'}) {
|
||||||
|
($pid, $pid2) = runhttpserver("gopher", $verbose, 0,
|
||||||
|
$GOPHERPORT);
|
||||||
|
if($pid <= 0) {
|
||||||
|
return "failed starting GOPHER server";
|
||||||
|
}
|
||||||
|
printf ("* pid gopher => %d %d\n", $pid, $pid2) if($verbose);
|
||||||
|
$run{'gopher'}="$pid $pid2";
|
||||||
|
}
|
||||||
|
}
|
||||||
elsif($what eq "gopher-ipv6") {
|
elsif($what eq "gopher-ipv6") {
|
||||||
if(!$run{'gopher-ipv6'}) {
|
if(!$run{'gopher-ipv6'}) {
|
||||||
($pid, $pid2) = runpingpongserver("gopher","",$verbose,"ipv6");
|
($pid, $pid2) = runhttpserver("gopher", $verbose, "ipv6",
|
||||||
|
$GOPHER6PORT);
|
||||||
if($pid <= 0) {
|
if($pid <= 0) {
|
||||||
return "failed starting GOPHER-IPv6 server";
|
return "failed starting GOPHER-IPv6 server";
|
||||||
}
|
}
|
||||||
logmsg sprintf("* pid gopher-ipv6 => %d %d\n", $pid,
|
logmsg sprintf("* pid gopher-ipv6 => %d %d\n", $pid,
|
||||||
$pid2) if($verbose);
|
$pid2) if($verbose);
|
||||||
$run{'gopher-ipv6'}="$pid $pid2";
|
$run{'gopher-ipv6'}="$pid $pid2";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif($what eq "http") {
|
elsif($what eq "http") {
|
||||||
if(!$run{'http'}) {
|
if(!$run{'http'}) {
|
||||||
($pid, $pid2) = runhttpserver($verbose);
|
($pid, $pid2) = runhttpserver("http", $verbose, 0,
|
||||||
|
$HTTPPORT);
|
||||||
if($pid <= 0) {
|
if($pid <= 0) {
|
||||||
return "failed starting HTTP server";
|
return "failed starting HTTP server";
|
||||||
}
|
}
|
||||||
@ -3282,7 +3295,8 @@ sub startservers {
|
|||||||
}
|
}
|
||||||
elsif($what eq "http-ipv6") {
|
elsif($what eq "http-ipv6") {
|
||||||
if(!$run{'http-ipv6'}) {
|
if(!$run{'http-ipv6'}) {
|
||||||
($pid, $pid2) = runhttpserver($verbose, "IPv6");
|
($pid, $pid2) = runhttpserver("http", $verbose, "IPv6",
|
||||||
|
$HTTP6PORT);
|
||||||
if($pid <= 0) {
|
if($pid <= 0) {
|
||||||
return "failed starting HTTP-IPv6 server";
|
return "failed starting HTTP-IPv6 server";
|
||||||
}
|
}
|
||||||
@ -3361,7 +3375,8 @@ sub startservers {
|
|||||||
stopserver('https');
|
stopserver('https');
|
||||||
}
|
}
|
||||||
if(!$run{'http'}) {
|
if(!$run{'http'}) {
|
||||||
($pid, $pid2) = runhttpserver($verbose);
|
($pid, $pid2) = runhttpserver("http", $verbose, 0,
|
||||||
|
$HTTPPORT);
|
||||||
if($pid <= 0) {
|
if($pid <= 0) {
|
||||||
return "failed starting HTTP server";
|
return "failed starting HTTP server";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user