#!/usr/bin/perl

use HTTP::Daemon;
use HTTP::Status;

my $file = '/var/lib/boinc/client_state.xml';
my $port = 65535;

#-----------------------------------------------------------------------

my $daemon = new HTTP::Daemon
	LocalAddr => '0.0.0.0',
	LocalPort => $port;

print "Listener started\n";

while(my $connection = $daemon->accept) {

	while(my $request = $connection->get_request) {

		if($request->method eq "GET") {
			$connection->send_file_response($file);
		}

	}

	$connection->close;
	undef($connection);

}

