X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fhttpd-corner.t;h=c3f805303f8d2daa50d147639796a3bfc11eb477;hb=af0b0fb7a454470a32c452119d0392e0dedb3fe1;hp=7a6bcc6696116c0f352fe89794cb63ac7e1b69ce;hpb=4bebfa0c80ad7f4596a7dca98b39121470a42af0;p=public-inbox.git diff --git a/t/httpd-corner.t b/t/httpd-corner.t index 7a6bcc66..c3f80530 100644 --- a/t/httpd-corner.t +++ b/t/httpd-corner.t @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2020 all contributors +# Copyright (C) 2016-2021 all contributors # License: AGPL-3.0+ # note: our HTTP server should be standalone and capable of running # generic PSGI/Plack apps. @@ -296,7 +296,7 @@ my $len = length $str; is($len, 26, 'got the alphabet'); my $check_self = sub { my ($conn) = @_; - vec(my $rbits, fileno($conn), 1) = 1; + vec(my $rbits = '', fileno($conn), 1) = 1; select($rbits, undef, undef, 30) or Carp::confess('timed out'); $conn->read(my $buf, 4096); my ($head, $body) = split(/\r\n\r\n/, $buf, 2); @@ -340,11 +340,18 @@ SKIP: { is($n, 30 * 1024 * 1024, 'got expected output from curl'); is($non_zero, 0, 'read all zeros'); - require_mods(@zmods, 2); + require_mods(@zmods, 4); my $buf = xqx([$curl, '-sS', "$base/psgi-return-gzip"]); is($?, 0, 'curl succesful'); IO::Uncompress::Gunzip::gunzip(\$buf => \(my $out)); is($out, "hello world\n"); + my $curl_rdr = { 2 => \(my $curl_err = '') }; + $buf = xqx([$curl, qw(-sSv --compressed), + "$base/psgi-return-compressible"], undef, $curl_rdr); + is($?, 0, 'curl --compressed successful'); + is($buf, "goodbye world\n", 'gzipped response as expected'); + like($curl_err, qr/\bContent-Encoding: gzip\b/, + 'curl got gzipped response'); } {