Subject: | Gravatar through httpS |
Date: | Tue, 14 Oct 2014 14:24:10 +0000 |
To: | "bug-Template-Plugin-Gravatar [...] rt.cpan.org" <bug-Template-Plugin-Gravatar [...] rt.cpan.org> |
From: | Oriol Soriano <oriol.soriano [...] capside.com> |
Hi,
First of all, thanks for taking care of the Template::Plugin::Gravatar module; it's saved me some time so far!
Now, unless Im missing something here, I've found a problem around setting the gravatar base url to a custom value.
More concretely, seems like the option 'base' is being ignored. I set it in this fashion:
[% USE Gravatar(base => "https://www.gravatar.com/avatar/") %]
But the result is that the Gravatar URL is still the one that comes by default(''h<https://www.gravatar.com/avatar/><http://>ttp://www.gravatar.com/avatar/<https://www.gravatar.com/avatar/>") (Notice http vs httpS).
I couldnt avoid peeking into the module's code and I think that the issue is around these lines:
48 my $uri = URI->new( $Gravatar_Base);
49 my @ordered = map { $_, $args->{$_} }
50 grep $args->{$_},
51 qw( gravatar_id rating size default );
52 $uri->query_form(@ordered);
53 return $uri;
Certainly, it looks like the argument 'base' is being ignored ($Gravatar_Base is directly used, instead).
Obviously, there's many different ways of getting around this. The simplest one I was able to find is the following:
-48 my $uri = URI->new( $Gravatar_Base);
+48 my $uri = URI->new( $args->{base} || $Gravatar_Base );
Finally, since the goal of this change is retrieving the Gravatar via httpS and this is going to be, very likely, a frequent requirement, I would suggest adding an option flag (EG: "secure") to use an httpS URL instead of http as it is by default.
I could code this myself and issue a pull request if that might help.
Thanks in advance,
Oriol Soriano Vila
Software Engineer