Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin
In directory usw-pr-cvs1:/tmp/cvs-serv17422/lib/HTTP/WebTest/Plugin
Modified Files:
SetRequest.pm
Log Message:
Added test parameter 'user_agent'
Index: SetRequest.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/SetRequest.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SetRequest.pm 7 Feb 2002 23:41:34 -0000 1.4
--- SetRequest.pm 12 Feb 2002 12:17:00 -0000 1.5
***************
*** 86,98 ****
for proxy server access authorization.
=cut
sub param_types {
! return q(url uri
! method scalar('^(?:GET|POST)$')
! params hashlist
! auth list('scalar','scalar')
! proxies hashlist
! pauth list('scalar','scalar'));
}
--- 86,110 ----
for proxy server access authorization.
+ =head2 user_agent
+
+ Get/set the product token that is used to identify the user agent on
+ the network.
+
+ =head3 Default value
+
+ C<HTTP-WebTest/NN>
+
+ where C<NN> is version number of HTTP-WebTest.
+
=cut
sub param_types {
! return q(url uri
! method scalar('^(?:GET|POST)$')
! params hashlist
! auth list('scalar','scalar')
! proxies hashlist
! pauth list('scalar','scalar')
! user_agent scalar);
}
***************
*** 107,119 ****
$self->validate_params(qw(url method params
! auth proxies pauth));
# get various params we handle
! my $url = $self->test_param('url');
! my $method = $self->test_param('method');
! my $params = $self->test_param('params');
! my $auth = $self->test_param('auth');
my $proxies = $self->test_param('proxies');
! my $pauth = $self->test_param('pauth');
# fix broken url
--- 119,133 ----
$self->validate_params(qw(url method params
! auth proxies pauth
! user_agent));
# get various params we handle
! my $url = $self->test_param('url');
! my $method = $self->test_param('method');
! my $params = $self->test_param('params');
! my $auth = $self->test_param('auth');
my $proxies = $self->test_param('proxies');
! my $pauth = $self->test_param('pauth');
! my $ua_name = $self->test_param('user_agent');
# fix broken url
***************
*** 169,172 ****
--- 183,191 ----
$request->proxy_authorization_basic(@$pauth);
}
+
+ # set user agent name
+ $ua_name = 'HTTP-WebTest/' . HTTP::WebTest->VERSION
+ unless defined $ua_name;
+ $user_agent->agent($ua_name);
}
|