about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-02-26 01:57:56 +0000
committerEric Wong <e@80x24.org>2016-02-26 02:44:07 +0000
commitd42cdde813719ed96c2ece567543a66f4884e946 (patch)
tree03643f17c0359373c142e0b7012c7bfddec95e3e /lib
parent93c83c090d377dfebe793c25b47e1ac29f80453e (diff)
downloadpublic-inbox-d42cdde813719ed96c2ece567543a66f4884e946.tar.gz
All URL generation in dynamic HTTP pages should be capable of
generating "https" or "http" URLs depending on the user's
preference.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/ExtMsg.pm5
1 files changed, 3 insertions, 2 deletions
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);