Subject: | Option to use a HTTP proxy |
We need to access the validation service through a HTTP proxy. I guess
that's a need other people might add. Hopefully you'll consider adding
this to the released module.
Since the LWP::UserAgent isn't exposed through the API, we've modified
the W3C object to have another attribute: proxy which is applied to the
UserAgent object within the code.
A patch file is attached for application to version 0.11. Seems to work
OK on perl-5.8.7.
Thanks for the useful module.
Carl
Carl Vincent
Systems Manager
Netskills
www.netskills.ac.uk
Subject: | diff.txt |
*** W3C.pm 2006-03-02 15:46:29.000000000 +0000
--- W3C-011.pm 2006-02-25 19:34:48.000000000 +0000
***************
*** 10,16 ****
use WebService::Validator::HTML::W3C::Error;
__PACKAGE__->mk_accessors(
! qw( http_timeout validator_uri proxy _http_method
is_valid num_errors uri _content _output ) );
use vars qw( $VERSION $VALIDATOR_URI $HTTP_TIMEOUT );
--- 10,16 ----
use WebService::Validator::HTML::W3C::Error;
__PACKAGE__->mk_accessors(
! qw( http_timeout validator_uri _http_method
is_valid num_errors uri _content _output ) );
use vars qw( $VERSION $VALIDATOR_URI $HTTP_TIMEOUT );
***************
*** 71,80 ****
The URI of the validator to use. By default this accesses the W3Cs validator at http://validator.w3.org/check. If you have a local installation of the validator ( recommended if you wish to do a lot of testing ) or wish to use a validator at another location then you can use this option. Please note that you need to use the full path to the validator cgi.
- =item proxy
-
- A HTTP proxy to use when communicating with the validation service.
-
=item http_timeout
How long (in seconds) to wait for the HTTP connection to timeout when
--- 71,76 ----
***************
*** 113,119 ****
$self->validator_uri( $args{validator_uri} || $VALIDATOR_URI );
$self->_http_method( $args{detailed} ? 'GET' : 'HEAD' );
$self->_output( $args{output} || 'xml' );
- $self->proxy( $args{proxy} || '' );
}
=head2 validate
--- 109,114 ----
***************
*** 179,186 ****
my $ua = LWP::UserAgent->new( agent => __PACKAGE__ . "/$VERSION",
timeout => $self->http_timeout );
- if ($self->{proxy}) { $ua->proxy( $self->{proxy} ); }
-
my $request = $self->_get_request( $uri );
my $response = $ua->simple_request($request);
--- 174,179 ----