]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/comments.pm
check site url for https
[ikiwiki.git] / IkiWiki / Plugin / comments.pm
index bccb977e3b3e06e21175575d587727c327778e55..cb0196728ef5652573df7d53a9ae509c4723877a 100755 (executable)
@@ -189,16 +189,22 @@ sub preprocess {
                        $commentauthor = $commentuser;
                }
 
-                eval 'use Libravatar::URL';
+               eval q{use Libravatar::URL};
+               if (! $@) {
+                       my $https=defined $config{url} && $config{url}=~/^https:/;
 
-                if (! $@) {
-                    if (defined $commentopenid) {
-                        $commentauthoravatar = libravatar_url(openid => $commentopenid, https => $ENV{HTTPS});
-                    }
-                    elsif (my $email = IkiWiki::userinfo_get($commentuser, 'email')) {
-                        $commentauthoravatar = libravatar_url(email => $email, https => $ENV{HTTPS});
-                    }
-                }
+                       if (defined $commentopenid) {
+                               eval {
+                                       $commentauthoravatar = libravatar_url(openid => $commentopenid, https => $https);
+                               }
+                       }
+                       if (! defined $commentauthoravatar &&
+                           (my $email = IkiWiki::userinfo_get($commentuser, 'email'))) {
+                               eval {
+                                       $commentauthoravatar = libravatar_url(email => $email, https => $https);
+                               }
+                       }
+               }
        }
        else {
                if (defined $params{ip}) {
@@ -229,7 +235,7 @@ sub preprocess {
                        my $url=$params{url};
 
                        eval q{use URI::Heuristic}; 
-                       if (! $@) {
+                       if (! $@) {
                                $url=URI::Heuristic::uf_uristr($url);
                        }