user/dev discussion of public-inbox itself
 help / color / Atom feed
68b5919f4d5eeb3a1fa7cf03a15529c77ad5afce blob 2497 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
 
#!perl -w
# Copyright (C) 2020 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Note: this may be altered as-needed to demonstrate improvements.
# See history in git for this file.
use strict;
use IO::Handle; # ->flush
use Fcntl qw(SEEK_SET);
use PublicInbox::TestCommon;
use PublicInbox::Tmpfile;
use PublicInbox::WWW;
use Test::More;
my @mods = qw(DBD::SQLite BSD::Resource);
require_mods(@mods);
use_ok($_) for @mods;
my $lines = $ENV{NR_LINES} // 50000;
my ($tmpdir, $for_destroy) = tmpdir();
my $inboxname = 'big';
my $inboxdir = "$tmpdir/big";
local $ENV{PI_CONFIG} = "$tmpdir/cfg";
my $mid = 'test@example.com';

{ # setup
	open my $fh, '>', "$tmpdir/cfg" or die;
	print $fh <<EOF or die;
[publicinboxmda]
	spamcheck = none
EOF
	close $fh or die;

	my $addr = 'n@example.com';
	ok(run_script([qw(-init -V2 --indexlevel=basic), $inboxname, $inboxdir,
			"http://example.com/$inboxname", $addr]),
		'inbox initialized');

	$fh = tmpfile('big.eml', undef, my $append = 1) or die;
	my $hdr = sprintf(<<'EOF', $addr, $mid);
From: Dr. X <x@example.com>
To: Nikki <%s>
Date: Tue, 3 May 1988 00:00:00 +0000
Subject: todo
Message-ID: <%s>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="FOO"
Content-Disposition: inline

--FOO
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline

EOF
	print $fh $hdr or die;
	for (0..$lines) { print $fh 'x' x 72, "\n" or die }
	print $fh <<EOF or die;

--FOO
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline

EOF
	for (0..$lines) { print $fh 'x' x 72, "\n" or die }
	print $fh "\n--FOO--\n" or die;
	$fh->flush or die;
	sysseek($fh, 0, SEEK_SET) or die;
	my $env = { ORIGINAL_RECIPIENT => $addr };
	my $err = '';
	my $opt = { 0 => $fh, 2 => \$err, run_mode => 0 };
	ok(run_script([qw(-mda --no-precheck)], $env, $opt),
		'message delivered');
}

my $www = PublicInbox::WWW->new;
my $env = {
	PATH_INFO => "/$inboxname/$mid/",
	REQUEST_URI => "/$inboxname/$mid/",
	SCRIPT_NAME => '',
	QUERY_STRING => '',
	REQUEST_METHOD => 'GET',
	HTTP_HOST => 'example.com',
	'psgi.errors' => \*STDERR,
	'psgi.url_scheme' => 'http',
};
my $ru_before = BSD::Resource::getrusage();
my $res = $www->call($env);
my $body = $res->[2];
while (defined(my $x = $body->getline)) {
}
$body->close;
my $ru_after = BSD::Resource::getrusage();
my $diff = $ru_after->maxrss - $ru_before->maxrss;
diag "before: ${\$ru_before->maxrss} => ${\$ru_after->maxrss} diff=$diff kB";
done_testing();
debug log:

solving 68b5919f ...
found 68b5919f in https://public-inbox.org/meta/20200111062816.9891-2-e@yhbt.net/
found 1ea0f559 in https://80x24.org/public-inbox.git
preparing index
index prepared:
100644 1ea0f559ee0a329482bba0db94524843a1dc8332	xt/mem-msgview.t

applying [1/1] https://public-inbox.org/meta/20200111062816.9891-2-e@yhbt.net/
diff --git a/xt/mem-msgview.t b/xt/mem-msgview.t
index 1ea0f559..68b5919f 100644

Checking patch xt/mem-msgview.t...
Applied patch xt/mem-msgview.t cleanly.

index at:
100644 68b5919f4d5eeb3a1fa7cf03a15529c77ad5afce	xt/mem-msgview.t

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git