-# Copyright (C) 2016-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use warnings;
use Test::More;
use PublicInbox::TestCommon;
+use PublicInbox::Eml;
use Socket qw(IPPROTO_TCP SOL_SOCKET);
require_mods(qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status));
my $td;
use_ok 'PublicInbox::Git';
use_ok 'PublicInbox::Import';
-use_ok 'Email::MIME';
{
local $ENV{HOME} = $home;
my $cmd = [ '-init', $group, $maindir, 'http://example.com/', $addr ];
# ensure successful message delivery
{
- my $mime = Email::MIME->new(<<EOF);
+ my $mime = PublicInbox::Eml->new(<<EOF);
From: Me <me\@example.com>
To: You <you\@example.com>
Cc: $addr
$im->add($mime);
$im->done($mime);
}
- ok($sock, 'sock created');
$cmd = [ '-httpd', '-W0', "--stdout=$out", "--stderr=$err" ];
$td = start_script($cmd, undef, { 3 => $sock });
- my $host = $sock->sockhost;
- my $port = $sock->sockport;
+ my $http_pfx = 'http://'.tcp_host_port($sock);
{
my $bad = tcp_connect($sock);
print $bad "GETT / HTTP/1.0\r\n\r\n" or die;
}
is(xsys(qw(git clone -q --mirror),
- "http://$host:$port/$group", "$tmpdir/clone.git"),
+ "$http_pfx/$group", "$tmpdir/clone.git"),
0, 'smart clone successful');
# ensure dumb cloning works, too:
qw(config http.uploadpack false)),
0, 'disable http.uploadpack');
is(xsys(qw(git clone -q --mirror),
- "http://$host:$port/$group", "$tmpdir/dumb.git"),
+ "$http_pfx/$group", "$tmpdir/dumb.git"),
0, 'clone successful');
ok($td->kill, 'killed httpd');