9 use HTTP::Server::Simple::CGI;
10 use base qw(HTTP::Server::Simple::CGI);
17 '/reviewcert' => \&reviewcert,
18 '/extracerts' => \&extracerts,
25 my $path = $cgi->path_info();
26 my $handler = $dispatch{$path};
28 # FIXME: ensure that this is a POST
29 if (ref($handler) eq "CODE") {
30 printf STDERR ("Got POST %s\n", $path);
31 my ($status, $object) = $handler->($cgi);
32 printf("HTTP/1.0 %s\r\nContent-Type: application/json\r\n\r\n%s", $status, to_json ($object));
35 printf("HTTP/1.0 404 Not Found -- not handled by Monkeysphere validation agent\r\nContent-Type: text/plain\r\n\r\nHTTP/1.0 404 Not Found -- the path:\r\n %s\r\nis not handled by the MonkeySphere validation agent.\r\nPlease try one of the following paths instead:\r\n\r\n%s\r\n", $path, ' * '.join("\r\n * ", keys %dispatch) );
40 my $cgi = shift; # CGI.pm object
43 # FIXME: these should be opening up a json blob instead of using CGI params.
44 my $data = from_json($cgi->param('POSTDATA'));
47 print STDERR Dumper($data);
49 my $ret = { valid => 'true' };
50 # my $status = '404 no match found for the public key in this certificate';
52 my $status = '200 match found, authentication details to follow';
60 return '500 not yet implemented', { };
64 # start the server on port 8091
65 my $server = MSVA->new(8901);