From d42cdde813719ed96c2ece567543a66f4884e946 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 26 Feb 2016 01:57:56 +0000 Subject: support protocol-relative URLs in publicinbox.$LISTNAME.url All URL generation in dynamic HTTP pages should be capable of generating "https" or "http" URLs depending on the user's preference. --- lib/PublicInbox/ExtMsg.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm index 912a675d..6356c324 100644 --- a/lib/PublicInbox/ExtMsg.pm +++ b/lib/PublicInbox/ExtMsg.pm @@ -26,6 +26,8 @@ sub ext_msg { my $pi_config = $ctx->{pi_config}; my $listname = $ctx->{listname}; my $mid = $ctx->{mid}; + my $cgi = $ctx->{cgi}; + my $env = $cgi->{env}; eval { require PublicInbox::Search }; my $have_xap = $@ ? 0 : 1; @@ -43,6 +45,7 @@ sub ext_msg { defined $url or next; $url =~ s!/+\z!!; + $url = PublicInbox::Hval::prurl($env, $url); # try to find the URL with Xapian to avoid forking if ($have_xap) { @@ -85,7 +88,6 @@ sub ext_msg { eval { require PublicInbox::Msgmap }; my $have_mm = $@ ? 0 : 1; - my $cgi = $ctx->{cgi}; my $base_url = $cgi->base->as_string; if ($have_mm) { my $tmp_mid = $mid; @@ -137,7 +139,6 @@ again: if (@EXT_URL && index($mid, '@') >= 0) { $code = 300; $s .= "\nPerhaps try an external site:\n\n"; - my $env = $cgi->{env}; foreach my $url (@EXT_URL) { my $u = PublicInbox::Hval::prurl($env, $url); my $r = sprintf($u, $href); -- cgit v1.2.3-24-ge0c7