+ test_psgi($app, sub {
+ my ($cb) = @_;
+ # for a while, we used to support /$INBOX/$X40/
+ # when we "compressed" long Message-IDs to SHA-1
+ # Now we're stuck supporting them forever :<
+ foreach my $path (@ls) {
+ $path =~ tr!/!!d;
+ my $from = "http://example.com/test/$path/";
+ my $res = $cb->(GET($from));
+ is(301, $res->code, 'is permanent redirect');
+ like($res->header('Location'),
+ qr!/test/blah\@example\.com/!,
+ 'redirect from x40 MIDs works');
+ }
+ });
+
+ # dumb HTTP clone/fetch support
+ test_psgi($app, sub {
+ my ($cb) = @_;
+ my $path = '/test/info/refs';
+ my $req = HTTP::Request->new('GET' => $path);
+ my $res = $cb->($req);
+ is(200, $res->code, 'refs readable');
+ my $orig = $res->content;
+
+ $req->header('Range', 'bytes=5-10');
+ $res = $cb->($req);
+ is(206, $res->code, 'got partial response');
+ is($res->content, substr($orig, 5, 6), 'partial body OK');
+
+ $req->header('Range', 'bytes=5-');
+ $res = $cb->($req);
+ is(206, $res->code, 'got partial another response');
+ is($res->content, substr($orig, 5), 'partial body OK past end');
+ });
+
+ # things which should fail
+ test_psgi($app, sub {
+ my ($cb) = @_;
+
+ my $res = $cb->(PUT('/'));
+ is(405, $res->code, 'no PUT to / allowed');
+ $res = $cb->(PUT('/test/'));
+ is(405, $res->code, 'no PUT /$INBOX allowed');
+
+ # TODO
+ # $res = $cb->(GET('/'));
+ });