summaryrefslogtreecommitdiffstats
path: root/debian/perl-framework/t/htdocs/modules/h2/necho.pl
blob: bc9b6c0577e04f8fc6f53e20836ea2641744ab74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env perl

use Env;

my $query = $ENV{QUERY_STRING};

if ($query) {
    $query =~ /count=([0-9]+)/;
    my $count = $1;
    $query =~ /text=([^&]+)/;
    my $text = $1;
    
    print "Status: 200\n";
    print "Content-Type: text/plain\n";
    print "\n";
    foreach my $i (1..$count) {
        print $text;
    }
}
else {
    print "Status: 400 Parameter Missing\n";
    print "Content-Type: text/plain\n";
    print "\n";
    print <<EOF;
<html><body>
<p>No query was specified.</p>
</body></html>
EOF
}