Subversion Repositories vgwhois

Compare Revisions

Regard whitespace Rev 20 → Rev 92

/trunk/main/lib/VGWhoIs/Core.pm
2,7 → 2,7
# VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois)
# Main program
#
# (c) 2010-2019 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
# (c) 2010-2022 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
# based on the code (c) 1998-2010 by Juliane Holzt <debian@kju.de>
# Some early parts by Lutz Donnerhacke <Lutz.Donnerhacke@Jena.Thur.de>
#
334,27 → 334,26
elsif ($method eq 'cgi') {
my ($protocol, $hostname) = VGWhoIs::Utils::splitProtocolHost($host);
 
print "Querying $hostname ($protocol) with cgi.\n\n";
#!!
# print "$host\n";
print "Querying $hostname ($protocol) with cgi:\n$host\n\n";
 
# TODO: lynx seems to be better in some ways!
# For example, a website that outputs "text/plain" will be rendered correct in lynx!
# $result = `lynx -connect_timeout=10 -dump "$host" 2>&1`;
# $result .= "FAILED with exit code $?\n\n" if $?;
$result = VGWhoIs::Utils::lynxrender($host);
 
 
# Old:
 
# $result = `curl --max-time 10 --stderr /dev/null "$host" 2>&1`; # TODO escape
 
# TODO: VGWhoIs::Core::getsource ok? war vorher IMMER lynx
my ($loc_text, $loc_exitcode) = VGWhoIs::Core::getsource($host);
# my ($loc_text, $loc_exitcode) = VGWhoIs::Core::getsource($host);
 
$exitcode = max($exitcode, $loc_exitcode);
if ($loc_exitcode) {
$result .= "Query to web server failed.\n";
} else {
$result = VGWhoIs::Utils::render_html($loc_text);
# $exitcode = max($exitcode, $loc_exitcode);
# if ($loc_exitcode) {
# $result .= "Query to web server failed.\n";
# } else {
# $result = VGWhoIs::Utils::render_html($loc_text);
# }
 
}
}
 
elsif ($method eq 'cgipost') {
my ($protocol, $hostname) = VGWhoIs::Utils::splitProtocolHost($host);
/trunk/main/lib/VGWhoIs/Utils.pm
2,7 → 2,7
# VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois)
# Main program
#
# (c) 2010-2019 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
# (c) 2010-2022 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
# based on the code (c) 1998-2010 by Juliane Holzt <debian@kju.de>
# Some early parts by Lutz Donnerhacke <Lutz.Donnerhacke@Jena.Thur.de>
#
22,9 → 22,27
$url = quotemeta($url);
# LYNX sometimes hangs in combination with TOR
# return qx{lynx -connect_timeout=10 -source $url};
return qx{curl --user-agent "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" --silent --max-time 10 $url};
return qx{curl --insecure --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36" --silent --max-time 10 $url};
}
 
sub VGWhoIs::Utils::lynxrender {
my ($url) = @_;
$url = quotemeta($url);
 
use File::Basename;
my $script_dir = undef;
if(-l __FILE__) {
$script_dir = dirname(readlink(__FILE__));
} else {
$script_dir = dirname(__FILE__);
}
$script_dir = quotemeta($script_dir);
 
my $result = qx{lynx -cfg $script_dir/../lynx.cfg -dump -connect_timeout=10 $url 2>&1};
$result .= "FAILED with exit code $?\n\n" if $?;
return $result;
}
 
# $line = htmlpre($line);
sub VGWhoIs::Utils::htmlpre {
my ($line) = @_;
/trunk/main/lib/lynx.cfg
0,0 → 1,2
FORCE_SSL_PROMPT:YES