File: httpd

package info (click to toggle)
libhttp-daemon-perl 6.01-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 276 kB
  • sloc: perl: 790; makefile: 2
file content (31 lines) | stat: -rwxr-xr-x 573 bytes parent folder | download | duplicates (2)
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
30
31
#!/local/perl/bin/perl -w

use HTTP::Daemon ();

my $s = new HTTP::Daemon;
die "Can't create daemon: $!" unless $s;

print $s->url, "\n";

my $c = $s->accept;
die "Can't accept" unless $c;

$c->timeout(60);
my $req = $c->get_request;

die "No request" unless $req;

my $abs = $req->uri->abs;

print $req->as_string;

$c->send_file_response("/etc");

#$c->send_redirect("http://www.sn.no/aas", 301, "<title>Piss off</title>");

#my $res = HTTP::Response->new(400, undef,
#			      HTTP::Headers->new(Foo => 'bar'),
#			      "Gisle\n"
#			     );
#$c->send_response($res);