diff options
author | Daniel Stenberg <daniel@haxx.se> | 2000-11-13 20:47:09 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2000-11-13 20:47:09 +0000 |
commit | bd3dca96f650e81f21bdafd189ad8b2c4383c5da (patch) | |
tree | 4290b2ba3e00c7c4de3cf8520e6d5d69a124e4a5 /tests/httpserver.pl | |
parent | 3cd77a19ca22e6f0c40a73e5fe1b40c42150bdfe (diff) | |
download | curl-bd3dca96f650e81f21bdafd189ad8b2c4383c5da.tar.gz |
somewhat more functioning FTP
Diffstat (limited to 'tests/httpserver.pl')
-rwxr-xr-x | tests/httpserver.pl | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/tests/httpserver.pl b/tests/httpserver.pl index 453fe710e..622a6e75e 100755 --- a/tests/httpserver.pl +++ b/tests/httpserver.pl @@ -18,10 +18,9 @@ else { $protocol="HTTP"; } - socket(Server, PF_INET, SOCK_STREAM, $proto)|| die "socket: $!"; - setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, - pack("l", 1)) || die "setsockopt: $!"; +setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, + pack("l", 1)) || die "setsockopt: $!"; bind(Server, sockaddr_in($port, INADDR_ANY))|| die "bind: $!"; listen(Server,SOMAXCONN) || die "listen: $!"; @@ -40,14 +39,19 @@ sub REAPER { logmsg "reaped $waitedpid" . ($? ? " with exit $?" : ''); } -$commandok{ USER => 'fresh'}; # USER is ok in fresh state - -print "TEST: ".$commandok{"USER"}."\n"; - +# USER is ok in fresh state +%commandok = ( "USER" => "fresh", + "PASS" => "passwd", + "PASV" => "loggedin", + ); -$statechange{ 'USER' => 'passwd'}; # USER goes to passwd state +%statechange = ( 'USER' => 'passwd', # USER goes to passwd state + 'PASS' => 'loggedin', # PASS goes to loggedin state + ); -$displaytext{'USER' => '331 We are happy you arrived!'}; # output FTP line +%displaytext = ('USER' => '331 We are happy you popped in!', # output FTP line + 'PASS' => '230 Welcome you silly person', + ); $SIG{CHLD} = \&REAPER; @@ -117,10 +121,12 @@ for ( $waitedpid = 0; } $state=$statechange{$FTPCMD}; - if($command{$1} eq "") { - print "314 Wwwwweeeeird internal error\r\n"; - exit + if($state eq "") { + print "314 Wwwwweeeeird internal error state: $state\r\n"; + exit; } + print STDERR "gone to state $state\n"; + $text = $displaytext{$FTPCMD}; print "$text\r\n"; } |