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 .I --server
is given. 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 .SH CONFIGURATION
there are configuration values in there are configuration values in

View file

@ -26,6 +26,7 @@ use warnings;
# variables # variables
my $help; my $help;
my $tor; my $tor;
my $get_response;
my $DEFAULT_SERVER; my $DEFAULT_SERVER;
my $file; my $file;
my $DISPLAY_ASCII; my $DISPLAY_ASCII;
@ -85,7 +86,8 @@ sub enable_tor
GetOptions ("server=s" => \$DEFAULT_SERVER, GetOptions ("server=s" => \$DEFAULT_SERVER,
"help|" => \$help, "help|" => \$help,
"tor"=> \$tor "tor"=> \$tor,
"get-response"=>\$get_response
); );
&help if $help || not defined $ARGV[0]; &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 # check if server is running lainsafe
if (!$ua->get($url_to_upload)->is_success) { 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; exit;
} }