|< 1 2 >| | 14 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
my $PORT = 8080;
use HTTP::Daemon;
use LWP::UserAgent;
$SIG{PIPE} = 'IGNORE';
$SIG{CHLD} = sub { wait(); };
my $srv = HTTP::Daemon->new(LocalPort => $PORT, Reuse => 1);
die "can't start server ($@)" unless defined $srv;
my $ua = LWP::UserAgent->new();
$ua->agent("bla/1.0");
while(my $conn = $srv->accept()) {
defined(my $pid = fork()) or die "Can't fork!";
next if $pid;
while (my $request = $conn->get_request) {
my $resp = $ua->simple_request($request);
$conn->send_response($resp);
}
$conn->close;
exit(0);
}
|< 1 2 >| | 14 Einträge, 2 Seiten |