NAME
AnyEvent::HTTP::Socks - Adds socks support for AnyEvent::HTTP
SYNOPSIS
use AnyEvent::HTTP;
use AnyEvent::HTTP::Socks;
http_get 'http://www.google.com/', socks => 'socks5://localhost:1080', sub {
print $_[0];
};
DESCRIPTION
This module adds new `socks' option to all http_* functions exported by AnyEvent::HTTP. So you can specify socks proxy for HTTP requests.
This module uses IO::Socket::Socks as socks library, so any global variables like $IO::Socket::Socks::SOCKS_DEBUG can be used to change the behavior.
Socks string structure is:
scheme://login:password@host:port
^^^^^^ ^^^^^^^^^^^^^^ ^^^^ ^^^^
1 2 3 4
1 - scheme can be one of the: socks4, socks4a, socks5
2 - "login:password@" part can be ommited if no authorization for socks proxy needed. For socks4 proxy "password" should be ommited, because this proxy type doesn't support login/password authentication, login will be interpreted as userid.
3 - ip or hostname of the proxy server
4 - port of the proxy server
You can also make connection through a socks chain. Simply specify several socks proxies in the socks string and devide them by tab(s) or space(s):
"socks4://10.0.0.1:1080 socks5://root:123@10.0.0.2:1080 socks4a://85.224.100.1:9010"
METHODS
AnyEvent::HTTP::Socks->inject('Package::Name')
Add socks support to some package based on AnyEvent::HTTP.
Example:
use AnyEvent::HTTP;
use AnyEvent::HTTP::Socks;
use AnyEvent::Google::PageRank qw(rank_get);
use strict;
AnyEvent::HTTP::Socks->inject('AnyEvent::Google::PageRank');
rank_get 'http://mail.com', socks => 'socks4://localhost:1080', sub {
warn $_[0];
};
NOTICE
You should load AnyEvent::HTTP::Socks after AnyEvent::HTTP, not before. Or simply load only AnyEvent::HTTP::Socks and it will load AnyEvent::HTTP automatically.
SEE ALSO
AnyEvent::HTTP, IO::Socket::Socks
AUTHOR
Oleg G, <oleg@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2011 by Oleg G
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself