gopher tests: revert parts of gopher in the pingpong server
authorDaniel Stenberg <daniel@haxx.se>
Tue, 24 Aug 2010 22:56:14 +0000 (00:56 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 25 Aug 2010 12:22:43 +0000 (14:22 +0200)
Introduced in the initial gopher commits, there was added logic to do
GOPHER test serving in the pingpong server but as it resembles HTTP much
more than FTP or SMTP, the gopher testing has been moved over to instead
use the sws (HTTP) server. This change simply removes unused code.

tests/ftp.pm
tests/ftpserver.pl
tests/serverhelp.pm

index 535075a..6a46e76 100644 (file)
@@ -181,7 +181,7 @@ sub killsockfilters {
     my $pidfile;
     my $pid;
 
-    return if($proto !~ /^(ftp|imap|pop3|smtp|gopher)$/);
+    return if($proto !~ /^(ftp|imap|pop3|smtp)$/);
 
     die "unsupported sockfilter: $which"
         if($which && ($which !~ /^(main|data)$/));
index 03d9334..ed2a832 100755 (executable)
@@ -29,9 +29,6 @@
 # protocol per invoke. You need to start mulitple servers to support multiple
 # protocols simultaneously.
 #
-# The gopher protocol test server also lives here, borrowing some of the
-# routines.
-#
 # It is meant to exercise curl, it is not meant to be a fully working
 # or even very standard compliant server.
 #
@@ -344,7 +341,6 @@ sub senddata {
 # for the given protocol. References to protocol command callbacks are
 # stored in 'commandfunc' hash, and text which will be returned to the
 # client before the command callback runs is stored in 'displaytext'.
-# Gopher is not handled here, however (it has a separate routine).
 #
 sub protocolsetup {
     my $proto = $_[0];
@@ -1298,7 +1294,7 @@ while(@ARGV) {
         }
     }
     elsif($ARGV[0] eq '--proto') {
-        if($ARGV[1] && ($ARGV[1] =~ /^(ftp|imap|pop3|smtp|gopher)$/)) {
+        if($ARGV[1] && ($ARGV[1] =~ /^(ftp|imap|pop3|smtp)$/)) {
             $proto = $1;
             shift @ARGV;
         }
@@ -1425,7 +1421,7 @@ while(1) {
 
     &customize(); # read test control instructions
 
-    sendcontrol @welcome unless ($proto eq 'gopher');
+    sendcontrol @welcome;
 
     #remove global variables from last connection
     if($ftplistparserstate) {
@@ -1478,39 +1474,7 @@ while(1) {
         my $FTPCMD;
         my $FTPARG;
         my $full=$_;
-
-        if($proto eq 'gopher') {
-          # Gopher protocol support lives right here and we handle it
-          # right here and now, since there will only ever be one selector
-          # and no other commands.
-
-          my $sel = $_;
-          my $query = '';
-          my @response = ();
-          ($sel, $query) = split(/\x09/, $_) if (/\x09/);
-
-          if($sel eq 'erifiedserver') {
-            # NOT verifiedserver, the first character is the item type in
-            # a Gopher URL!
-            push(@response, "iWE ROOLZ: $$\x09\x09error.host\x091\r\n");
-          }
-          if (length($query)) { # fake Veronica, gin up search results
-            push(@response, "iSearch results\x09\x09error.host\x091\r\n");
-            push(@response,
-                 "0Query $query\x09/foo\x09foo.bar.invalid\x0970\r\n");
-          } else { # fake selector, gin up a menu
-            push(@response, "iMenu results\x09\x09error.host\x091\r\n");
-          }
-          push(@response,
-               "0Selector $sel\x09/bar\x09bar.foo.invalid\x0970\r\n");
-          push(@response, ".\r\n");
-          sendcontrol @response;
-
-          # disconnect the client now, no command.
-          $FTPCMD = $FTPARG = '';
-          print SFWRITE "DISC\n";
-        }
-        elsif($proto eq "imap") {
+        if($proto eq "imap") {
             # IMAP is different with its identifier first on the command line
             unless (m/^([^ ]+) ([^ ]+) (.*)/ ||
                     m/^([^ ]+) ([^ ]+)/) {
@@ -1586,7 +1550,7 @@ while(1) {
             }
         }
 
-        if($check && $proto ne 'gopher') {
+        if($check) {
             logmsg "$FTPCMD wasn't handled!\n";
             sendcontrol "500 $FTPCMD is not dealt with!\r\n";
         }
index 8429b40..34b155d 100644 (file)
@@ -148,8 +148,7 @@ sub server_pidfilename {
 sub server_logfilename {
     my ($logdir, $proto, $ipver, $idnum) = @_;
     my $trailer = '_server.log';
-    $trailer = '_stunnel.log' if(lc($proto) =~ /^(ftp|http|imap|pop3|smtp)s$/||
-                                 lc($proto) eq 'gopher');
+    $trailer = '_stunnel.log' if(lc($proto) =~ /^(ftp|http|imap|pop3|smtp)s$/);
     return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
 }
 
@@ -190,7 +189,7 @@ sub server_outputfilename {
 sub mainsockf_pidfilename {
     my ($proto, $ipver, $idnum) = @_;
     die "unsupported protocol: $proto" unless($proto &&
-        ((lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/) || lc($proto) eq 'gopher'));
+        (lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/));
     my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.pid':'_sockfilt.pid';
     return '.'. servername_canon($proto, $ipver, $idnum) ."$trailer";
 }
@@ -202,7 +201,7 @@ sub mainsockf_pidfilename {
 sub mainsockf_logfilename {
     my ($logdir, $proto, $ipver, $idnum) = @_;
     die "unsupported protocol: $proto" unless($proto &&
-        ((lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/) || lc($proto) eq 'gopher'));
+        (lc($proto) =~ /^(ftp|imap|pop3|smtp)s?$/));
     my $trailer = (lc($proto) =~ /^ftps?$/) ? '_sockctrl.log':'_sockfilt.log';
     return "${logdir}/". servername_canon($proto, $ipver, $idnum) ."$trailer";
 }