c46850d09fd35de8af833f37568c53c3c6ffd90e
[dh-make-perl] / dev / arm / libwww-perl / libwww-perl-5.813 / t / live / jigsaw-te.t
1 #!perl -w
2
3 my $zlib_ok;
4 for (("", "live/", "t/live/")) {
5     if (-f $_ . "ZLIB_OK") {
6         $zlib_ok++;
7         last;
8     }
9 }
10
11 unless ($zlib_ok) {
12     print "1..0\n";
13     print "Apparently no working ZLIB installed\n";
14     exit;
15 }
16
17
18 print "1..4\n";
19
20 use strict;
21 use LWP::UserAgent;
22
23 my $ua = LWP::UserAgent->new(keep_alive => 1);
24
25
26 my $content;
27 my $testno = 1;
28
29 for my $te (undef, "", "deflate", "gzip", "trailers, deflate;q=0.4, identity;q=0.1") {
30     my $req = HTTP::Request->new(GET => "http://jigsaw.w3.org/HTTP/TE/foo.txt");
31     if (defined $te) {
32         $req->header(TE => $te);
33         $req->header(Connection => "TE");
34     }
35     print $req->as_string;
36
37     my $res = $ua->request($req);
38     if (defined $content) {
39         print "not " unless $content eq $res->content;
40         print "ok $testno\n\n";
41         $testno++;
42     }
43     else {
44         $content = $res->content;
45     }
46     $res->content("");
47     print $res->as_string;
48 }