git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] The images from picon and gravatar are always used over http://, and browsers give mixed contents warning when gitweb is served over https://.

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 29, 2013, 18:33 UTC
Message-ID
<7va9rrq1o3.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130129041206.GA15442@google.com>
Jonathan Nieder <jrnieder@gmail.com> writes:
> Odd.  "https://www.gravatar.com/" also seems to work.  I've put in a
> technical support query to find out what the Gravatar admins prefer.

Thanks; will hold onto Andrej's patch until we hear what the story is.

Of course we could do something like this (untested).
 gitweb/gitweb.perl | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c6bafe6..b59773b 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -313,6 +313,14 @@ sub evaluate_uri {
 		'override' => 0,
 		'default' => [0]},
 
+	# Use https:// URL for embedded picons/gravatar images, to be used
+	# on installations that server gitweb over https://
+	'subcontentssl' => {
+		'sub' => sub { feature_bool('subcontentssl', @_) },
+		'override' => 0,
+		'default' => [0]},
+	}
+
 	# Enable the 'snapshot' link, providing a compressed archive of any
 	# tree. This can potentially generate high traffic if you have large
 	# project.
@@ -1111,6 +1119,7 @@ sub evaluate_git_dir {
 }
 
 our (@snapshot_fmts, $git_avatar);
+our ($gravatar_base_url, $picon_base_url);
 sub configure_gitweb_features {
 	# list of supported snapshot formats
 	our @snapshot_fmts = gitweb_get_feature('snapshot');
@@ -1121,10 +1130,17 @@ sub configure_gitweb_features {
 	# if the provider name is invalid or the dependencies are not met,
 	# reset $git_avatar to the empty string.
 	our ($git_avatar) = gitweb_get_feature('avatar');
+	my $use_https = gitweb_check_feature('subcontentssl');
+
 	if ($git_avatar eq 'gravatar') {
 		$git_avatar = '' unless (eval { require Digest::MD5; 1; });
+		$gravatar_base_url = $use_https ?
+		    "https://secure.gravatar.com/avatar/" :
+		    "http://www.gravatar.com/avatar/";
 	} elsif ($git_avatar eq 'picon') {
-		# no dependencies
+		$picon_base_url = $use_https ?
+		    "http://www.cs.indiana.edu/cgi-pub/kinzler/piconsearch.cgi/" :
+		    "https://www.cs.indiana.edu/cgi-pub/kinzler/piconsearch.cgi/";
 	} else {
 		$git_avatar = '';
 	}
@@ -2068,7 +2084,7 @@ sub picon_url {
 	if (!$avatar_cache{$email}) {
 		my ($user, $domain) = split('@', $email);
 		$avatar_cache{$email} =
-			"http://www.cs.indiana.edu/cgi-pub/kinzler/piconsearch.cgi/" .
+			$picon_base_url .
 			"$domain/$user/" .
 			"users+domains+unknown/up/single";
 	}
@@ -2082,9 +2098,7 @@ sub picon_url {
 sub gravatar_url {
 	my $email = lc shift;
 	my $size = shift;
-	$avatar_cache{$email} ||=
-		"http://www.gravatar.com/avatar/" .
-			Digest::MD5::md5_hex($email) . "?s=";
+	$avatar_cache{$email} ||= $gravatar_base_url . Digest::MD5::md5_hex($email) . "?s=";
 	return $avatar_cache{$email} . $size;
 }
 
Previous: Bryan TurnerNext: Jonathan Nieder
Message 6 of 8 in “The images from picon and gravatar are always used over http://, and browsers give mixed contents warning when gitweb is served over https://.”
  1. The images from picon and gravatar are always used over http://, and browsers give mixed contents warning when gitweb is served over https://.Andrej E Baranov, Jan 28, 2013
  2. Junio C HamanoJan 29, 2013
  3. Bryan TurnerJan 29, 2013
  4. Jonathan NiederJan 29, 2013
  5. Bryan TurnerJan 29, 2013
  6. Junio C HamanoJan 29, 2013
  7. Jonathan NiederJan 31, 2013
  8. Junio C HamanoFeb 1, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.