I am using HTTP::Daemon
for a HTTP-server.
use strict;
use warnings;
use HTTP::Daemon;
my $d = HTTP::Daemon->new (Listen => 1, LocalPort => 8080, ReuseAddr => 1, Blocking => 0) or die "error daemon: " . $!;
while (1)
{
my $c = $d->accept ();
if (defined ($c))
{
my $req = $c->get_request ();
my $res = HTTP::Response->new (200);
$res->header ("Server" => "MyServer"); # try to overwrite the internel builtin value
$res->content ("OK");
$c->send_response ($res);
$c->autoflush ();
undef ($c);
}
sleep (1);
}
I try to overwrite the HTTP-header entry for Server. But, all I get is a 2nd entry with my value "MyServer".
Any idea how to overwrite the original value "libwww-perl-daemon"?
There is a method product_tokens
for getting the value, but it is not able to set the value.
The docs say you should make a subclass:
So, you write a small subclass and then use your subclass to make the object: