http-webtest-commits Mailing List for HTTP-WebTest (Page 19)
Brought to you by:
m_ilya,
richardanderson
You can subscribe to this list here.
2002 |
Jan
(38) |
Feb
(83) |
Mar
(10) |
Apr
(28) |
May
(42) |
Jun
(61) |
Jul
(43) |
Aug
(42) |
Sep
(14) |
Oct
(27) |
Nov
(16) |
Dec
(81) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(81) |
Feb
(29) |
Mar
(32) |
Apr
(42) |
May
(3) |
Jun
|
Jul
(11) |
Aug
|
Sep
(33) |
Oct
(6) |
Nov
(4) |
Dec
|
2004 |
Jan
|
Feb
|
Mar
(10) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Ilya M. <m_...@us...> - 2002-07-25 08:33:20
|
Update of /cvsroot/http-webtest/HTTP-WebTest/t In directory usw-pr-cvs1:/tmp/cvs-serv18535 Modified Files: 11-delay.t Log Message: Minor fixes Index: 11-delay.t =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/t/11-delay.t,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** 11-delay.t 19 Jun 2002 10:29:32 -0000 1.1 --- 11-delay.t 25 Jul 2002 08:33:16 -0000 1.2 *************** *** 29,40 **** { if(defined $ENV{TEST_FAST}) { ! skip('skip: delay tests are disabled', 1); ! skip('skip: delay tests are disabled', 1); } else { my $start = gettimeofday; my $tests = [ { url => abs_url($URL, '/test'), ! delay => 1 } ]; check_webtest(webtest => $WEBTEST, --- 29,53 ---- { + # run non-empty test once to trigger loading of all modules; + # otherwise next test run takes too much time (because of module + # loading) and breaks delay test + + my $output = ''; + + $WEBTEST->run_tests([ { url => abs_url($URL, '/test') } ], + { %$OPTS, + output_ref => \$output }); + } + + { if(defined $ENV{TEST_FAST}) { ! for (1..2) { ! skip('skip: delay tests are disabled', 1); ! } } else { my $start = gettimeofday; my $tests = [ { url => abs_url($URL, '/test'), ! delay => 2 } ]; check_webtest(webtest => $WEBTEST, *************** *** 44,49 **** check_file => 't/test.out/delay'); ! my $delay = int(((gettimeofday - $start) * 10 + 0.10) / 10); ! ok($delay == 1); } } --- 57,62 ---- check_file => 't/test.out/delay'); ! my $delay = gettimeofday - $start; ! ok(1 < $delay and $delay < 3); } } *************** *** 51,61 **** { if(defined $ENV{TEST_FAST}) { ! skip('skip: delay tests are disabled', 1); ! skip('skip: delay tests are disabled', 1); } else { my $start = gettimeofday; my $tests = [ { url => abs_url($URL, '/test'), ! delay => 2 } ]; check_webtest(webtest => $WEBTEST, --- 64,75 ---- { if(defined $ENV{TEST_FAST}) { ! for (1..2) { ! skip('skip: delay tests are disabled', 1); ! } } else { my $start = gettimeofday; my $tests = [ { url => abs_url($URL, '/test'), ! delay => 4 } ]; check_webtest(webtest => $WEBTEST, *************** *** 65,70 **** check_file => 't/test.out/delay'); ! my $delay = int(((gettimeofday - $start) * 10 + 0.10) / 10); ! ok($delay == 2); } } --- 79,84 ---- check_file => 't/test.out/delay'); ! my $delay = gettimeofday - $start; ! ok(3 < $delay and $delay < 5); } } |
From: Ilya M. <m_...@us...> - 2002-07-25 08:15:00
|
Update of /cvsroot/http-webtest/HTTP-WebTest In directory usw-pr-cvs1:/tmp/cvs-serv12996 Modified Files: TODO Log Message: Updated Index: TODO =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/TODO,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TODO 19 Jun 2002 10:30:19 -0000 1.14 --- TODO 25 Jul 2002 08:14:51 -0000 1.15 *************** *** 11,21 **** * polish local mode tests - they are *very* non portable now - * extended syntax of wtscript files which allows nested structures - - * support for file upload tests - * automated tests for mail sending ! * plugin for page validation with HTML::Validator * Generator of both Perl and wtscript code from test objects --- 11,17 ---- * polish local mode tests - they are *very* non portable now * automated tests for mail sending ! * plugin for page validation with HTML::Validator (HTML::Lint ? or both ?) * Generator of both Perl and wtscript code from test objects *************** *** 26,27 **** --- 22,25 ---- * Report plugin which stores all responses as local files. + + * Support including of test scripts into other test scripts |
From: Ilya M. <m_...@us...> - 2002-07-24 22:18:38
|
Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin In directory usw-pr-cvs1:/tmp/cvs-serv13588/lib/HTTP/WebTest/Plugin Modified Files: SetRequest.pm Log Message: Added docs on file upload tests Index: SetRequest.pm =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/SetRequest.pm,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SetRequest.pm 24 Jul 2002 21:16:33 -0000 1.12 --- SetRequest.pm 24 Jul 2002 22:18:36 -0000 1.13 *************** *** 58,67 **** A list of name/value pairs to be passed as parameters to the URL. (This element is used to test pages that process input from forms.) - Unless the method key is set to C<POST>, these pairs are URI-escaped - and appended to the requested URL. ! The names and values will be URI-escaped as defined by RFC 2396. ! =head3 Example url = http://www.hotmail.com/cgi-bin/hmhome --- 58,66 ---- A list of name/value pairs to be passed as parameters to the URL. (This element is used to test pages that process input from forms.) ! If the method key is set to C<GET>, these pairs are URI-escaped and ! appended to the requested URL. ! Example (wtscript file): url = http://www.hotmail.com/cgi-bin/hmhome *************** *** 71,77 **** HotMail ) ! generates the HTTP request: http://www.hotmail.com/cgi-bin/hmhome?curmbox=F001%20A005&from=HotMail =head2 auth --- 70,120 ---- HotMail ) ! generates the HTTP request with URI: http://www.hotmail.com/cgi-bin/hmhome?curmbox=F001%20A005&from=HotMail + + If the method key is set to C<POST>, as long as all values are scalars + they are URI-escaped and put into content of the HTTP request. + C<application/x-www-form-urlencoded> content type is set for such HTTP + request. + + If the method key is set to C<POST>, some values may be defined as + lists. In this case L<HTTP::WebTest|HTTP::WebTest> uses + C<multipart/form-data> content type used for C<Form-based File Upload> + as specified in RFC 1867. Each parameter with list value is treated + as file part specification specification with the following + interpretation: + + ( FILE, FILENAME, HEADER => VALUE... ) + + where + + =over 4 + + =item * FILE + + The name of a file to open. This file will be read and its content + placed in the request. + + =item * FILENAME + + The optional filename to be reported in the request. If it is not + specified than basename of C<FILE> is used. + + =item * HEADER => VALUE + + Additional optional headers for file part. + + Example (wtscript file): + + url = http://www.server.com/upload.pl + method = post + params = ( submit => ok + file => ( '/home/ilya/file.txt', 'myfile.txt' ) ) + + It generates HTTP request with C</home/ilya/file.txt> file included + and reported under name C<myfile.txt>. + + =back =head2 auth |
From: Ilya M. <m_...@us...> - 2002-07-24 22:18:15
|
Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest In directory usw-pr-cvs1:/tmp/cvs-serv13455/lib/HTTP/WebTest Modified Files: Request.pm Log Message: Support file uploads Index: Request.pm =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Request.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Request.pm 24 Jul 2002 21:15:26 -0000 1.2 --- Request.pm 24 Jul 2002 22:18:12 -0000 1.3 *************** *** 127,131 **** unless defined($self->method) and $self->method eq 'POST'; ! my $req = POST $self->uri, $self->params; # DANGER: EVIL HACK --- 127,142 ---- unless defined($self->method) and $self->method eq 'POST'; ! my $has_filepart = grep ref($_), @{$self->params}; ! ! my @post; ! if($has_filepart) { ! @post = ($self->uri, ! Content_Type => 'form-data', ! Content => $self->params); ! } else { ! @post = ($self->uri, $self->params); ! } ! ! my $req = POST @post; # DANGER: EVIL HACK |
From: Ilya M. <m_...@us...> - 2002-07-24 22:17:55
|
Update of /cvsroot/http-webtest/HTTP-WebTest In directory usw-pr-cvs1:/tmp/cvs-serv13279 Modified Files: MANIFEST Changes Log Message: Updated Index: MANIFEST =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/MANIFEST,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** MANIFEST 24 Jul 2002 21:13:09 -0000 1.18 --- MANIFEST 24 Jul 2002 22:17:47 -0000 1.19 *************** *** 100,103 **** --- 100,104 ---- t/test.out/default-report-yes t/test.out/delay + t/test.out/file-upload t/test.out/http-headers t/test.out/on_response Index: Changes =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/Changes,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Changes 24 Jul 2002 21:13:09 -0000 1.38 --- Changes 24 Jul 2002 22:17:47 -0000 1.39 *************** *** 21,24 **** --- 21,26 ---- specifications. See HTTP::WebTest::Plugin::Cookies for details. + * File upload tests are supported now. + INCOMPATIBILITIES: |
From: Ilya M. <m_...@us...> - 2002-07-24 22:17:55
|
Update of /cvsroot/http-webtest/HTTP-WebTest/t/test.out In directory usw-pr-cvs1:/tmp/cvs-serv13279/t/test.out Added Files: file-upload Log Message: Updated --- NEW FILE: file-upload --- Failed Succeeded Test Name 0 5 *** no name *** 0 5 *** no name *** 0 6 *** no name *** URL: http://http.web.test/show-request STATUS CODE CHECK 200 OK SUCCEED REQUIRED TEXT Method: <POST> SUCCEED Query: <> SUCCEED REQUIRED REGEX (?-xism:Content: <.*Content-Disposition: form-data; name="f SUCCEED (?-xism:Content: <.*29: test file uploading capability.*>) SUCCEED URL: http://http.web.test/show-request STATUS CODE CHECK 200 OK SUCCEED REQUIRED TEXT Method: <POST> SUCCEED Query: <> SUCCEED REQUIRED REGEX (?-xism:Content: <.*Content-Disposition: form-data; name="f SUCCEED (?-xism:Content: <.*29: test file uploading capability.*>) SUCCEED URL: http://http.web.test/show-request STATUS CODE CHECK 200 OK SUCCEED REQUIRED TEXT Method: <POST> SUCCEED Query: <> SUCCEED REQUIRED REGEX (?-xism:Content: <.*Content-Disposition: form-data; name="f SUCCEED (?-xism:Content: <.*Content-Type: foo/bar.*>) SUCCEED (?-xism:Content: <.*29: test file uploading capability.*>) SUCCEED Total web tests failed: 0 succeeded: 16 |
From: Ilya M. <m_...@us...> - 2002-07-24 22:17:55
|
Update of /cvsroot/http-webtest/HTTP-WebTest/t In directory usw-pr-cvs1:/tmp/cvs-serv13279/t Modified Files: 12-request.t 02-generic.t Log Message: Updated Index: 12-request.t =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/t/12-request.t,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** 12-request.t 24 Jul 2002 21:17:00 -0000 1.1 --- 12-request.t 24 Jul 2002 22:17:47 -0000 1.2 *************** *** 8,12 **** use Test; ! BEGIN { plan tests => 23 } use HTTP::WebTest::Request; --- 8,12 ---- use Test; ! BEGIN { plan tests => 25 } use HTTP::WebTest::Request; *************** *** 85,87 **** --- 85,97 ---- ok($REQUEST->uri eq 'http://a'); ok(${$REQUEST->content_ref} eq 'a=b'); + } + + # use array refs as param values and check if file upload request is + # created + { + $REQUEST->params([a => ['t/12-request.t']]); + $REQUEST->base_uri('http://a'); + $REQUEST->method('POST'); + ok($REQUEST->uri eq 'http://a'); + ok(${$REQUEST->content_ref} =~ 'Content-Disposition: form-data; name="a".*; filename="12-request.t'); } Index: 02-generic.t =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/t/02-generic.t,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** 02-generic.t 2 Jul 2002 22:44:38 -0000 1.10 --- 02-generic.t 24 Jul 2002 22:17:47 -0000 1.11 *************** *** 18,22 **** use vars qw($HOSTNAME $PORT $URL); ! BEGIN { plan tests => 28 } # init tests --- 18,22 ---- use vars qw($HOSTNAME $PORT $URL); ! BEGIN { plan tests => 29 } # init tests *************** *** 524,527 **** --- 524,560 ---- tests => $tests, check_file => 't/test.out/http-headers'); + } + + # 29: test file uploading capability + { + my $tests = [ { url => abs_url($URL, '/show-request'), + method => 'post', + params => [ file => [ 't/02-generic.t' ] ], + text_require => [ 'Method: <POST>', + 'Query: <>' ], + regex_require => [ qr|Content: <.*Content-Disposition: form-data; name="file".*; filename="t/02-generic.t">|, + qr/Content: <.*29: test file uploading capability.*>/ ] }, + { url => abs_url($URL, '/show-request'), + method => 'post', + params => [ file => [ 't/02-generic.t', 'test.txt' ] ], + text_require => [ 'Method: <POST>', + 'Query: <>' ], + regex_require => [ qr|Content: <.*Content-Disposition: form-data; name="file".*; filename="test.txt">|, + qr/Content: <.*29: test file uploading capability.*>/ ] }, + { url => abs_url($URL, '/show-request'), + method => 'post', + params => [ file => [ 't/02-generic.t', undef, + 'Content-Type' => 'foo/bar' ] ], + text_require => [ 'Method: <POST>', + 'Query: <>' ], + regex_require => [ qr|Content: <.*Content-Disposition: form-data; name="file".*; filename="test.txt">|, + qr|Content: <.*Content-Type: foo/bar.*>|, + qr/Content: <.*29: test file uploading capability.*>/ ] }, + ]; + + check_webtest(webtest => $WEBTEST, + server_url => $URL, + tests => $tests, + check_file => 't/test.out/file-upload'); } |
From: Ilya M. <m_...@us...> - 2002-07-24 21:17:03
|
Update of /cvsroot/http-webtest/HTTP-WebTest/t In directory usw-pr-cvs1:/tmp/cvs-serv19199/t Added Files: 12-request.t Log Message: Added --- NEW FILE: 12-request.t --- #!/usr/bin/perl -w # $Id: 12-request.t,v 1.1 2002/07/24 21:17:00 m_ilya Exp $ # Unit tests for HTTP::WebTest::Request use strict; use Test; BEGIN { plan tests => 23 } use HTTP::WebTest::Request; # test constructor my $REQUEST; { $REQUEST = HTTP::WebTest::Request->new; ok(defined $REQUEST); ok($REQUEST->isa('HTTP::WebTest::Request')); ok($REQUEST->isa('HTTP::Request')); } # test base_uri() and uri() { for my $uri qw(http://test1 http://a.a.a http://www.a.b) { $REQUEST->base_uri($uri); ok($REQUEST->base_uri eq $uri); ok($REQUEST->uri eq $uri); } } # check that uri() returns URI object { $REQUEST->base_uri('http://test2'); my $uri = $REQUEST->uri; ok($uri->isa('URI')); ok($uri->host eq 'test2'); } # check that alias url() work too { $REQUEST->base_uri('http://test3'); my $uri = $REQUEST->url; ok($uri->isa('URI')); ok($uri->host eq 'test3'); } # set/get query params via params() { # default value ok(join(' ', @{$REQUEST->params}) eq ''); $REQUEST->params([a => 'b']); ok(join(' ', @{$REQUEST->params}) eq 'a b'); $REQUEST->params([d => 'xy', 1 => 2]); ok(join(' ', @{$REQUEST->params}) eq 'd xy 1 2'); } # test setting uri via uri() { $REQUEST->base_uri('http://a'); $REQUEST->uri('http://b'); ok($REQUEST->uri eq 'http://b'); $REQUEST->uri('http://c?x=y'); ok($REQUEST->uri eq 'http://c'); ok(join(' ', @{$REQUEST->params}) eq 'x y'); } # set some params and watch uri() to change for GET request { $REQUEST->params([a => 'b']); $REQUEST->base_uri('http://a'); $REQUEST->method('GET'); ok($REQUEST->uri eq 'http://a?a=b'); ok(${$REQUEST->content_ref} eq ''); } # set some params and watch content_ref() to change for POST request { $REQUEST->params([a => 'b']); $REQUEST->base_uri('http://a'); $REQUEST->method('POST'); ok($REQUEST->uri eq 'http://a'); ok(${$REQUEST->content_ref} eq 'a=b'); } |
From: Ilya M. <m_...@us...> - 2002-07-24 21:16:36
|
Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin In directory usw-pr-cvs1:/tmp/cvs-serv18977/lib/HTTP/WebTest/Plugin Modified Files: SetRequest.pm Click.pm Log Message: Fixes required to make plugins work with HTTP::WebTest::Request Index: SetRequest.pm =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/SetRequest.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SetRequest.pm 21 Jun 2002 06:48:16 -0000 1.11 --- SetRequest.pm 24 Jul 2002 21:16:33 -0000 1.12 *************** *** 166,182 **** # set request params if(defined $params) { - # We use a temporary URI object to format - # the application/x-www-form-urlencoded content. - my $url = URI->new('http:'); my @params = ref($params) eq 'ARRAY' ? @$params : %$params; ! $url->query_form(@params); ! my $query = $url->query; ! ! if($request->method eq 'GET') { ! $request->uri->query($query); ! } elsif($request->method eq 'POST') { ! $request->content($query); ! $request->header('Content-Length' => length $query); ! } } --- 166,171 ---- # set request params if(defined $params) { my @params = ref($params) eq 'ARRAY' ? @$params : %$params; ! $request->params(\@params); } Index: Click.pm =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/Click.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Click.pm 21 Jun 2002 06:48:16 -0000 1.11 --- Click.pm 24 Jul 2002 21:16:33 -0000 1.12 *************** *** 95,99 **** pattern => $click_link); ! $self->new_request_uri(request => $request, uri => $link) if defined $link; } elsif(defined $click_button) { --- 95,99 ---- pattern => $click_link); ! $request->base_uri($link) if defined $link; } elsif(defined $click_button) { *************** *** 102,129 **** pattern => $click_button); ! $self->new_request_uri(request => $request, uri => $action) if defined $action; - } - } - - # sets new request URI preserving query parameters if necessary - sub new_request_uri { - my $self = shift; - my %param = @_; - - my $request = $param{request}; - my $uri = $param{uri}; - - my $old_query = undef; - if($request->method eq 'GET') { - $old_query = $request->uri->query; - } - # set request uri - $request->uri($uri); - # restore query parameters - if(defined $old_query) { - my $new_query = $request->uri->query; - $new_query = defined $new_query ? "$new_query&$old_query" : $old_query; - $request->uri->query($new_query); } } --- 102,107 ---- pattern => $click_button); ! $request->base_uri($action) if defined $action; } } |
From: Ilya M. <m_...@us...> - 2002-07-24 21:15:28
|
Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest In directory usw-pr-cvs1:/tmp/cvs-serv18530/lib/HTTP/WebTest Modified Files: Request.pm Log Message: Implemented Index: Request.pm =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Request.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Request.pm 4 Jul 2002 22:39:17 -0000 1.1 --- Request.pm 24 Jul 2002 21:15:26 -0000 1.2 *************** *** 62,65 **** --- 62,70 ---- use base qw(HTTP::Request); + use HTTP::Request::Common; + use URI; + + use HTTP::WebTest::Utils qw(make_access_method); + =head2 base_uri($optional_uri) *************** *** 73,83 **** =cut ! sub base_uri { ! } ! =head2 uri ! Method C<uri> is redefined and it is not allowed to be used as setter ! anymore. =head3 Returns --- 78,87 ---- =cut ! sub base_uri { shift->SUPER::uri(@_) } ! =head2 uri($optional_uri) ! Method C<uri> is redefined. It is same as C<base_uri> for non-GET ! request. For GET requests it returns URI with query parameters. =head3 Returns *************** *** 88,91 **** --- 92,142 ---- sub uri { + my $self = shift; + + if(@_) { + $self->base_uri(@_); + my $new_uri = $self->base_uri; + if(defined $new_uri) { + my @params = $new_uri->query_form; + $new_uri->query(undef); + $self->params(\@params); + } + } + + my $uri = $self->base_uri; + + $uri->query_form(@{$self->params}) + if defined($self->method) and $self->method eq 'GET'; + + return $uri; + } + + *url = \&uri; + + =head2 content_ref + + Method C<content_ref> is redefined. For POST requests it returns POST + query content corresponding to query parameters. + + =cut + + sub content_ref { + my $self = shift; + + return $self->SUPER::content_ref + unless defined($self->method) and $self->method eq 'POST'; + + my $req = POST $self->uri, $self->params; + + # DANGER: EVIL HACK + for my $header qw(Content-Type Content-Length) { + if(defined $header) { + $self->header($header => $req->header($header)); + } else { + $self->remove_header($header); + } + } + + return $req->content_ref; } *************** *** 101,106 **** =cut ! sub params { ! } =head1 COPYRIGHT --- 152,156 ---- =cut ! *params = make_access_method('PARAMS', sub { [] }); =head1 COPYRIGHT |
From: Ilya M. <m_...@us...> - 2002-07-24 21:14:55
|
Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest In directory usw-pr-cvs1:/tmp/cvs-serv18282/lib/HTTP/WebTest Modified Files: API.pm Log Message: Use HTTP::WebTest::Request instead of HTTP::Request Index: API.pm =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/API.pm,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** API.pm 4 Jul 2002 22:41:29 -0000 1.19 --- API.pm 24 Jul 2002 21:14:52 -0000 1.20 *************** *** 31,35 **** use strict; - use HTTP::Request; use IO::File; use LWP::UserAgent; --- 31,34 ---- *************** *** 39,42 **** --- 38,42 ---- use HTTP::WebTest::Utils qw(make_access_method load_package); use HTTP::WebTest::Plugin; + use HTTP::WebTest::Request; use HTTP::WebTest::Test; *************** *** 304,308 **** Get access to L<LWP::UserAgent|LWP::UserAgent>, ! L<HTTP::Request|HTTP::Request>, L<HTTP::Response|HTTP::Response> and other objects used by C<HTTP::WebTest> during runing test sequence. --- 304,309 ---- Get access to L<LWP::UserAgent|LWP::UserAgent>, ! L<HTTP::WebTest::Request|HTTP::WebTest::Request>, ! L<HTTP::Response|HTTP::Response> and other objects used by C<HTTP::WebTest> during runing test sequence. *************** *** 470,474 **** =head3 Returns ! The L<HTTP::Request|HTTP::Request> object used in last test. =cut --- 471,475 ---- =head3 Returns ! The L<HTTP::WebTest::Request|HTTP::WebTest::Request> object used in last test. =cut *************** *** 540,544 **** # create request (note that actual uri is more likely to be # set in plugins) ! my $request = HTTP::Request->new('GET' => 'http://MISSING_HOSTNAME/'); $self->last_request($request); --- 541,546 ---- # create request (note that actual uri is more likely to be # set in plugins) ! my $request = HTTP::WebTest::Request->new('GET' => ! 'http://MISSING_HOSTNAME/'); $self->last_request($request); *************** *** 739,745 **** L<HTTP::WebTest::Plugins|HTTP::WebTest::Plugins> ! L<LWP::UserAgent|LWP::UserAgent> ! L<HTTP::Request|HTTP::Request> L<HTTP::Response|HTTP::Response> --- 741,747 ---- L<HTTP::WebTest::Plugins|HTTP::WebTest::Plugins> ! L<HTTP::WebTest::Request|HTTP::WebTest::Request> ! L<LWP::UserAgent|LWP::UserAgent> L<HTTP::Response|HTTP::Response> |
From: Ilya M. <m_...@us...> - 2002-07-24 21:13:19
|
Update of /cvsroot/http-webtest/HTTP-WebTest In directory usw-pr-cvs1:/tmp/cvs-serv17570 Modified Files: MANIFEST Changes Log Message: Updated Index: MANIFEST =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/MANIFEST,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** MANIFEST 4 Jul 2002 22:40:44 -0000 1.17 --- MANIFEST 24 Jul 2002 21:13:09 -0000 1.18 *************** *** 51,54 **** --- 51,55 ---- t/10-click.t t/11-delay.t + t/12-request.t t/HTTP/WebTest/Plugin/Counter.pm t/HelloWorld.pm Index: Changes =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/Changes,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Changes 2 Jul 2002 22:56:44 -0000 1.37 --- Changes 24 Jul 2002 21:13:09 -0000 1.38 *************** *** 21,24 **** --- 21,34 ---- specifications. See HTTP::WebTest::Plugin::Cookies for details. + INCOMPATIBILITIES: + + * HTTP::WebTest now uses HTTP::WebTest::Request instead of + HTTP::Request. It is inherited from HTTP::Request and supports notion + of query parameters. This change simplifies writting plugins than may + need to change them but existing plugins which change query parameters + via HTTP::Request methods 'content' and 'uri' are likely to be broken + by this change. If you use such plugins change them to use + HTTP::WebTest::Request's method 'params'. + DEPRECATIONS: |
From: Ilya M. <m_...@us...> - 2002-07-04 22:41:32
|
Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest In directory usw-pr-cvs1:/tmp/cvs-serv7101/lib/HTTP/WebTest Modified Files: API.pm Log Message: Minor fixes Index: API.pm =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/API.pm,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** API.pm 28 Jun 2002 16:16:45 -0000 1.18 --- API.pm 4 Jul 2002 22:41:29 -0000 1.19 *************** *** 355,359 **** =head3 Returns ! A new L<LWP::UserAgent|LWP::UserAgent> object, initialized with default settings. --- 355,359 ---- =head3 Returns ! A new L<LWP::UserAgent|LWP::UserAgent> object, initialized with default settings. |
From: Ilya M. <m_...@us...> - 2002-07-04 22:40:47
|
Update of /cvsroot/http-webtest/HTTP-WebTest In directory usw-pr-cvs1:/tmp/cvs-serv6963 Modified Files: MANIFEST Log Message: Updated Index: MANIFEST =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/MANIFEST,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** MANIFEST 2 Jul 2002 22:42:57 -0000 1.16 --- MANIFEST 4 Jul 2002 22:40:44 -0000 1.17 *************** *** 32,35 **** --- 32,36 ---- lib/HTTP/WebTest/Plugins.pod lib/HTTP/WebTest/ReportPlugin.pm + lib/HTTP/WebTest/Request.pm lib/HTTP/WebTest/Test.pm lib/HTTP/WebTest/TestResult.pm |
From: Ilya M. <m_...@us...> - 2002-07-04 22:39:58
|
Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest In directory usw-pr-cvs1:/tmp/cvs-serv6794 Modified Files: Test.pm Log Message: Minor POD fixes Index: Test.pm =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Test.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Test.pm 21 Jun 2002 06:48:16 -0000 1.5 --- Test.pm 4 Jul 2002 22:39:56 -0000 1.6 *************** *** 105,109 **** =head3 Returns ! A reference to an array which contains L<HTTP::WebTest::TestResult|HTTP::WebTest::TestResult> objects. --- 105,109 ---- =head3 Returns ! A reference to an array that contains L<HTTP::WebTest::TestResult|HTTP::WebTest::TestResult> objects. |
From: Ilya M. <m_...@us...> - 2002-07-04 22:39:27
|
Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest In directory usw-pr-cvs1:/tmp/cvs-serv6718 Added Files: Request.pm Log Message: Added (unfinished) --- NEW FILE: Request.pm --- # $Id: Request.pm,v 1.1 2002/07/04 22:39:17 m_ilya Exp $ package HTTP::WebTest::Request; =head1 NAME HTTP::WebTest::Request - HTTP request objects =head1 SYNOPSIS use HTTP::WebTest::Request; $request = HTTP::WebTest::Request->new; my $uri = $request->uri; $request->base_uri($base_uri); my $base_uri = $request->base_uri; my @params = @{$request->params}; $request->params([@params]); =head1 DESCRIPTION This class is a subclass of L<HTTP::Request|HTTP::Request> class. It extends it with continence methods that allow to set or get CGI query params for HTTP request in uniform way independent of HTTP request method. Each URI in GET requests may consist of two portions: URI of document/resource/etc and CGI query string. In L<HTTP::Request|HTTP::Request> method C<uri> doesn't separate them and operates on them as on single entity. In C<HTTP::WebTest::Request> method C<uri> is not allowed to modify HTTP request URI. Instead of it methods C<base_uri> and C<params> should be used to change or get these parts independently. For POST requests method C<base_uri> acts simular to C<uri>. On the other hand C<params> set content of HTTP request in case of POST requests. CGI request parameters are defined in the way similar to CGI request parameters defenition in L<HTTP::Request::Common|HTTP::Request::Common>. It is an array of pairs ( name1 => value1, name2 => value2, ..., nameN => valueN ) If any value is passed as an array reference it is treated as file upload. See L<HTTP::Request::Common|HTTP::Request::Common> for more details. By default GET type of HTTP request is assumed. But if CGI request parameters have data for file upload then POST type of HTTP request is assumed. =head1 CLASS METHODS =cut use strict; use base qw(HTTP::Request); =head2 base_uri($optional_uri) Can set non CGI query portion of request URI if C<$optional_uri> is passed. =head3 Returns Non CGI query portion of request URI. =cut sub base_uri { } =head2 uri Method C<uri> is redefined and it is not allowed to be used as setter anymore. =head3 Returns Whole URI. =cut sub uri { } =head2 params($optional_params) Can set CGI request parameters for this HTTP request object if an array reference C<$optional_params> is passed. =head3 Returns An reference to an array that contains CGI request parameters. =cut sub params { } =head1 COPYRIGHT Copyright (c) 2001-2002 Ilya Martynov. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO L<HTTP::WebTest|HTTP::WebTest> L<HTTP::WebTest::API|HTTP::WebTest::API> L<HTTP::Request|HTTP::Request> L<HTTP::Request::Common|HTTP::Request::Common> =cut 1; |
From: Ilya M. <m_...@us...> - 2002-07-02 22:56:47
|
Update of /cvsroot/http-webtest/HTTP-WebTest In directory usw-pr-cvs1:/tmp/cvs-serv6357 Modified Files: Changes Log Message: Updated Index: Changes =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/Changes,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Changes 2 Jul 2002 22:55:31 -0000 1.36 --- Changes 2 Jul 2002 22:56:44 -0000 1.37 *************** *** 10,14 **** * License change: previously HTTP-WebTest have been licensed under ! terms of Artistic license. Starting from this release HTTP-WebTest is dual licensed under terms of GPL/Artistic licenses like Perl itself. --- 10,14 ---- * License change: previously HTTP-WebTest have been licensed under ! terms of Artistic license. Starting from this release HTTP-WebTest is dual licensed under terms of GPL/Artistic licenses like Perl itself. *************** *** 19,23 **** * 'cookies' parameter supports new named style of cookie ! specifications. See HTTP::WebTest::Plugin::Cookies for details. DEPRECATIONS: --- 19,23 ---- * 'cookies' parameter supports new named style of cookie ! specifications. See HTTP::WebTest::Plugin::Cookies for details. DEPRECATIONS: |
From: Ilya M. <m_...@us...> - 2002-07-02 22:55:34
|
Update of /cvsroot/http-webtest/HTTP-WebTest In directory usw-pr-cvs1:/tmp/cvs-serv5548 Modified Files: Changes Log Message: Updated Index: Changes =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/Changes,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Changes 22 Jun 2002 20:31:26 -0000 1.35 --- Changes 2 Jul 2002 22:55:31 -0000 1.36 *************** *** 18,21 **** --- 18,31 ---- parameters. + * 'cookies' parameter supports new named style of cookie + specifications. See HTTP::WebTest::Plugin::Cookies for details. + + DEPRECATIONS: + + * Parameter 'cookie' is deprecated. Use 'cookies' intead of it. + + * Old style of cookie specifications with 'cookies' parameter is + deprecated. + 1.99_07 Sun Jun 16 2002 |
From: Ilya M. <m_...@us...> - 2002-07-02 22:48:40
|
Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP In directory usw-pr-cvs1:/tmp/cvs-serv32731/lib/HTTP Modified Files: WebTest.pm Log Message: Regenerated Index: WebTest.pm =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest.pm,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** WebTest.pm 22 Jun 2002 20:07:37 -0000 1.22 --- WebTest.pm 2 Jul 2002 22:48:37 -0000 1.23 *************** *** 234,239 **** =back ! Parameters are either scalar (single-valued) or lists (single or ! multi-valued). You can specify scalar parameters using forms such as: --- 234,239 ---- =back ! Parameters are either scalar (single-valued) or lists (single-valued, ! multi-valued or nested). You can specify scalar parameters using forms such as: *************** *** 268,271 **** --- 268,286 ---- ) + Lists can be nested. For example: + + name = ( ( first value + second value ) ) + + name = ( 'third value' + ( fourth value => fifth value ) ) + + name = ( + ( first value + second value ) + third value + ( fourth value => fifth value ) + ) + You can specify a null (placeholder) value using '' or "". Within single or double quotes, the usual Perl string quoting rules apply. *************** *** 283,287 **** brackets are used to denote Perl code inside wtscript files. C<HTTP::WebTest> compiles this Perl code as anonymous subroutines ! which are called when value of corresponding test parameters are required. These subroutines are called in an object-oriented fashion, so the --- 298,302 ---- brackets are used to denote Perl code inside wtscript files. C<HTTP::WebTest> compiles this Perl code as anonymous subroutines ! which are called when values of corresponding test parameters are required. These subroutines are called in an object-oriented fashion, so the *************** *** 293,297 **** name = { 1 + 1 } ! # element of a list name = ( 'first value' --- 308,312 ---- name = { 1 + 1 } ! # element of a list name = ( 'first value' *************** *** 377,381 **** passed in a hash passed as the second argument. ! Subroutine references can be specified instead of test parameter values. Referenced subroutines are called during test run when values of corresponding test parameters are required. These subroutines are --- 392,396 ---- passed in a hash passed as the second argument. ! Subroutine references can be specified instead of test parameter values. Referenced subroutines are called during test run when values of corresponding test parameters are required. These subroutines are *************** *** 652,675 **** Synonym to C<cookies>. =head2 cookies ! Specifies a cookie(s) to send to the web server. Each cookie is specified by following list: ! ( version ! name ! value ! path ! domain ! port ! path_spec ! secure ! maxage ! discard ! name1 ! value1 ! name2 ! value2 ... ) --- 667,850 ---- Synonym to C<cookies>. + It is deprecated parameter and may be removed in future versions of + L<HTTP::WebTest|HTTP::WebTest>. + =head2 cookies ! This is a list parameter that specifies cookies to send to the web ! server: ! ! cookies = ( cookie1_spec ! cookie2_spec ! ... ! cookieN_spec ) ! ! Currently there are two ways to specify a cookie. ! ! =over 4 ! ! =item * Named style ! ! A cookie is specified by a set of C<param =E<gt> value> pairs: ! ! ( ! param => value ! ... ! ) ! ! List of all supported C<param =E<gt> value> pairs: ! ! =over 4 ! ! =item version => VERSION ! ! Version number of cookie spec to use, usually 0. ! ! =item name => NAME (REQUIRED) ! ! Name of cookie. Cannot begin with a $ character. ! ! =item value => VALUE (REQUIRED) ! ! Value of cookie. ! ! =item path => PATH (REQUIRED) ! ! URL path name for which this cookie applies. Must begin with a / ! character. See also path_spec. ! ! =item domain => DOMAIN (REQUIRED) ! ! Domain for which cookie is valid. Must either contain two periods or ! be equal to C<.local>. ! ! =item port => PORT ! ! List of allowed port numbers that the cookie may be returned to. If ! not specified, cookie can be returned to any port. Must be specified ! using the format C<N> or C<N, N, ..., N> where N is one or more ! digits. ! ! =item path_spec => PATH_SPEC ! ! Ignored if version is less than 1. Option to ignore the value of ! path. Default value is 0. ! ! =over 4 ! ! =item * 1 ! ! Use the value of path. ! ! =item * 0 ! ! Ignore the specified value of path. ! ! =back ! ! =item secure => SECURE ! ! Option to require secure protocols for cookie transmission. Default ! value is 0. ! ! =over 4 ! ! =item * 1 ! ! Use only secure protocols to transmit this cookie. ! ! =item * 0 ! ! Secure protocols are not required for transmission. ! ! =back ! ! =item maxage => MAXAGE ! ! Number of seconds until cookie expires. ! ! =item discard => DISCARD ! ! Option to discard cookie when the program finishes. Default is 0. ! (The cookie will be discarded regardless of the value of this ! element.) ! ! =over 4 ! ! =item * 1 ! ! Discard cookie when the program finishes. ! ! =item * 0 ! ! Don't discard cookie. ! ! =back ! ! =item rest => NAME_VALUE_LIST ! ! Defines additional cookie attributes. ! ! Zero, one or several name/value pairs may be specified. The name ! parameters are words such as Comment or CommentURL and the value ! parameters are strings that may contain embedded blanks. ! ! =back ! ! Example (wtscript file): ! ! cookies = ( ( name => Cookie1 ! value => cookie value ) ! ! ( name => Cookie2 ! value => cookie value ! path => / ! domain => .company.com ) ) ! ! ( name => Cookie2 ! value => cookie value ! rest => ( Comment => this is a comment ) ) ! ! Example (Perl script): ! ! my $tests = [ ! ... ! { ! test_name => 'cookie', ! cookies => [ [ ! name => 'Cookie1', ! value => 'Value', ! ], ! [ ! name => 'Cookie2', ! value => 'Value', ! path => '/', ! ] ], ! ... ! } ! ... ! ] ! ! =item * Row list style ! ! This style of cookie specification is deprecated and may be removed in ! future versions of L<HTTP::WebTest|HTTP::WebTest>. Each cookie is specified by following list: ! ( VERSION ! NAME ! VALUE ! PATH ! DOMAIN ! PORT ! PATH_SPEC ! SECURE ! MAXAGE ! DISCARD ! NAME1 ! VALUE1 ! NAME2 ! VALUE2 ... ) *************** *** 681,707 **** =over 4 ! =item * version (REQUIRED) Version number of cookie spec to use, usually 0. ! =item * name (REQUIRED) Name of cookie. Cannot begin with a $ character. ! =item * value (REQUIRED) Value of cookie. ! =item * path (REQUIRED) URL path name for which this cookie applies. Must begin with a / character. See also path_spec. ! =item * domain (REQUIRED) ! Domain for which cookie is valid. (REQUIRED). Should begin with a ! period. Must either contain two periods or be equal to C<.local>. ! =item * port List of allowed port numbers that the cookie may be returned to. If --- 856,882 ---- =over 4 ! =item * VERSION (REQUIRED) Version number of cookie spec to use, usually 0. ! =item * NAME (REQUIRED) Name of cookie. Cannot begin with a $ character. ! =item * VALUE (REQUIRED) Value of cookie. ! =item * PATH (REQUIRED) URL path name for which this cookie applies. Must begin with a / character. See also path_spec. ! =item * DOMAIN (REQUIRED) ! Domain for which cookie is valid. Must either contain two periods or ! be equal to C<.local>. ! =item * PORT List of allowed port numbers that the cookie may be returned to. If *************** *** 710,714 **** digits. ! =item * path_spec Ignored if version is less than 1. Option to ignore the value of --- 885,889 ---- digits. ! =item * PATH_SPEC Ignored if version is less than 1. Option to ignore the value of *************** *** 727,731 **** =back ! =item * secure Option to require secure protocols for cookie transmission. Default --- 902,906 ---- =back ! =item * SECURE Option to require secure protocols for cookie transmission. Default *************** *** 744,752 **** =back ! =item * maxage Number of seconds until cookie expires. ! =item * discard Option to discard cookie when the program finishes. Default is 0. --- 919,927 ---- =back ! =item * MAXAGE Number of seconds until cookie expires. ! =item * DISCARD Option to discard cookie when the program finishes. Default is 0. *************** *** 776,805 **** An example cookie would look like: ! ( 0 ! WebTest cookie #1 ! expires&2592000&type&consumer ! / ! .mycompany.com ! '' ! 0 ! 0 ! 200 ! 1 ! ) ! ! See RFC 2965 for details (ftp://ftp.isi.edu/in-notes/rfc2965.txt). ! ! =head3 Usage in wtscript files ! ! You may specify multiple cookies within each test block by specifying ! multiple instances of the C<cookies> parameter. ! ! =head3 Usage in Perl scripts ! Use an arrayref of arrayrefs containing cookies to pass with the HTTP ! request. ! Each array must have at least 5 elements; if the number of elements is ! over 10 it must have an even number of elements. =head2 default_report --- 951,969 ---- An example cookie would look like: ! cookies = ( ( 0 ! WebTest cookie #1 ! cookie value ! / ! .mycompany.com ! '' ! 0 ! 0 ! 200 ! 1 ! ) ) ! =back ! See RFC 2965 for details (ftp://ftp.isi.edu/in-notes/rfc2965.txt). =head2 default_report *************** *** 1322,1326 **** This module have been tested only on Unix (e.g., Solaris, Linux, AIX, ! etc.) but it should work on Win32 systems. (Exception: local file tests don't work on Win32 systems.) The module's HTTP requests time out after 3 minutes (the default value --- 1486,1490 ---- This module have been tested only on Unix (e.g., Solaris, Linux, AIX, ! etc.) but it should work on Win32 systems. (Exception: local file tests don't work on Win32 systems.) The module's HTTP requests time out after 3 minutes (the default value *************** *** 1345,1349 **** You can sign up at http://lists.sourceforge.net/lists/listinfo/http-webtest-general. ! The email address is C<htt...@li...>. =head1 COPYRIGHT --- 1509,1513 ---- You can sign up at http://lists.sourceforge.net/lists/listinfo/http-webtest-general. ! The email address is C<htt...@li...>. =head1 COPYRIGHT |
From: Ilya M. <m_...@us...> - 2002-07-02 22:47:21
|
Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin In directory usw-pr-cvs1:/tmp/cvs-serv31644/lib/HTTP/WebTest/Plugin Modified Files: Apache.pm Log Message: Minor fixes Index: Apache.pm =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/Apache.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Apache.pm 21 Jun 2002 06:48:16 -0000 1.6 --- Apache.pm 2 Jul 2002 22:47:18 -0000 1.7 *************** *** 578,584 **** or die "HTTP::WebTest: Can't kill Apache PID=$apache_pid: $!"; ! while(1) { my $pid = wait; ! last if $pid == -1 or $pid == $apache_pid; } } --- 578,584 ---- or die "HTTP::WebTest: Can't kill Apache PID=$apache_pid: $!"; ! { my $pid = wait; ! redo unless $pid == -1 or $pid == $apache_pid; } } |
From: Ilya M. <m_...@us...> - 2002-07-02 22:45:11
|
Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin In directory usw-pr-cvs1:/tmp/cvs-serv30499/lib/HTTP/WebTest/Plugin Modified Files: Cookies.pm Log Message: New cookie spec format Index: Cookies.pm =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/Cookies.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Cookies.pm 21 Jun 2002 06:48:16 -0000 1.5 --- Cookies.pm 2 Jul 2002 22:45:08 -0000 1.6 *************** *** 72,95 **** Synonym to C<cookies>. =head2 cookies ! Specifies a cookie(s) to send to the web server. Each cookie is specified by following list: ! ( version ! name ! value ! path ! domain ! port ! path_spec ! secure ! maxage ! discard ! name1 ! value1 ! name2 ! value2 ... ) --- 72,255 ---- Synonym to C<cookies>. + It is deprecated parameter and may be removed in future versions of + L<HTTP::WebTest|HTTP::WebTest>. + =head2 cookies ! This is a list parameter that specifies cookies to send to the web ! server: ! ! cookies = ( cookie1_spec ! cookie2_spec ! ... ! cookieN_spec ) ! ! Currently there are two ways to specify a cookie. ! ! =over 4 ! ! =item * Named style ! ! A cookie is specified by a set of C<param =E<gt> value> pairs: ! ! ( ! param => value ! ... ! ) ! ! List of all supported C<param =E<gt> value> pairs: ! ! =over 4 ! ! =item version => VERSION ! ! Version number of cookie spec to use, usually 0. ! ! =item name => NAME (REQUIRED) ! ! Name of cookie. Cannot begin with a $ character. ! ! =item value => VALUE (REQUIRED) ! ! Value of cookie. ! ! =item path => PATH (REQUIRED) ! ! URL path name for which this cookie applies. Must begin with a / ! character. See also path_spec. ! ! =item domain => DOMAIN (REQUIRED) ! ! Domain for which cookie is valid. Must either contain two periods or ! be equal to C<.local>. ! ! =item port => PORT ! ! List of allowed port numbers that the cookie may be returned to. If ! not specified, cookie can be returned to any port. Must be specified ! using the format C<N> or C<N, N, ..., N> where N is one or more ! digits. ! ! =item path_spec => PATH_SPEC ! ! Ignored if version is less than 1. Option to ignore the value of ! path. Default value is 0. ! ! =over 4 ! ! =item * 1 ! ! Use the value of path. ! ! =item * 0 ! ! Ignore the specified value of path. ! ! =back ! ! =item secure => SECURE ! ! Option to require secure protocols for cookie transmission. Default ! value is 0. ! ! =over 4 ! ! =item * 1 ! ! Use only secure protocols to transmit this cookie. ! ! =item * 0 ! ! Secure protocols are not required for transmission. ! ! =back ! ! =item maxage => MAXAGE ! ! Number of seconds until cookie expires. ! ! =item discard => DISCARD ! ! Option to discard cookie when the program finishes. Default is 0. ! (The cookie will be discarded regardless of the value of this ! element.) ! ! =over 4 ! ! =item * 1 ! ! Discard cookie when the program finishes. ! ! =item * 0 ! ! Don't discard cookie. ! ! =back ! ! =item rest => NAME_VALUE_LIST ! ! Defines additional cookie attributes. ! ! Zero, one or several name/value pairs may be specified. The name ! parameters are words such as Comment or CommentURL and the value ! parameters are strings that may contain embedded blanks. ! ! =back ! ! Example (wtscript file): ! ! cookies = ( ( name => Cookie1 ! value => cookie value ) ! ! ( name => Cookie2 ! value => cookie value ! path => / ! domain => .company.com ) ) ! ! ( name => Cookie2 ! value => cookie value ! rest => ( Comment => this is a comment ) ) ! ! Example (Perl script): ! ! my $tests = [ ! ... ! { ! test_name => 'cookie', ! cookies => [ [ ! name => 'Cookie1', ! value => 'Value', ! ], ! [ ! name => 'Cookie2', ! value => 'Value', ! path => '/', ! ] ], ! ... ! } ! ... ! ] ! ! =item * Row list style ! ! This style of cookie specification is deprecated and may be removed in ! future versions of L<HTTP::WebTest|HTTP::WebTest>. Each cookie is specified by following list: ! ( VERSION ! NAME ! VALUE ! PATH ! DOMAIN ! PORT ! PATH_SPEC ! SECURE ! MAXAGE ! DISCARD ! NAME1 ! VALUE1 ! NAME2 ! VALUE2 ... ) *************** *** 101,127 **** =over 4 ! =item * version (REQUIRED) Version number of cookie spec to use, usually 0. ! =item * name (REQUIRED) Name of cookie. Cannot begin with a $ character. ! =item * value (REQUIRED) Value of cookie. ! =item * path (REQUIRED) URL path name for which this cookie applies. Must begin with a / character. See also path_spec. ! =item * domain (REQUIRED) ! Domain for which cookie is valid. (REQUIRED). Should begin with a ! period. Must either contain two periods or be equal to C<.local>. ! =item * port List of allowed port numbers that the cookie may be returned to. If --- 261,287 ---- =over 4 ! =item * VERSION (REQUIRED) Version number of cookie spec to use, usually 0. ! =item * NAME (REQUIRED) Name of cookie. Cannot begin with a $ character. ! =item * VALUE (REQUIRED) Value of cookie. ! =item * PATH (REQUIRED) URL path name for which this cookie applies. Must begin with a / character. See also path_spec. ! =item * DOMAIN (REQUIRED) ! Domain for which cookie is valid. Must either contain two periods or ! be equal to C<.local>. ! =item * PORT List of allowed port numbers that the cookie may be returned to. If *************** *** 130,134 **** digits. ! =item * path_spec Ignored if version is less than 1. Option to ignore the value of --- 290,294 ---- digits. ! =item * PATH_SPEC Ignored if version is less than 1. Option to ignore the value of *************** *** 147,151 **** =back ! =item * secure Option to require secure protocols for cookie transmission. Default --- 307,311 ---- =back ! =item * SECURE Option to require secure protocols for cookie transmission. Default *************** *** 164,172 **** =back ! =item * maxage Number of seconds until cookie expires. ! =item * discard Option to discard cookie when the program finishes. Default is 0. --- 324,332 ---- =back ! =item * MAXAGE Number of seconds until cookie expires. ! =item * DISCARD Option to discard cookie when the program finishes. Default is 0. *************** *** 196,225 **** An example cookie would look like: ! ( 0 ! WebTest cookie #1 ! expires&2592000&type&consumer ! / ! .mycompany.com ! '' ! 0 ! 0 ! 200 ! 1 ! ) ! ! See RFC 2965 for details (ftp://ftp.isi.edu/in-notes/rfc2965.txt). ! ! =head3 Usage in wtscript files ! ! You may specify multiple cookies within each test block by specifying ! multiple instances of the C<cookies> parameter. ! ! =head3 Usage in Perl scripts ! Use an arrayref of arrayrefs containing cookies to pass with the HTTP ! request. ! Each array must have at least 5 elements; if the number of elements is ! over 10 it must have an even number of elements. =cut --- 356,374 ---- An example cookie would look like: ! cookies = ( ( 0 ! WebTest cookie #1 ! cookie value ! / ! .mycompany.com ! '' ! 0 ! 0 ! 200 ! 1 ! ) ) ! =back ! See RFC 2965 for details (ftp://ftp.isi.edu/in-notes/rfc2965.txt). =cut *************** *** 241,246 **** my $accept_cookies = $self->yesno_test_param('accept_cookies', 1); ! my $send_cookies = $self->yesno_test_param('send_cookies', 1); ! my $cookies = $self->test_param('cookies'); $cookies ||= $self->test_param('cookie'); # alias for parameter $cookies = $self->transform_cookies($cookies) if defined $cookies; --- 390,396 ---- my $accept_cookies = $self->yesno_test_param('accept_cookies', 1); ! my $send_cookies = $self->yesno_test_param('send_cookies', 1); ! my $cookies = $self->test_param('cookies'); ! $cookies ||= $self->test_param('cookie'); # alias for parameter $cookies = $self->transform_cookies($cookies) if defined $cookies; *************** *** 275,301 **** my $cookies = shift; ! # check if $cookies is list of list unless(ref($$cookies[0]) eq 'ARRAY') { return $self->transform_cookies([ $cookies ]); } ! my @new_cookies = (); for my $cookie (@$cookies) { ! # make copy of cookie (missing fields are set to undef) ! my @new_cookie = @$cookie[0 .. NCOOKIE_REFORMAT - 1]; ! # replace '' with undef ! @new_cookie = map +(defined($_) and $_ eq '') ? (undef) : $_, ! @new_cookie; ! # collect all additional attributes (name, value pairs) ! my @extra = @$cookie[ NCOOKIE_REFORMAT .. @$cookie - 1]; ! push @new_cookie, { @extra }; ! push @new_cookies, \@new_cookie; } ! return \@new_cookies; } --- 425,506 ---- my $cookies = shift; ! # check if $cookies is array of arrays unless(ref($$cookies[0]) eq 'ARRAY') { return $self->transform_cookies([ $cookies ]); } ! my @cookies = (); for my $cookie (@$cookies) { ! # simple heuristic to distinguish deprecated format from new: ! # in new format $cookie->[0] cannot be a number while it is ! # expected for deprecated ! if($cookie->[0] =~ /^ \d* $/x) { ! $cookie = $self->transform_cookie_deprecated($cookie); ! } else { ! $cookie = $self->transform_cookie($cookie); ! } ! die "HTTP::WebTest: missing cookie name" ! unless defined $cookie->[1]; ! die "HTTP::WebTest: missing cookie path" ! unless defined $cookie->[3]; ! die "HTTP::WebTest: missing cookie domain" ! unless defined $cookie->[4]; ! push @cookies, $cookie; ! } ! return \@cookies; ! } ! ! # transform cookie to the canonic representation (a list expected by ! # HTTP::Cookie::set_cookie) ! sub transform_cookie { ! my $self = shift; ! my $cookie = shift; ! ! my %fields = ( version => 0, ! name => 1, ! value => 2, ! path => 3, ! domain => 4, ! port => 5, ! path_spec => 6, ! secure => 7, ! expires => 8, ! discard => 9, ! rest => 10 ); ! ! my @canonic = (); ! my %cookie = @$cookie; ! while(my($field, $value) = each %cookie) { ! $canonic[$fields{$field}] = $value; } ! # convert rest part from array ref to hash ref ! $canonic[10] = { @{$canonic[10]} } if defined $canonic[10]; ! ! return \@canonic; ! } ! ! # transform cookie specified using deprecated format to the canonic ! # representation (a list expected by HTTP::Cookie::set_cookie) ! sub transform_cookie_deprecated { ! my $self = shift; ! my $cookie = shift; ! ! # make a copy of cookie (missing fields are set to undef) ! my @canonic = @$cookie[0 .. NCOOKIE_REFORMAT - 1]; ! ! # replace '' with undef ! @canonic = map +(defined($_) and $_ eq '') ? (undef) : $_, ! @canonic; ! ! # collect all additional attributes (name, value pairs) ! my @extra = @$cookie[ NCOOKIE_REFORMAT .. @$cookie - 1]; ! push @canonic, { @extra }; ! ! return \@canonic; } |
From: Ilya M. <m_...@us...> - 2002-07-02 22:44:41
|
Update of /cvsroot/http-webtest/HTTP-WebTest/t In directory usw-pr-cvs1:/tmp/cvs-serv30219/t Modified Files: 02-generic.t Log Message: New cookie tests Index: 02-generic.t =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/t/02-generic.t,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** 02-generic.t 12 May 2002 13:36:59 -0000 1.9 --- 02-generic.t 2 Jul 2002 22:44:38 -0000 1.10 *************** *** 18,22 **** use vars qw($HOSTNAME $PORT $URL); ! BEGIN { plan tests => 24 } # init tests --- 18,22 ---- use vars qw($HOSTNAME $PORT $URL); ! BEGIN { plan tests => 28 } # init tests *************** *** 215,219 **** } ! # 10: test cookies - cookies param { my $skip = $HOSTNAME !~ /\..*\./ ? --- 215,219 ---- } ! # 10: test cookies - cookies param (deprecated syntax) { my $skip = $HOSTNAME !~ /\..*\./ ? *************** *** 253,257 **** } ! # 11: and another cookie test (tests alias parameter) { my $skip = $HOSTNAME !~ /\..*\./ ? --- 253,325 ---- } ! # 11-14: test cookies - cookies param (new syntax) ! { ! my $skip = $HOSTNAME !~ /\..*\./ ? ! 'skip: cannot test cookies - ' . ! 'hostname does not contain two dots' : ! undef; ! if($skip) { ! skip($skip, 1) for 1..4; ! } else { ! my $tests = [ { url => abs_url($URL, '/show-cookies'), ! cookies => [ [ name => 'N001', ! value => 'V001', ! path => '/', ! domain => $HOSTNAME ], ! [ name => 'N002', ! value => 'V002', ! path => '/', ! domain => $HOSTNAME, ! rest => [ Comment => 'test' ] ] ], ! text_require => [ '<N001>=<V001>', ! '<N002>=<V002>' ] }, ! { url => abs_url($URL, '/show-cookies'), ! cookies => [ [ name => 'N003', ! value => 'V003', ! path => '/', ! domain => 'wrong.hostname.com' ], ! [ name => 'N004', ! value => 'V004', ! domain => $HOSTNAME, ! path => '/wrong/path' ] ], ! text_forbid => [ '<N003>=<V003>', ! '<N004>=<V004>' ] } ! ]; ! ! check_webtest(webtest => $WEBTEST, ! server_url => $URL, ! tests => $tests, ! check_file => 't/test.out/cookie2a'); ! ! my $cookie_jar = $WEBTEST->user_agent->cookie_jar; ! my $n001a_ok = 0; ! my $n001b_ok = 0; ! my $n002_ok = 0; ! $cookie_jar->scan(sub { ! my @cookie = @_; ! # test cookie N001 for correct path ! if( $cookie[1] eq 'N001') { ! $n001a_ok = 1 ! if $cookie[3] eq '/'; ! } ! # test cookie N001 for correct domain ! if( $cookie[1] eq 'N001') { ! $n001b_ok = 1 ! if $cookie[4] eq $HOSTNAME; ! } ! # test cookie N002 for correct comment ! # field ! if( $cookie[1] eq 'N002') { ! $n002_ok = 1 ! if $cookie[10]{Comment} eq 'test'; ! } ! }); ! ok($n001a_ok); ! ok($n001b_ok); ! ok($n002_ok); ! } ! } ! ! # 15: and another cookie test (tests alias parameter) { my $skip = $HOSTNAME !~ /\..*\./ ? *************** *** 288,292 **** } ! # 12: authorization tests { my $tests = [ { url => abs_url($URL, '/auth-test-user-passwd') }, --- 356,360 ---- } ! # 16: authorization tests { my $tests = [ { url => abs_url($URL, '/auth-test-user-passwd') }, *************** *** 305,309 **** } ! # 13: be more forgiving about short urls { my $url = abs_url($URL, '/test-file1'); --- 373,377 ---- } ! # 17: be more forgiving about short urls { my $url = abs_url($URL, '/test-file1'); *************** *** 318,322 **** } ! # 14-16: subroutines as value of test parameter { my $tests = [ { url => sub { abs_url($URL, '/test-file1') } }, --- 386,390 ---- } ! # 18-20: subroutines as value of test parameter { my $tests = [ { url => sub { abs_url($URL, '/test-file1') } }, *************** *** 352,356 **** } ! # 17: test user_agent parameter { my $version = HTTP::WebTest->VERSION; --- 420,424 ---- } ! # 21: test user_agent parameter { my $version = HTTP::WebTest->VERSION; *************** *** 374,378 **** } ! # 18: test handling of redirects { my $tests = [ { url => abs_url($URL, '/redirect'), --- 442,446 ---- } ! # 22: test handling of redirects { my $tests = [ { url => abs_url($URL, '/redirect'), *************** *** 390,394 **** } ! # 19-21: test subroutine caching { my $value = 0; --- 458,462 ---- } ! # 23-25: test subroutine caching { my $value = 0; *************** *** 415,419 **** } ! # 22: test arguments passed to subroutine test parameter { my $webtest = undef; --- 483,487 ---- } ! # 26: test arguments passed to subroutine test parameter { my $webtest = undef; *************** *** 427,431 **** } ! # 23: test if we are setting content type header correctly for POST # requests { --- 495,499 ---- } ! # 27: test if we are setting content type header correctly for POST # requests { *************** *** 442,446 **** } ! # 24: test 'http_headers' param { my $tests = [ { url => abs_url($URL, '/show-headers'), --- 510,514 ---- } ! # 28: test 'http_headers' param { my $tests = [ { url => abs_url($URL, '/show-headers'), |
From: Ilya M. <m_...@us...> - 2002-07-02 22:44:41
|
Update of /cvsroot/http-webtest/HTTP-WebTest/t/test.out In directory usw-pr-cvs1:/tmp/cvs-serv30219/t/test.out Modified Files: cookie3 Log Message: New cookie tests Index: cookie3 =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/t/test.out/cookie3,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** cookie3 24 Jan 2002 12:26:18 -0000 1.1.1.1 --- cookie3 2 Jul 2002 22:44:38 -0000 1.2 *************** *** 11,14 **** --- 11,16 ---- PAGE CONTENT: + <N001>=<V001> + <N002>=<V002> <c1>=<v1> <c3>=<v3> |
From: Ilya M. <m_...@us...> - 2002-07-02 22:43:09
|
Update of /cvsroot/http-webtest/HTTP-WebTest/t/test.out In directory usw-pr-cvs1:/tmp/cvs-serv29435/t/test.out Added Files: cookie2a Log Message: Added --- NEW FILE: cookie2a --- Failed Succeeded Test Name 0 3 *** no name *** 0 3 *** no name *** URL: http://http.web.test/show-cookies STATUS CODE CHECK 200 OK SUCCEED REQUIRED TEXT <N001>=<V001> SUCCEED <N002>=<V002> SUCCEED URL: http://http.web.test/show-cookies STATUS CODE CHECK 200 OK SUCCEED FORBIDDEN TEXT <N003>=<V003> SUCCEED <N004>=<V004> SUCCEED Total web tests failed: 0 succeeded: 6 |
From: Ilya M. <m_...@us...> - 2002-07-02 22:43:06
|
Update of /cvsroot/http-webtest/HTTP-WebTest In directory usw-pr-cvs1:/tmp/cvs-serv29311 Modified Files: MANIFEST Log Message: Updated Index: MANIFEST =================================================================== RCS file: /cvsroot/http-webtest/HTTP-WebTest/MANIFEST,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** MANIFEST 19 Jun 2002 10:30:19 -0000 1.15 --- MANIFEST 2 Jul 2002 22:42:57 -0000 1.16 *************** *** 94,97 **** --- 94,98 ---- t/test.out/cookie1 t/test.out/cookie2 + t/test.out/cookie2a t/test.out/cookie3 t/test.out/default-report-yes |