X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fqrz.pl;h=7665f08c9c67a646235b475f9097a5747d27f4c3;hb=9bafb5297d126d00203d67addaa918c0f056d9a8;hp=910b1997d9fd94e662030cd75d3aac89e80f9915;hpb=4c359e47990e8dae13161e92b373aa4b16b76513;p=spider.git diff --git a/cmd/show/qrz.pl b/cmd/show/qrz.pl index 910b1997..7665f08c 100644 --- a/cmd/show/qrz.pl +++ b/cmd/show/qrz.pl @@ -13,23 +13,36 @@ my @out; return (1, $self->msg('e24')) unless $Internet::allow; return (1, "SHOW/QRZ , e.g. SH/QRZ g1tlh") unless @list; +my $target = $Internet::http_proxy || 'qrz.com'; +my $port = $Internet::http_proxy_port || 80; +my $url = ''; +$url = 'http://qrz.com' if $Internet::http_proxy; use Net::Telnet; my $t = new Net::Telnet; foreach $l (@list) { - $t->open(Host => "qrz.com", - Port => 80, - Timeout => 15); - if ($t) { - my $s = "GET /dxcluster.cgi?callsign=$l\&uid=$Internet::qrz_uid\&pw=$Internet::qrz_pw HTTP/1.0\n\n"; + eval { + $t->open(Host => $target, + Port => $port, + Timeout => 15); + }; + + if (!$t || $@) { + push @out, $self->msg('e18', 'QRZ.com'); + } else { + my $s = "GET $url/dxcluster.cgi?callsign=$l\&uid=$Internet::qrz_uid\&pw=$Internet::qrz_pw HTTP/1.0\n\n"; # print $s; $t->print($s); Log('call', "$call: show/qrz \U$l"); my $state = "blank"; - while (my $result = $t->getline) { -# print $result; + while (my $result = eval { $t->getline(Timeout => 30) } || $@) { + dbg($result) if isdbg('qrz') && $result; + if ($@) { + push @out, $self->msg('e18', 'QRZ.com'); + last; + } if ($state eq 'blank' && $result =~ /^\s*Callsign\s*:/i) { $state = 'go'; } elsif ($state eq 'go') { @@ -40,8 +53,6 @@ foreach $l (@list) { } $t->close; push @out, $self->msg('e3', 'qrz.com', uc $l) unless @out; - } else { - push @out, $self->msg('e18', 'QRZ.com'); } }