summaryrefslogtreecommitdiff
path: root/tests/httpserver.pl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-11-17 15:15:48 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-11-17 15:15:48 +0000
commit7c6414ebbd7b6dc2e049b5a75a9429eae8678c7f (patch)
tree39e6089a46f42717c4f4084ccc6c3c15597ee908 /tests/httpserver.pl
parent85705e105c50f323393f819d7fccc94628d8b11f (diff)
downloadcurl-7c6414ebbd7b6dc2e049b5a75a9429eae8678c7f.tar.gz
uses stricter output
Diffstat (limited to 'tests/httpserver.pl')
-rwxr-xr-xtests/httpserver.pl29
1 files changed, 21 insertions, 8 deletions
diff --git a/tests/httpserver.pl b/tests/httpserver.pl
index e4e6d74aa..06b52c414 100755
--- a/tests/httpserver.pl
+++ b/tests/httpserver.pl
@@ -29,7 +29,9 @@ setsockopt(Server, SOL_SOCKET, SO_REUSEADDR,
bind(Server, sockaddr_in($port, INADDR_ANY))|| die "bind: $!";
listen(Server,SOMAXCONN) || die "listen: $!";
-print "HTTP server started on port $port\n";
+if($verbose) {
+ print "HTTP server started on port $port\n";
+}
open(PID, ">.server.pid");
print PID $$;
@@ -115,10 +117,13 @@ for ( $waitedpid = 0;
my $testnum;
if($path =~ /.*\/(\d*)/) {
$testnum=$1;
+
+ if($verbose) {
+ print STDERR "sending reply $testnum\n";
+ }
}
else {
- print STDERR "UKNOWN TEST CASE\n";
- exit;
+ $testnum=0;
}
open(INPUT, ">log/server.input");
for(@headers) {
@@ -126,12 +131,20 @@ for ( $waitedpid = 0;
}
close(INPUT);
- # send a reply to the client
- open(DATA, "<data/reply$testnum.txt");
- while(<DATA>) {
- print $_;
+ if(0 == $testnum ) {
+ print "HTTP/1.1 200 OK\r\n",
+ "header: yes\r\n",
+ "\r\n",
+ "You must select a test number to get good data back\r\n";
+ }
+ else {
+ # send a custom reply to the client
+ open(DATA, "<data/reply$testnum.txt");
+ while(<DATA>) {
+ print $_;
+ }
+ close(DATA);
}
- close(DATA);
}
# print "Hello there, $name, it's now ", scalar localtime, "\r\n";
};