30 Jul 2014 22:42:01 UTC
- Distribution: LWP-Protocol-socks
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (2)
- Testers (2272 / 1 / 0)
- KwaliteeBus factor: 0
- 20.65% Coverage
- License: unknown
- Activity24 month
- Download (4.46KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
LWP::Protocol::socks - adds support for the socks protocol and proxy facility
Use this package when you wish to use a socks proxy for your connections.
It provides some essential hooks into the LWP system to implement a socks "scheme" similar to http for describing your socks connection, and can be used to proxy either http or https connections.
The use case is to use LWP::UserAgent's proxy method to register your socks proxy like so:
$ua->proxy([qw(http https)] => 'socks://socks.yahoo.com:1080');
Then just use your $ua object as usual!
#!/usr/local/bin/perl use strict; use LWP::UserAgent; my $ua = new LWP::UserAgent(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:18.104.22.168) Gecko/20060719 Firefox/22.214.171.124'); # for socks5, use socks like so: $ua->proxy([qw(http https)] => 'socks://socks.yahoo.com:1080'); # for socks4, use socks4 like so: $ua->proxy([qw(http https)] => 'socks4://socks.yahoo.com:1080'); my $response = $ua->get("http://www.freebsd.org"); print $response->code,' ', $response->message,"\n"; my $response = $ua->get("https://www.microsoft.com"); print $response->code,' ', $response->message,"\n";
I don't have much time to contribute to this. If you'd like to contribute, please fork https://github.com/scr/cpan and send me a pull request.
Sheridan C Rawlins <email@example.com>
Oleg G <firstname.lastname@example.org>