Added --get-response (closes: #11) so you can debug lainsafecli i

guess

Also added documentation about --tor and --get-respone to the manpage
This commit is contained in:
qorg11 2020-08-15 21:48:03 +02:00
parent c645b36fb2
commit c5976c8200
No known key found for this signature in database
GPG Key ID: 343FC20A4ACA62B9
2 changed files with 16 additions and 2 deletions

View File

@ -32,6 +32,17 @@ server will be used if no
.I --server
is given.
.I --tor
Uses tor to upload the file. This requires
.I LWP::Protocol::socks
to be installed on your system. You also need to have tor running at
127.0.0.1:9050
.I --get-response
If the server returned an error, --get-response will make lainsafecli
print the content, so it can help you find out why
lainsafecli isn't working!
.SH CONFIGURATION
there are configuration values in

View File

@ -26,6 +26,7 @@ use warnings;
# variables
my $help;
my $tor;
my $get_response;
my $DEFAULT_SERVER;
my $file;
my $DISPLAY_ASCII;
@ -85,7 +86,8 @@ sub enable_tor
GetOptions ("server=s" => \$DEFAULT_SERVER,
"help|" => \$help,
"tor"=> \$tor
"tor"=> \$tor,
"get-response"=>\$get_response
);
&help if $help || not defined $ARGV[0];
@ -106,7 +108,8 @@ $ua->agent("Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0
# check if server is running lainsafe
if (!$ua->get($url_to_upload)->is_success) {
print "$url_to_upload is not running lainsafe.\n";
print "$url_to_upload is not running lainsafe. (--get-response to check the error)\n";
print $ua->get($url_to_upload)->decoded_content if $get_response;
exit;
}