- my $ctx = { cgi => $cgi, pi_config => $pi_config };
- if ($method !~ /\AGET|HEAD\z/) {
+ bless { pi_config => $pi_config }, $class;
+}
+
+# backwards compatibility, do not use
+sub run {
+ my ($req, $method) = @_;
+ PublicInbox::WWW->new->call($req->env);
+}
+
+sub call {
+ my ($self, $env) = @_;
+ my $cgi = Plack::Request->new($env);
+ my $ctx = { cgi => $cgi, pi_config => $self->{pi_config} };
+ my $path_info = $cgi->path_info;
+
+ my $method = $cgi->method;
+ if ($method eq 'POST' &&
+ $path_info =~ m!$LISTNAME_RE/(git-upload-pack)\z!) {
+ my $path = $2;
+ return (invalid_list($self, $ctx, $1) ||
+ serve_git($cgi, $ctx->{git}, $path));
+ }
+ elsif ($method !~ /\AGET|HEAD\z/) {