Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks
I've read through all the nodes related to the topic but could not find a question spesific to this problem
I removed the relavant code from my script and posted it below, The script does Proxy uathentication
It used to work with the example below so I'm afraid it might be a network setup change
The only reason I'm posting it is the error I get in $! -> "Bad File Descriptor" Does anyone know if the error is code related or network related and/or have any idea why I get the error
I have tried the following syntax:
$ua->proxy('http','http://myuser:mypass@10.0.4.77'); $ua->proxy(http =>'http://myuser:mypass@10.0.4.77'); $ua->proxy('http','http://10.0.4.77'); $ua->proxy('http','http://10.0.4.77:80'); $ua->proxy('http','http://myuser:mypass@10.0.4.77:80');
I can ping the proxy
My internet connection is setup on the same proxy
With all these examples I get the same error
Please Help
use strict; use LWP::UserAgent; use LWP::Simple; use HTTP::Request::Common; #Names have been changed to protect my sms bill my $sms_base_url='http://api.smsprovider.com'; my $ua = LWP::UserAgent->new(); $ua->proxy('http','http://myuser:mypass@10.0.4.77'); my $auth_sms_action="/http/auth?user=smsuser&password=smspass&api_id=s +msid"; #print "\$auth_sms_action:$auth_sms_action"; my $autentication = &do_post_action($sms_base_url,$auth_sms_action); print "\$autentication:$autentication"; sub do_post_action { my ($s_path,$action) = @_; my $path = $s_path.$action; print "\$path:$path\n"; my $req = HTTP::Request->new(POST => "$path"); $req->proxy_authorization_basic('myuser', 'mypass'); $req->content_type('application/x-www-form-urlencoded'); $req->content('query=libwww-perl&mode=dist'); # Pass request to t +he user agent and get a response back my $res = $ua->request($req); # Check the outcome of the response if ($res->is_success) { my $res_content = $res->content; return $res_content; } #if ($res->is_success) else { return "$!"; } #else for if ($res->is_success) } #sub do_post_action
Edited by planetscape - added code tags around the section "I have tried the following syntax..."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: lwp proxy Authentication
by Corion (Patriarch) on Aug 22, 2006 at 10:53 UTC | |
by PugSA (Beadle) on Aug 22, 2006 at 11:25 UTC | |
|
Re: lwp proxy Authentication
by PugSA (Beadle) on Aug 22, 2006 at 09:17 UTC |