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

WWW::Mechanize and HTTPS proxy

by Gangabass (Vicar)
on May 31, 2014 at 02:33 UTC ( [id://1088096]=perlquestion: print w/replies, xml ) Need Help??

Gangabass has asked for the wisdom of the Perl Monks concerning the following question:

How to tell WWW::Mechanize to work with HTTPS proxy? I have this code:
use WWW::Mechanize; print "WWW::Mechanize: ", $WWW::Mechanize::VERSION, "\n"; print "LWP : ", $LWP::UserAgent::VERSION, "\n"; my $mech = WWW::Mechanize->new(); $mech->proxy( [ 'http', 'https' ], "https://204.228.129.46:8080/" ); $mech->add_handler("request_send", sub { shift->dump; return }); $mech->add_handler("response_done", sub { shift->dump; return }); $mech->get("http://people.iu.edu/");
and below is result I have:
WWW::Mechanize: 1.73 LWP : 6.06 GET http://people.iu.edu/ Accept-Encoding: gzip User-Agent: WWW-Mechanize/1.73 (no content) 500 Can't connect to 204.228.129.46:8080 Content-Type: text/plain Client-Date: Sat, 31 May 2014 02:26:15 GMT Client-Warning: Internal response Can't connect to 204.228.129.46:8080\n LWP::Protocol::https::Socket: SSL connect attempt failed with unknown +error SSL wants a read first at c:/Perl/site/lib/LWP/Protocol/http.pm + line 41.\n Error GETing http://people.iu.edu/: Can't connect to 204.228.129.46:80 +80
If the proxy is HTTP based I have no errors...t connect to 204.228.129.46:8080 Content-Type: text/plain Client-Date: Sat, 31 May 2014 02:26:15 GMT Client-Warning: Internal response Can

Replies are listed 'Best First'.
Re: WWW::Mechanize and HTTPS proxy
by noxxi (Pilgrim) on Jun 01, 2014 at 17:14 UTC
    Just for reference, because I've answered the question already on Stackoverflow:
    • with LWP::UserAgent 6.06 and LWP::Protocol::https 6.06 proxy support for https should work out of the box as documented, e.g. by setting proxy with proxy method or reading it from environment with env_proxy method
    • for version 6.05 it might work out of the box if you use Debian or derivates, because they've patched it already in 12/2013
    • for versions older than 6.06 Net::SSLGlue::LWP provides the necessary monkey patching
Re: WWW::Mechanize and HTTPS proxy
by Anonymous Monk on May 31, 2014 at 03:30 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1088096]
Approved by taint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-24 09:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found