From: Daniel Kahn Gillmor Date: Thu, 28 Oct 2010 21:48:03 +0000 (-0400) Subject: ensure that every response returns a server identifier X-Git-Tag: msva-perl_debian/0.6-1~3^2~13 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7597f40e6846fb879508ed9581f3610d990dab4d;p=monkeysphere-validation-agent.git ensure that every response returns a server identifier --- diff --git a/Changelog b/Changelog index 455cb7c..25dde74 100644 --- a/Changelog +++ b/Changelog @@ -10,6 +10,8 @@ msva-perl (0.6~pre) upstream; * Added tests/basic, as a simple test of a few functions (closes MS #2537) * fixed double-prompting on sites that have more than one User ID (closes MS #2567) + * report server implementation name and version with every query (closes + MS # 2564) -- Daniel Kahn Gillmor Thu, 28 Oct 2010 17:14:35 -0400 diff --git a/Crypt/Monkeysphere/MSVA.pm b/Crypt/Monkeysphere/MSVA.pm index 72061ab..c0858e0 100755 --- a/Crypt/Monkeysphere/MSVA.pm +++ b/Crypt/Monkeysphere/MSVA.pm @@ -39,7 +39,7 @@ # we need the version of GnuPG::Interface that knows about pubkey_data, etc: use GnuPG::Interface 0.42.02; - my $version = '0.1'; + my $VERSION = '0.6'; my $gnupg = GnuPG::Interface->new(); $gnupg->options->quiet(1); @@ -132,7 +132,7 @@ my $cgi = shift; return '200 OK', { available => JSON::true, protoversion => 1, - server => "MSVA-Perl ".$version }; + }; } # returns an empty list if bad key found. @@ -355,6 +355,11 @@ }; my ($status, $object) = $handler->{handler}($data, $clientinfo); + if (ref($object) eq 'HASH' && + ! defined $object->{server}) { + $object->{server} = sprintf("MSVA-Perl %s", $VERSION); + } + my $ret = to_json($object); msvalog('info', "returning: %s\n", $ret); printf("HTTP/1.0 %s\r\nDate: %s\r\nContent-Type: application/json\r\n\r\n%s", diff --git a/msva-query-agent b/msva-query-agent index fbe692b..0ec01c0 100755 --- a/msva-query-agent +++ b/msva-query-agent @@ -42,6 +42,7 @@ $client->log('info', "status: %s\n", $status); if (defined $ret) { $client->log('info', "valid: %s\n", $ret->{valid}); $client->log('fatal', "message: %s\n", $ret->{message}); + $client->log('info', "server: %s\n", $ret->{server}); exit 0 if ($ret->{valid}); }