lib/PublicInbox/ExtMsg.pm | 4 ++-- lib/PublicInbox/Hval.pm | 5 +++++ lib/PublicInbox/SearchView.pm | 7 ++++--- lib/PublicInbox/WWW.pm | 16 ++++++++++------ diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm index cf9b6d58ba8d3b9836300a28cf96cf2000c1fa8f..c6fc565a0eef6c22c4bf855d64e33485f9531724 100644 --- a/lib/PublicInbox/ExtMsg.pm +++ b/lib/PublicInbox/ExtMsg.pm @@ -137,9 +137,9 @@ # Fall back to external repos if configured if (@EXT_URL && index($mid, '@') >= 0) { $code = 300; $s .= "\nPerhaps try an external site:\n\n"; - my $scheme = $cgi->scheme; + my $env = $cgi->{env}; foreach my $u (@EXT_URL) { - $u = "$scheme:$u" if $u =~ m!\A//!; + $u = PublicInbox::Hval::prurl($env, $u); my $r = sprintf($u, $href); my $t = sprintf($u, $html); $s .= qq{$t\n}; diff --git a/lib/PublicInbox/Hval.pm b/lib/PublicInbox/Hval.pm index d295f5ce3d29fb8d783e2550e75975fe237fcba7..a455884f1c4b2e2787d10c587a29198f6e1ddb7c 100644 --- a/lib/PublicInbox/Hval.pm +++ b/lib/PublicInbox/Hval.pm @@ -69,4 +69,9 @@ $_[0]->{raw}; } } +sub prurl { + my ($env, $u) = @_; + index($u, '//') == 0 ? "$env->{'psgi.url_scheme'}:$u" : $u; +} + 1; diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index 8f61b4f4be7e72084d0b47600807c02ea997e65b..746cb838bbf3f49a616b903312c42edc1813fae7 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -35,7 +35,7 @@ my $err = $@; my $res = html_start($q, $ctx) . '
';
 	if ($err) {
 		$code = 400;
-		$res .= err_txt($err) . "

" . foot($ctx);
+		$res .= err_txt($ctx, $err) . "

" . foot($ctx);
 	} elsif ($total == 0) {
 		$code = 404;
 		$res .= "\n\n[No results found]

".foot($ctx);
@@ -80,8 +80,9 @@ 	}
 }
 
 sub err_txt {
-	my ($err) = @_;
-	my $u = 'http://xapian.org/docs/queryparser.html';
+	my ($ctx, $err) = @_;
+	my $u = '//xapian.org/docs/queryparser.html';
+	$u = PublicInbox::Hval::prurl($ctx->{cgi}->{env}, $u);
 	$err =~ s/^\s*Exception:\s*//; # bad word to show users :P
 	$err = PublicInbox::Hval->new_oneline($err)->as_html;
 	"\n\nBad query: $err\n" .
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index e87e559428ffc55400b9942d4c1561c7197dd44e..8372927394f6c3ddbb1242077b03a16b0902f4cc 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -15,8 +15,8 @@ use strict;
 use warnings;
 use PublicInbox::Config qw(try_cat);
 use URI::Escape qw(uri_escape_utf8 uri_unescape);
-use constant SSOMA_URL => 'http://ssoma.public-inbox.org/';
-use constant PI_URL => 'http://public-inbox.org/';
+use constant SSOMA_URL => '//ssoma.public-inbox.org/';
+use constant PI_URL => '//public-inbox.org/';
 require PublicInbox::Git;
 use PublicInbox::GitHTTPBackend;
 our $LISTNAME_RE = qr!\A/([\w\.\-]+)!;
@@ -264,14 +264,16 @@
 	my $urls = try_cat("$git_dir/cloneurl");
 	my @urls = split(/\r?\n/, $urls || '');
 	my %seen = map { $_ => 1 } @urls;
-	my $http = $ctx->{cgi}->base->as_string . $listname;
+	my $cgi = $ctx->{cgi};
+	my $http = $cgi->base->as_string . $listname;
 	$seen{$http} or unshift @urls, $http;
+	my $ssoma_url = PublicInbox::Hval::prurl($cgi->{env}, SSOMA_URL);
 	if (scalar(@urls) == 1) {
-		$urls = "URL for ssoma or git clone --mirror \$URL :) .
 			$urls[0];
 	} else {
-		$urls = "URLs for ssoma or git clone --mirror \$URL\n) .
 			join("\n", map { "\t$_" } @urls);
 	}
@@ -285,7 +287,9 @@ 	$addr = "$addr";
 
 	$ctx->{footer} = join("\n",
 		'- ' . $desc,
-		"A public-inbox, ' .
+		"A {cgi}->{env}, PI_URL) .
+			'">public-inbox, ' .
 			'anybody may post in plain-text (not HTML):',
 		$addr,
 		$urls