Skip Menu |

This queue is for tickets about the Template-Plugin-Gravatar CPAN distribution.

Report information
The Basics
Id: 99482
Status: resolved
Worked: 10 min
Priority: 0/
Queue: Template-Plugin-Gravatar

People
Owner: ashley [...] cpan.org
Requestors: oriol.soriano [...] capside.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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
Should be up on CPAN as 0.08 in a couple of hours with basic fix exactly as you suggested and a matching test. Thanks! I agree about the secure flag but I don't think I have time right now to rejigger it. Patches with tests and docs are great if you are inclined. I would take the lead from Schwern's Gravatar module, Gravatar::URL, if he's done anything with the idea already.