about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/Feed.pm9
-rw-r--r--lib/PublicInbox/WWW.pm13
-rwxr-xr-xscript/public-inbox-httpd1
-rw-r--r--t/httpd-corner.t2
-rw-r--r--t/httpd-unix.t2
-rw-r--r--t/httpd.t2
-rw-r--r--t/plack.t2
-rw-r--r--t/psgi_attach.t2
-rw-r--r--t/psgi_mount.t2
9 files changed, 16 insertions, 19 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index ffbf5c80..2983514c 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -119,17 +119,18 @@ sub end_feed {
 
 sub emit_atom_thread {
         my ($cb, $ctx) = @_;
-        my $res = $ctx->{srch}->get_thread($ctx->{mid});
+        my $mid = $ctx->{mid};
+        my $res = $ctx->{srch}->get_thread($mid);
         return _no_thread($cb) unless $res->{total};
         my $feed_opts = get_feedopts($ctx);
         my $fh = $cb->([200, ['Content-Type' => 'application/atom+xml']]);
+        my $ibx = $ctx->{-inbox};
+        my $html_url = $ibx->base_url($ctx->{env});
+        $html_url .= PublicInbox::Hval->new_msgid($mid)->as_href;
 
-        my $html_url = $feed_opts->{atomurl} = $ctx->{self_url};
-        $html_url =~ s!/t\.atom\z!/!;
         $feed_opts->{url} = $html_url;
         $feed_opts->{emit_header} = 1;
 
-        my $ibx = $ctx->{-inbox};
         foreach my $msg (@{$res->{msgs}}) {
                 my $s = feed_entry($feed_opts, mid2path($msg->mid), $ibx);
                 $fh->write($s) if defined $s;
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index 940e1c51..54253086 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -13,7 +13,6 @@ package PublicInbox::WWW;
 use 5.008;
 use strict;
 use warnings;
-use Plack::Request;
 use PublicInbox::Config;
 use PublicInbox::Hval;
 use URI::Escape qw(uri_escape_utf8 uri_unescape);
@@ -40,9 +39,7 @@ sub run {
 
 sub call {
         my ($self, $env) = @_;
-        my $cgi = Plack::Request->new($env);
-        my $ctx = { cgi => $cgi, env => $env, www => $self,
-                pi_config => $self->{pi_config} };
+        my $ctx = { env => $env, www => $self, pi_config => $self->{pi_config} };
 
         # we don't care about multi-value
         my %qp = map {
@@ -267,10 +264,11 @@ sub footer {
         my $urls;
         my @urls = @{$obj->cloneurl};
         my %seen = map { $_ => 1 } @urls;
-        my $cgi = $ctx->{cgi};
-        my $http = $cgi->base->as_string . $obj->{name};
+        my $env = $ctx->{env};
+        my $http = $obj->base_url($env);
+        chop $http;
         $seen{$http} or unshift @urls, $http;
-        my $ssoma_url = PublicInbox::Hval::prurl($ctx->{env}, SSOMA_URL);
+        my $ssoma_url = PublicInbox::Hval::prurl($env, SSOMA_URL);
         if (scalar(@urls) == 1) {
                 $urls = "URL for <a\nhref=\"" . $ssoma_url .
                         qq(">ssoma</a> or <b>git clone --mirror $urls[0]</b>);
@@ -329,7 +327,6 @@ sub get_thread_mbox {
 sub get_thread_atom {
         my ($ctx) = @_;
         searcher($ctx) or return need_search($ctx);
-        $ctx->{self_url} = $ctx->{cgi}->uri->as_string;
         require PublicInbox::Feed;
         PublicInbox::Feed::generate_thread_atom($ctx);
 }
diff --git a/script/public-inbox-httpd b/script/public-inbox-httpd
index f19582fa..8ba42c2f 100755
--- a/script/public-inbox-httpd
+++ b/script/public-inbox-httpd
@@ -9,7 +9,6 @@ use Plack::Util;
 use PublicInbox::Daemon;
 use PublicInbox::HTTP;
 use PublicInbox::HTTPD;
-use Plack::Request;
 use Plack::Builder;
 my %httpds;
 my $app;
diff --git a/t/httpd-corner.t b/t/httpd-corner.t
index b9eaa6fb..5ecc69b5 100644
--- a/t/httpd-corner.t
+++ b/t/httpd-corner.t
@@ -7,7 +7,7 @@ use warnings;
 use Test::More;
 use Time::HiRes qw(gettimeofday tv_interval);
 
-foreach my $mod (qw(Plack::Util Plack::Request Plack::Builder Danga::Socket
+foreach my $mod (qw(Plack::Util Plack::Builder Danga::Socket
                         HTTP::Date HTTP::Status)) {
         eval "require $mod";
         plan skip_all => "$mod missing for httpd-corner.t" if $@;
diff --git a/t/httpd-unix.t b/t/httpd-unix.t
index 16f7bdd2..ef827fc6 100644
--- a/t/httpd-unix.t
+++ b/t/httpd-unix.t
@@ -5,7 +5,7 @@ use strict;
 use warnings;
 use Test::More;
 
-foreach my $mod (qw(Plack::Util Plack::Request Plack::Builder Danga::Socket
+foreach my $mod (qw(Plack::Util Plack::Builder Danga::Socket
                         HTTP::Date HTTP::Status)) {
         eval "require $mod";
         plan skip_all => "$mod missing for httpd-unix.t" if $@;
diff --git a/t/httpd.t b/t/httpd.t
index 0e19b568..c2e73608 100644
--- a/t/httpd.t
+++ b/t/httpd.t
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 use Test::More;
 
-foreach my $mod (qw(Plack::Util Plack::Request Plack::Builder Danga::Socket
+foreach my $mod (qw(Plack::Util Plack::Builder Danga::Socket
                         HTTP::Date HTTP::Status)) {
         eval "require $mod";
         plan skip_all => "$mod missing for httpd.t" if $@;
diff --git a/t/plack.t b/t/plack.t
index a4f32457..40298e58 100644
--- a/t/plack.t
+++ b/t/plack.t
@@ -11,7 +11,7 @@ my $pi_config = "$tmpdir/config";
 my $maindir = "$tmpdir/main.git";
 my $addr = 'test-public@example.com';
 my $cfgpfx = "publicinbox.test";
-my @mods = qw(HTTP::Request::Common Plack::Request Plack::Test
+my @mods = qw(HTTP::Request::Common Plack::Test
         Mail::Thread URI::Escape);
 foreach my $mod (@mods) {
         eval "require $mod";
diff --git a/t/psgi_attach.t b/t/psgi_attach.t
index ef116c6a..0d20b7f7 100644
--- a/t/psgi_attach.t
+++ b/t/psgi_attach.t
@@ -9,7 +9,7 @@ my $tmpdir = tempdir('psgi-attach-XXXXXX', TMPDIR => 1, CLEANUP => 1);
 my $maindir = "$tmpdir/main.git";
 my $addr = 'test-public@example.com';
 my $cfgpfx = "publicinbox.test";
-my @mods = qw(HTTP::Request::Common Plack::Request Plack::Test URI::Escape);
+my @mods = qw(HTTP::Request::Common Plack::Test URI::Escape);
 foreach my $mod (@mods) {
         eval "require $mod";
         plan skip_all => "$mod missing for plack.t" if $@;
diff --git a/t/psgi_mount.t b/t/psgi_mount.t
index c1c1b0c6..dae45baf 100644
--- a/t/psgi_mount.t
+++ b/t/psgi_mount.t
@@ -9,7 +9,7 @@ my $tmpdir = tempdir('psgi-path-XXXXXX', TMPDIR => 1, CLEANUP => 1);
 my $maindir = "$tmpdir/main.git";
 my $addr = 'test-public@example.com';
 my $cfgpfx = "publicinbox.test";
-my @mods = qw(HTTP::Request::Common Plack::Request Plack::Test URI::Escape);
+my @mods = qw(HTTP::Request::Common Plack::Test URI::Escape);
 foreach my $mod (@mods) {
         eval "require $mod";
         plan skip_all => "$mod missing for plack.t" if $@;