File: httpd_term.pl

package info (click to toggle)
libhttp-daemon-perl 6.12-1%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 492 kB
  • sloc: perl: 715; makefile: 2
file content (26 lines) | stat: -rwxr-xr-x 566 bytes parent folder | download
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
use strict;
use warnings;
use HTTP::Daemon;

# $HTTP::Daemon::DEBUG++;

my $d = HTTP::Daemon->new(Timeout => 60);
print "Please contact me at: <URL:", $d->url, ">\n";

while (my $c = $d->accept) {
CONNECTION:
    while (my $r = $c->get_request) {
        print $r->as_string;
        $c->autoflush;
    RESPONSE:
        while (<STDIN>) {
            last RESPONSE   if $_ eq ".\n";
            last CONNECTION if $_ eq "..\n";
            print $c $_;
        }
        print "\nEOF\n";
    }
    print "CLOSE: ", $c->reason, "\n";
    $c->close;
    $c = undef;
}