NAME
HTTP::ProxyCheck - a class to check the functionality of HTTP proxy
servers.
SYNOPSIS
use HTTP::ProxyCheck;
my $proxy = 'proxy:8080';
my $url = 'http://search.cpan.org/';
my $proxy_check = new HTTP::ProxyCheck(
proxy => $proxy,
url => $url,
answer_size => 'header',
print_error => 0,
)
or die $HTTP::ProxyCheck::error;
print "Trying to connect to '$proxy' and retrieve '$url'\n";
if ( $proxy_check->check() ) {
print "'$proxy' returns:\n\n", $proxy_check->get_answer(), "\n\n";
}
else {
print "Error: ", $proxy_check->get_error(), "\n";
}
DESCRIPTION
HTTP::ProxyCheck is a class to check HTTP proxy servers. It connects to
given HTTP proxy servers and tries to retrieve a provided URL through
them.
CONSTRUCTOR
new( [attribute => $value, ...] )
"new()" is the HTTP::ProxyCheck object constructor.
If an error happens while constructing the object, use
$HTTP::ProxyCheck::error to get the error message.
All named attributes of "new()" are optional.
Attributes
* proxy => $proxy
Specifies the address of the proxy server to check. This can
also be done with "set_proxy()".
The proxy server address has to match the patter 'host:port'.
Host and port are tested whether they are valid. If you want
to disable this test, you can set "check_proxy => 0".
* check_proxy => 1|0
Set "check_proxy => 0" to disable the check whether the proxy
server address is valid.
The default value of "check_proxy" is 1 which means, the proxy
server address gets tested.
This attribute can also be set with "set_check_proxy()".
* url => $url
Specifies the URL to use for the proxy server check. This can
also be done with "set_url()".
The URL has to be of a valid form, e.g.
'http://search.cpan.org'. It gets tested whether it is valid.
If you want to disable this test, you can set "check_url =>
0".
* check_url => 1|0
Set "check_url => 0" to disable the check whether the URL is
valid.
The default value of "check_url" is 1 which means, the URL
gets tested.
This attribute can also be set with "set_check_url()".
* answer_size => short|header|full
Defines the size of the proxy server answer.
"short" means that only the HTTP status code, e.g.
HTTP/1.0 200 OK
is returned.
With "header" the full HTTP header gets returned, e.g.
HTTP/1.0 200 OK
Date: Tue, 12 Aug 2003 12:19:46 GMT
Server: Apache/1.3.27 (Unix) mod_perl/1.27
Cache-Control: max-age=3600
Expires: Tue, 12 Aug 2003 13:19:46 GMT
Last-Modified: Tue, 12 Aug 2003 12:19:46 GMT
Content-Type: text/html
X-Cache: MISS from search.cpan.org
X-Cache: MISS from hactar.earth.net
X-Cache-Lookup: HIT from hactar.earth.net:8080
Proxy-Connection: close
=1= |