diff --git a/server/go/sigserver/client.pl b/server/go/sigserver/client.pl new file mode 100755 index 000000000..1219e717a --- /dev/null +++ b/server/go/sigserver/client.pl @@ -0,0 +1,50 @@ +#!/usr/bin/perl + +use strict; +use LWP::UserAgent; +use HTTP::Request; +use HTTP::Request::Common; +use Getopt::Long; + +my $keyid = "26F5ABDA"; +my $server = "http://localhost:2856"; +GetOptions("keyid=s" => \$keyid, + "server=s" => \$server) + or usage(); + +$server =~ s!/$!!; + +my $file = shift or usage(); +-f $file or usage("$file isn't a file"); + +my $json = do { undef $/; open(my $fh, $file); <$fh> }; + +sub usage { + my $err = shift; + if ($err) { + print STDERR "Error: $err\n"; + } + print STDERR "Usage: client.pl [OPTS] \n"; + print STDERR "Options:\n"; + print STDERR " --keyid=\n"; + print STDERR " --server=http://host:port\n"; + exit(1); +} + +my $req = POST("$server/camli/sig/sign", + "Authorization" => "Basic dGVzdDp0ZXN0", # test:test + Content => { + "json" => $json, + "keyid" => $keyid, + }); + +my $ua = LWP::UserAgent->new; +my $res = $ua->request($req); +unless ($res->is_success) { + die "Failure: " . $res->status_line; +} + +print $res->content; + + + diff --git a/server/go/sigserver/test/test.json b/server/go/sigserver/test/test.json new file mode 100644 index 000000000..c9a369570 --- /dev/null +++ b/server/go/sigserver/test/test.json @@ -0,0 +1,5 @@ +{ + "foo": "bar", + "blah": "baz" } + +