]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/cgi.t
t/cgi.t: fix broken test for dumb HTTP
[public-inbox.git] / t / cgi.t
diff --git a/t/cgi.t b/t/cgi.t
index b0af8ae179b2af2c8b9f6f5e00face8180ae6207..ebf141604beedaa0d2ecd75b2fac827b91061ff8 100644 (file)
--- a/t/cgi.t
+++ b/t/cgi.t
@@ -1,4 +1,4 @@
-# Copyright (C) 2014, Eric Wong <normalperson@yhbt.net> and all contributors
+# Copyright (C) 2014-2015 all contributors <meta@public-inbox.org>
 # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
 use strict;
 use warnings;
@@ -102,6 +102,25 @@ EOF
        like($res->{head}, qr/Status:\s*404/i, "index returns 404");
 }
 
+# dumb HTTP support
+{
+       local $ENV{HOME} = $home;
+       my $path = "/test/info/refs";
+       my $res = cgi_run($path);
+       like($res->{head}, qr/Status:\s*200/i, "info/refs readable");
+       my $orig = $res->{body};
+
+       local $ENV{HTTP_RANGE} = 'bytes=5-10';
+       $res = cgi_run($path);
+       like($res->{head}, qr/Status:\s*206/i, "info/refs partial OK");
+       is($res->{body}, substr($orig, 5, 6), 'partial body OK');
+
+       local $ENV{HTTP_RANGE} = 'bytes=5-';
+       $res = cgi_run($path);
+       like($res->{head}, qr/Status:\s*206/i, "info/refs partial past end OK");
+       is($res->{body}, substr($orig, 5), 'partial body OK past end');
+}
+
 # atom feeds
 {
        local $ENV{HOME} = $home;
@@ -206,7 +225,7 @@ EOF
                $path = "/test/blahblah%40example.com/t.atom";
                $res = cgi_run($path);
                like($res->{head}, qr/^Status: 200 /, "atom returned 200");
-               like($res->{head}, qr!^Content-Type: application/xml!m,
+               like($res->{head}, qr!^Content-Type: application/atom\+xml!m,
                        "search returned atom");
                my $p = XML::Feed->parse(\($res->{body}));
                is($p->format, "Atom", "parsed atom feed");