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..."

( keep:0 edit:23 reap:0 )


In reply to lwp proxy Authentication by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.