Skip to content

Commit

Permalink
more secure links
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 15, 2014
1 parent 8219cce commit 0431628
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -2,7 +2,7 @@
# Mojolicious [![Build Status](https://travis-ci.org/kraih/mojo.svg?branch=master)](https://travis-ci.org/kraih/mojo)

Back in the early days of the web, many people learned Perl because of a
wonderful Perl library called [CGI](http://metacpan.org/module/CGI). It was
wonderful Perl library called [CGI](https://metacpan.org/module/CGI). It was
simple enough to get started without knowing much about the language and
powerful enough to keep you going, learning by doing was much fun. While
most of the techniques used are outdated now, the idea behind it is not.
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojolicious/Plugin/PODRenderer.pm
Expand Up @@ -40,7 +40,7 @@ sub _html {
# Rewrite links
my $dom = Mojo::DOM->new(_pod_to_html($src));
my $perldoc = $c->url_for('/perldoc/');
$_->{href} =~ s!^http://metacpan\.org/pod/!$perldoc!
$_->{href} =~ s!^https://metacpan\.org/pod/!$perldoc!
and $_->{href} =~ s!::!/!gi
for $dom->find('a[href]')->attr->each;

Expand Down Expand Up @@ -83,7 +83,7 @@ sub _perldoc {
my $module = join '::', split '/', scalar $c->param('module');
my $path
= Pod::Simple::Search->new->find($module, map { $_, "$_/pods" } @INC);
return $c->redirect_to("http://metacpan.org/pod/$module")
return $c->redirect_to("https://metacpan.org/pod/$module")
unless $path && -r $path;

my $src = slurp $path;
Expand All @@ -94,7 +94,7 @@ sub _pod_to_html {
return '' unless defined(my $pod = ref $_[0] eq 'CODE' ? shift->() : shift);

my $parser = Pod::Simple::XHTML->new;
$parser->perldoc_url_prefix('http://metacpan.org/pod/');
$parser->perldoc_url_prefix('https://metacpan.org/pod/');
$parser->$_('') for qw(html_header html_footer);
$parser->output_string(\(my $output));
return $@ unless eval { $parser->parse_string_document("$pod"); 1 };
Expand Down
8 changes: 4 additions & 4 deletions lib/Mojolicious/templates/mojobar.html.ep
Expand Up @@ -56,11 +56,11 @@
%= link_to Documentation => 'http://mojolicio.us/perldoc'
%= link_to Wiki => 'https://github.com/kraih/mojo/wiki'
%= link_to GitHub => 'https://github.com/kraih/mojo'
%= link_to CPAN => 'http://metacpan.org/release/Mojolicious/'
%= link_to MailingList => 'http://groups.google.com/group/mojolicious'
%= link_to CPAN => 'https://metacpan.org/release/Mojolicious/'
%= link_to MailingList => 'https://groups.google.com/group/mojolicious'
%= link_to Blog => 'http://blog.kraih.com'
%= link_to Twitter => 'http://twitter.com/kraih'
%= form_for 'http://google.com/cse' => (target => '_blank') => begin
%= link_to Twitter => 'https://twitter.com/kraih'
%= form_for 'https://google.com/cse' => (target => '_blank') => begin
%= hidden_field cx => '014527573091551588235:pwfplkjpgbi'
%= hidden_field ie => 'UTF-8'
%= search_field 'q', placeholder => 'Search'
Expand Down

0 comments on commit 0431628

Please sign in to comment.