From: Dirk Koopman Date: Tue, 17 Jun 2014 00:11:24 +0000 (+0100) Subject: fix various cmds using AsyncMsg X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=af00b2713eb62cdee83a6bf184e2b410226f8be6;p=spider.git fix various cmds using AsyncMsg --- diff --git a/cmd/show/425.pl b/cmd/show/425.pl index 86e66554..0b41d3bc 100644 --- a/cmd/show/425.pl +++ b/cmd/show/425.pl @@ -32,7 +32,7 @@ sub handle my $path = "/425dxn/spider.php?$op"; Log('call', "$call: show/425 \U$op"); - my $conn = AsyncMsg->get($self, $target, $port, $path, prefix=>'425> ', 'User-Agent' => qq{DxSpider;$main::version;$main::build;$^O;$main::mycall;$call;$list[0]}); + my $conn = AsyncMsg->get($self, $target, $path, prefix=>'425> ', 'User-Agent' => qq{DxSpider;$main::version;$main::build;$^O;$main::mycall;$call;$list[0]}); if ($conn) { push @out, $self->msg('m21', "show/425"); diff --git a/cmd/show/contest.pl b/cmd/show/contest.pl index 524f6b86..a9db4ea7 100644 --- a/cmd/show/contest.pl +++ b/cmd/show/contest.pl @@ -52,7 +52,7 @@ sub handle dbg("sh/contest: url=$url") if isdbg("contest"); - my $r = AsyncMsg->get($self->call, $host, $port, $url, prefix=>'ctst> '); + my $r = AsyncMsg->get($self->call, $host, $url, prefix=>'ctst> '); if ($r) { push @out, $self->msg('m21', "show/contest"); } diff --git a/cmd/show/ik3qar.pl b/cmd/show/ik3qar.pl index eed4ecf0..71f1e735 100644 --- a/cmd/show/ik3qar.pl +++ b/cmd/show/ik3qar.pl @@ -27,7 +27,7 @@ sub handle dbg("IK3QAR: url=$path") if isdbg('ik3qar'); Log('call', "$call: SH/IK3QAR $line"); - my $r = AsyncMsg->get($self, $target, $port, $path, prefix=>'qar> ', + my $r = AsyncMsg->get($self, $target, $path, prefix=>'qar> ', 'User-Agent' => "DxSpider;$main::version;$main::build;$^O;$main::mycall;$call"); if ($r) { push @out, $self->msg('m21', "show/ik3qar"); diff --git a/perl/AsyncMsg.pm b/perl/AsyncMsg.pm index b1875d97..95c5e8f6 100644 --- a/perl/AsyncMsg.pm +++ b/perl/AsyncMsg.pm @@ -118,6 +118,8 @@ sub _getpost $conn->{_assort} = $sort; $conn->{csort} = 'http'; + my $data = delete $args{data}; + my $ua = Mojo::UserAgent->new; my $s; $s .= $host; @@ -132,7 +134,6 @@ sub _getpost $ua->on(start => sub { my ($ua, $tx) = @_; - my $data = delete $args{data}; while (my ($k, $v) = each %args) { dbg("AsyncMsg: attaching header $k: $v") if isdbg('async'); $tx->req->headers->header($k => $v);