|
|
|
@ -8,6 +8,7 @@ use Encode qw(encode); |
|
|
|
|
use Compress::Zlib; |
|
|
|
|
use Getopt::Long; |
|
|
|
|
use YAML::Tiny; |
|
|
|
|
use MIME::Base64; |
|
|
|
|
|
|
|
|
|
my $conf = {}; |
|
|
|
|
my $cmd = { |
|
|
|
@ -72,6 +73,13 @@ if ( $conf->{compress} ){ |
|
|
|
|
$ua->default_header( 'Content-Encoding' => 'gzip' ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Add basic auth header if set in the config |
|
|
|
|
# Note that we do not check the realm, nor we check for a 401 response, we consider |
|
|
|
|
# admins will be careful enough not to set wrong server in the conf |
|
|
|
|
if ( $conf->{username} and $conf->{password} ) { |
|
|
|
|
$ua->default_header( 'Authorization' => 'Basic ' . encode_base64($conf->{username} . ':' . $conf->{password}) ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Check if the state file exists and contains a valid cursor |
|
|
|
|
my $cursor_arg = ''; |
|
|
|
|
open CURSOR, "+<", $conf->{state}; |
|
|
|
|