X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FWwwAltId.pm;h=470561608f5df47b746cd5bab5680d23b47f3c33;hb=refs%2Fheads%2Fmaster;hp=2818400eabd17359446d3b72936a245b4f498bcb;hpb=7f8e6ba85dd5e41efdfb518e3b86bceda3ee027e;p=public-inbox.git
diff --git a/lib/PublicInbox/WwwAltId.pm b/lib/PublicInbox/WwwAltId.pm
index 2818400e..47056160 100644
--- a/lib/PublicInbox/WwwAltId.pm
+++ b/lib/PublicInbox/WwwAltId.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2020 all contributors
+# Copyright (C) 2020-2021 all contributors
# License: AGPL-3.0+
# dumps using the ".dump" command of sqlite3(1)
@@ -15,8 +15,7 @@ sub check_output {
my ($r, $bref, $ctx) = @_;
return html_oneshot($ctx, 500) if !defined($r);
if ($r == 0) {
- my $err = eval { $ctx->{env}->{'psgi.errors'} } // \*STDERR;
- $err->print("unexpected EOF from sqlite3\n");
+ warn 'unexpected EOF from sqlite3';
return html_oneshot($ctx, 501);
}
[200, [ qw(Content-Type application/gzip), 'Content-Disposition',
@@ -30,32 +29,32 @@ sub check_output {
sub sqldump ($$) {
my ($ctx, $altid_pfx) = @_;
my $env = $ctx->{env};
- my $ibx = $ctx->{-inbox};
+ my $ibx = $ctx->{ibx};
my $altid_map = $ibx->altid_map;
my $fn = $altid_map->{$altid_pfx};
unless (defined $fn) {
- return html_oneshot($ctx, 404, \<`$altid_pfx' is not a valid altid for this inbox
EOF
}
if ($env->{REQUEST_METHOD} ne 'POST') {
my $url = $ibx->base_url($ctx->{env}) . "$altid_pfx.sql.gz";
- return html_oneshot($ctx, 405, \<A POST request required to retrieve $altid_pfx.sql.gz
+ return html_oneshot($ctx, 405, <A POST request is required to retrieve $altid_pfx.sql.gz
- curl -XPOST -O $url
+ curl -d '' -O $url
or
- curl -XPOST $url | \\
+ curl -d '' $url | \\
gzip -dc | \\
sqlite3 /path/to/$altid_pfx.sqlite3
EOF
}
- $sqlite3 //= which('sqlite3') // return html_oneshot($ctx, 501, \<sqlite3 not available
The administrator needs to install the sqlite3(1) binary