Make it closer to what the existing WWW interface is since
we no longer rely on CGI.pm
use strict;
use warnings;
use PublicInbox::Repobrowse;
-use Plack::Request;
use Plack::Builder;
my $have_deflater = eval { require Plack::Middleware::Deflater; 1 };
my $repo_browse = PublicInbox::Repobrowse->new;
'application/atom+xml' ];
}
enable 'Head';
- sub {
- my $req = Plack::Request->new(@_);
- $repo_browse->run($req, $req->method);
- }
+ sub { $repo_browse->call(@_) }
}
package PublicInbox::Repobrowse;
use strict;
use warnings;
+use Plack::Request;
use URI::Escape qw(uri_escape_utf8 uri_unescape);
use PublicInbox::RepobrowseConfig;
$mod->new->call($self->{rconfig}); # RepobrowseRoot::call
}
-sub run {
- my ($self, $cgi, $method) = @_;
+sub call {
+ my ($self, $env) = @_;
+ my $cgi = Plack::Request->new($env);
+ my $method = $cgi->method;
return r(405, 'Method Not Allowed') if ($method !~ /\AGET|HEAD|POST\z/);
# URL syntax: / repo [ / cmd [ / path ] ]