使用电子邮件参数,以.com结尾,可以';使用Perl LWP无法从Restful Web服务获得结果
我想将perl与模块使用电子邮件参数,以.com结尾,可以';使用Perl LWP无法从Restful Web服务获得结果,perl,rest,Perl,Rest,我想将perl与模块LWP一起使用,从RESTfulWebService获取XML信息 代码如下: my $ua = LWP::UserAgent->new; $ua->proxy(['http','https'],'http://proxy:3128'); $ua->default_header('Accept-Charset'=>'utf-8'); $ua->default_header('Accept'=>'application/*********;
LWP
一起使用,从RESTfulWebService获取XML信息
代码如下:
my $ua = LWP::UserAgent->new;
$ua->proxy(['http','https'],'http://proxy:3128');
$ua->default_header('Accept-Charset'=>'utf-8');
$ua->default_header('Accept'=>'application/*********; version=1');
my $url= 'https://user:password@mailbox.********.net/mailboxes/?emailaddress=name@domain.net';
print Dumper($ua->get($url));
它适用于所有电子邮件地址,如.eu
、.org
或.net
,但电子邮件地址以.com
结尾除外。(例如:name@domail.com
)
错误消息是:
The following error was encountered while trying to retrieve the URL:
https://user@mailbox.******.net/mailboxes/?
Access Denied.
Access control configuration prevents your request from being allowed at this time.
Please contact your service provider if you feel this is incorrect.
Your cache administrator is *****@**.**
对应的响应头:
'_headers' => bless( {
'connection' => 'close',
'client-response-num' => 1,
'date' => 'Wed, 19 Nov 2014 15:53:45 GMT',
'x-squid-error' => 'ERR_ACCESS_DENIED 0',
'client-peer' => '****:3128',
'content-length' => '3502',
'client-date' => 'Wed, 19 Nov 2014 15:53:45 GMT',
'content-type' => 'text/html',
'mime-version' => '1.0',
'title' => 'ERROR: The requested URL could not be retrieved',
'server' => 'squid/3.1.12',
'x-cache' => 'MISS from proxy',
'x-cache-lookup' => 'NONE from proxy:3128'
}, 'HTTP::Headers' ),
我已经用SoapUI和curl进行了测试,它们没有遇到这个问题。这意味着.com
也适用于SoapUI和cuil。只有在使用LWP的perl中,才会出现问题。
不管怎样,当我添加一个伪参数
https://**/mailboxes/?emailaddress=name@domain.com&foo=bar
在链接的末尾,它可以工作
我不知道,这是LWP中的一个bug还是LWP和代理设置之间的一些不兼容的问题
Access Denied.
Access control configuration prevents your request from being allowed at this time.
Please contact your service provider if you feel this is incorrect.
...
'x-squid-error' => 'ERR_ACCESS_DENIED 0',
您使用的代理中有一个ACL拒绝您的请求。
如果您有权访问代理配置,请在此处进行检查,否则请与缓存管理员联系以解决您的问题。我已尝试使用SoapUI和Curl,但他们没有遇到此问题。如果是代理问题,为什么这些软件或命令可以获取使用相同代理的xml信息。可能存在基于用户代理的ACL。尝试更改它。谢谢,我明天将尝试与it部门沟通,以找出问题的原因。