From 1988d730c0088e8b1f6193650c7ee929df8a2ed7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 2 Jan 2020 03:09:30 +0000 Subject: config: support multi-value inbox.*.*url Since the beginning of this project, we've implicitly supported inboxes with multiple URLs by relying on the Host: header sent by the client ($env->{HTTP_HOST}). We now offer the option to explicitly configure multiple URLs for every inbox along with the ability to do a best-effort match for matching hostnames. --- t/config.t | 4 ++-- t/feed.t | 2 +- t/inbox.t | 4 ++-- t/nntp.t | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 't') diff --git a/t/config.t b/t/config.t index db3f9b2a..1ec864b4 100644 --- a/t/config.t +++ b/t/config.t @@ -27,7 +27,7 @@ my ($tmpdir, $for_destroy) = tmpdir(); 'inboxdir' => '/home/pi/meta-main.git', 'address' => [ 'meta@public-inbox.org' ], 'domain' => 'public-inbox.org', - 'url' => 'http://example.com/meta', + 'url' => [ 'http://example.com/meta' ], -primary_address => 'meta@public-inbox.org', 'name' => 'meta', feedmax => 25, @@ -48,7 +48,7 @@ my ($tmpdir, $for_destroy) = tmpdir(); 'domain' => 'public-inbox.org', 'name' => 'test', feedmax => 25, - 'url' => 'http://example.com/test', + 'url' => [ 'http://example.com/test' ], -httpbackend_limiter => undef, nntpserver => undef, }, "lookup matches expected output for test"); diff --git a/t/feed.t b/t/feed.t index 97468c73..b2a94487 100644 --- a/t/feed.t +++ b/t/feed.t @@ -29,7 +29,7 @@ my $ibx = PublicInbox::Inbox->new({ address => 'test@example', name => 'testbox', inboxdir => $git_dir, - url => 'http://example.com/test', + url => [ 'http://example.com/test' ], feedmax => 3, }); my $git = $ibx->git; diff --git a/t/inbox.t b/t/inbox.t index c9674290..a466dd13 100644 --- a/t/inbox.t +++ b/t/inbox.t @@ -4,9 +4,9 @@ use strict; use warnings; use Test::More; use_ok 'PublicInbox::Inbox'; -my $x = PublicInbox::Inbox->new({url => '//example.com/test/'}); +my $x = PublicInbox::Inbox->new({url => [ '//example.com/test/' ]}); is($x->base_url, 'https://example.com/test/', 'expanded protocol-relative'); -$x = PublicInbox::Inbox->new({url => 'http://example.com/test'}); +$x = PublicInbox::Inbox->new({url => [ 'http://example.com/test' ]}); is($x->base_url, 'http://example.com/test/', 'added trailing slash'); $x = PublicInbox::Inbox->new({}); diff --git a/t/nntp.t b/t/nntp.t index 961b3d6a..938eef38 100644 --- a/t/nntp.t +++ b/t/nntp.t @@ -104,7 +104,7 @@ use_ok 'PublicInbox::Inbox'; -primary_address => 'a@example.com', newsgroup => 'test', domain => 'example.com', - url => '//example.com/a'}); + url => [ '//example.com/a' ]}); is($ng->base_url, $u, 'URL expanded'); my $mid = 'a@b'; my $mime = Email::MIME->new("Message-ID: <$mid>\r\n\r\n"); -- cgit v1.2.3-24-ge0c7