wmshutdown: Destroy dialog window before shutting down. This is especially useful...
[dockapps.git] / wmget / wmget-test.pl
blobb1ab469c03ef99bce775a6033f64a79b27700148
1 #!/usr/bin/perl -w
2 use strict;
4 use IO::Handle;
5 use IO::Socket;
7 &run_server ();
9 sub run_server {
10 local $SIG{PIPE} = 'IGNORE';
12 my $servsock = new IO::Socket (
13 Domain => AF_INET,
14 Type => SOCK_STREAM,
15 Proto => "tcp",
16 Reuse => 1,
17 Listen => 1,
18 LocalPort => 8000,
19 ) or die "new IO::Socket: $!";
21 print "to test, enter wmget http://localhost:8000/...\n";
23 while (my $client = $servsock->accept) {
24 $client->autoflush (1);
26 while (<$client>) {
27 print STDERR "> $_";
28 last if not /\S/;
31 print STDERR "headers done. sending data...\n";
33 print $client "HTTP/1.0 200 Ok, here you go...\r\n";
34 print $client "Content-Type: text/plain\r\n";
35 print $client "Content-Length: 1000\r\n\r\n";
37 # generate bogus data, and do it slowly....
38 for (1..10) {
39 print $client "x" x 99, "\n";
40 sleep 1;