From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id DED271F9F3 for ; Sun, 2 May 2021 06:05:42 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/6] lei_input: reject --mail-sync if using HTTP(S) for now Date: Sun, 2 May 2021 06:05:39 +0000 Message-Id: <20210502060542.11598-4-e@80x24.org> In-Reply-To: <20210502060542.11598-1-e@80x24.org> References: <20210502060542.11598-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: I'm not sure how we'll distinguish JMAP vs read-only HTTPS, yet; but we'll focus on currently-supported stuff, first. --- lib/PublicInbox/LeiInput.pm | 2 ++ t/lei-import-http.t | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/lib/PublicInbox/LeiInput.pm b/lib/PublicInbox/LeiInput.pm index 917f682b..85caac35 100644 --- a/lib/PublicInbox/LeiInput.pm +++ b/lib/PublicInbox/LeiInput.pm @@ -229,6 +229,8 @@ sub prepare_inputs { # returns undef on error } } } elsif ($input_path =~ m!\Ahttps?://!i) { + # TODO: how would we detect r/w JMAP? + push @{$sync->{no}}, $input if $sync; prepare_http_input($self, $lei, $input_path) or return; } elsif ($input_path =~ s/\A([a-z0-9]+)://is) { my $ifmt = lc $1; diff --git a/t/lei-import-http.t b/t/lei-import-http.t index 35cbf369..6cb8a753 100644 --- a/t/lei-import-http.t +++ b/t/lei-import-http.t @@ -39,5 +39,10 @@ test_lei({ tmpdir => $tmpdir }, sub { $res = json_utf8->decode($lei_out); is($res->[0]->{'m'}, '20180720072141.GA15957@example', 'imported search result') or diag explain($res); + + ok(!lei(qw(import --mail-sync), "$url/x\@example.com/raw"), + '--mail-sync fails on HTTP'); + diag $lei_err; + }); done_testing;