7 # The test functions are placed here to make things easier
9 use DebbugsTest qw(:all);
15 my $version_cgi_handler = sub {
17 open($fh,'-|',-e './cgi/version.cgi'? './cgi/version.cgi' : '../cgi/version.cgi');
21 if (/^\s*$/ and $status) {
22 print "HTTP/1.1 $status OK\n";
28 if (/^Status:\s*(\d+)/i) {
38 ok(DebbugsTest::HTTPServer::fork_and_create_webserver($version_cgi_handler,$port),
39 'forked HTTP::Server::Simple successfully');
42 my $ua = LWP::UserAgent->new;
43 $ua->agent("DebbugsTesting/0.1 ");
46 my $req = HTTP::Request->new(GET => "http://localhost:$port/");
48 my $res = $ua->request($req);
49 ok($res->is_success(),'cgi/version.cgi returns success');
50 my $etag = $res->header('Etag');
52 $req = HTTP::Request->new(GET => "http://localhost:$port/",['If-None-Match',$etag]);
53 $res = $ua->request($req);
54 ok($res->code() eq '304','If-None-Match set gives us 304 not modified');