PROXY  WHOIS  RQUOTE  TEXTS  SOFT  FOREX  BBOARD
 Music  Philosophy  Code  Literature  Russian

= ROOT|Technical|Code_Examples|Perl|Proxy|HTTP-ProxyCheck-1.4|ProxyCheck.pm =

page 1 of 15



#===============================================================================
# HTTP::ProxyCheck Version 1.4, Thu May 25 10:47:42 CEST 2006
#===============================================================================
# Copyright (c) 2004 - 2006 Thomas Weibel. All rights reserved.
#
# This library is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
# More information: See "pod2text ProxyCheck.pm"
#===============================================================================

package HTTP::ProxyCheck;

use strict;
use vars qw($answer $error $VERSION);
use warnings;

use Validate::Net;
use IO::Socket;

BEGIN {
    $VERSION = 1.4;
    $answer  = '';
    $error   = '';

    # Autoflush = True
    $| = 1;
}

=head1 NAME

HTTP::ProxyCheck - a class to check the functionality of HTTP proxy servers.

=head1 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";
    }

=head1 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.

=head1 CONSTRUCTOR

=head2 new( [attribute => $value, ...] )

C<new()> is the HTTP::ProxyCheck object constructor.

If an error happens while constructing the object, use 
C<$HTTP::ProxyCheck::error> to get the error message.

All named attributes of C<new()> are optional.

B<Attributes>

=over 10

=item * proxy => $proxy

Specifies the address of the proxy server to check. This can also be done with 
C<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
C<< check_proxy => 0 >>. 

=item * check_proxy => 1|0

Set C<< check_proxy => 0 >> to disable the check whether the proxy server 
address is valid.

The default value of C<check_proxy> is C<1> which means, the proxy server 
address gets tested.

This attribute can also be set with C<set_check_proxy()>.

=item * url => $url

Specifies the URL to use for the proxy server check. This can also be done 
with C<set_url()>.

=1=

= PAGE 1 = NEXT > |2|3|4|5|6|7|8|9|10.15

UP TO ROOT | UP TO DIR

Google
 


E-mail Facebook Google Digg del.icio.us BlinkList Fark Furl Ma.gnolia Netscape NewsVine Reddit Slashdot Spurl StumbleUpon Technorati YahooMyWeb LiveJournal Blogmarks TwitThis Live News2.ru BobrDobr.ru Memori.ru MoeMesto.ru

0.0315089 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU)