Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

LWP patch (https through a proxy)

by danny0085 (Sexton)
on Sep 19, 2012 at 14:25 UTC ( #994465=perlquestion: print w/ replies, xml ) Need Help??
danny0085 has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to pass https requests through a squid proxy with LWP::UserAgent and having no luck
$PROXY_IP = "proxy.mydomain.com:8080"; $ua = LWP::UserAgent->new; $ua->proxy(['http', 'https'], "http://$PROXY_IP/"); $URL = "https://www.somedomain.com/index.htm"; $request = HTTP::Request->new('GET', "$URL"); $response = $ua->request($request);
At which I get back a response from the proxy server that says:
"Unsupported Request Method and Protocol"
I have read that LWP don't support HTTPS over proxy properly and needs a patch. I hope someone can help me. Thanks SOLVED:
use Net::SSL (); # From Crypt-SSLeay use LWP::UserAgent; $Net::HTTPS::SSL_SOCKET_CLASS = "Net::SSL"; # Force use of Net::SSL $ENV{HTTPS_PROXY} = 'http://98.142.214.160:443'; $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; my $ua = LWP::UserAgent->new(); my $req = HTTP::Request->new('GET','https://twitter.com'); my $res = $ua->request($req); print $res->status_line;

Comment on LWP patch (https through a proxy)
Select or Download Code
Re: LWP patch (https through a proxy)
by zentara (Archbishop) on Sep 19, 2012 at 15:30 UTC
    I don't have an answer for you, but it seems that this has been asked before.
    If you google for lwp proxy Unsupported Request Method and Protocol you will find all the previous discussions.
    Maybe Perl https parser would help.

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: LWP patch (https through a proxy)
by Anonymous Monk on Sep 19, 2012 at 18:48 UTC

    I have read that LWP don't support HTTPS over proxy properly and needs a patch. I hope someone can help me. Thanks

    Maybe the place you heard about it needing a patch has a patch for you to try?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://994465]
Approved by herveus
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-07-30 03:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls