aboutsummaryrefslogtreecommitdiff
path: root/examples/ipadd
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2020-02-26 15:48:20 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2020-02-27 17:40:57 +0200
commit3b2d57c14f1ed207c79362b7136e3da4054ad817 (patch)
tree8f97331e65e3d6cc0d483fc0c3d11a2e668e33be /examples/ipadd
parenta9a6567bac8ab7729c243b555e7fb3c4bb2c6e51 (diff)
downloadping903-3b2d57c14f1ed207c79362b7136e3da4054ad817.tar.gz
ping903-3b2d57c14f1ed207c79362b7136e3da4054ad817.tar.bz2
Implememt client-side basic auth
* lib/Makefile.am: Add base64.c * lib/base64.c: New file. * lib/basicauth.c: Move base64 support to a separate source. * lib/basicauth.h (base64_encode,base64_decode): New protos. * src/strsplit.c: New file. * src/Makefile.am (libping903_a_SOURCES): Add strsplit.c * src/defs.h (CRED_FILE_NAME): New macro. (ecalloc,strsplit,argcv_free): New proto. * src/mem.c (ecalloc): New function. * src/ping903.c (strsplit): Remove. (cf_auth): Use modified strsplit. * src/ping903q.c (http_query): Attempt to authenticate if basic auth is required. * examples/lib/LWP/Ping903.pm: New file. * examples/dbload: Use LWP::Ping903 * examples/inspect: Likewise. * examples/ipadd: Likewise. * examples/ipdel: Likewise.
Diffstat (limited to 'examples/ipadd')
-rwxr-xr-xexamples/ipadd4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/ipadd b/examples/ipadd
index f001950..d6195da 100755
--- a/examples/ipadd
+++ b/examples/ipadd
@@ -57,7 +57,7 @@ L<DBI>.
use strict;
use warnings;
-use LWP::UserAgent;
+use LWP::Ping903;
use JSON;
use Getopt::Long qw(:config gnu_getopt no_ignore_case);
use Pod::Usage;
@@ -82,7 +82,7 @@ GetOptions(
my $ip = shift @ARGV or die "not enough arguments";
die "too many arguments; try `$0 --help' for more info\n" if @ARGV;
-my $ua = new LWP::UserAgent;
+my $ua = new LWP::Ping903;
my $response = $ua->put("$baseurl/config/ip-list/$ip");
unless ($response->is_success) {
print $response->status_line,"\n";

Return to:

Send suggestions and report system problems to the System administrator.