Whoopsies...
This commit is contained in:
parent
78b81897c9
commit
93b7ba6717
|
@ -4,10 +4,11 @@ use Humming-Bird::Advice;
|
||||||
use Template::Mustache;
|
use Template::Mustache;
|
||||||
use Base64;
|
use Base64;
|
||||||
use Libarchive::Filter :gzip;
|
use Libarchive::Filter :gzip;
|
||||||
use Helpers;
|
|
||||||
|
|
||||||
# Normally would 'use' local libs here for Controller and Model and
|
# Normally would 'use' local libs here for Controller and Model and
|
||||||
# what not but keeping it simple for now...
|
# what not but keeping it simple for now...
|
||||||
|
# UPDATE: We now have local lib (sry libs)
|
||||||
|
use Hyperlink-Redirect::Helpers;
|
||||||
|
|
||||||
# Set things up (config stuff would go here?)
|
# Set things up (config stuff would go here?)
|
||||||
my $template = Template::Mustache.new: :from<../templates>;
|
my $template = Template::Mustache.new: :from<../templates>;
|
||||||
|
@ -28,8 +29,8 @@ $router.get(-> $request, $response {
|
||||||
$router.post(-> $request, $response {
|
$router.post(-> $request, $response {
|
||||||
my Str $return-url = fix-protocol($request.content<hyperlink>);
|
my Str $return-url = fix-protocol($request.content<hyperlink>);
|
||||||
my Bool $meta-refresh = $request.content<meta-refresh>.defined;
|
my Bool $meta-refresh = $request.content<meta-refresh>.defined;
|
||||||
my Str $url-scheme = $request.headers<X-Forwarded-Proto> || 'http';
|
my Str $url-scheme = $request.headers<x-forwarded-proto> || 'http';
|
||||||
my Str $url-host = $request.headers<Host>;
|
my Any $url-host = $request.headers<host>;
|
||||||
my (Str $base-url, Str $hyperlink, Str %stash);
|
my (Str $base-url, Str $hyperlink, Str %stash);
|
||||||
|
|
||||||
$base-url = $url-scheme ~ '://' ~ $url-host ~
|
$base-url = $url-scheme ~ '://' ~ $url-host ~
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
my $starts-with-protocol = rx:i/ ^https? '://'/;
|
my $starts-with-protocol = rx:i/ ^https? '://'/;
|
||||||
|
|
||||||
sub fix-protocol ($url) is export {
|
sub fix-protocol($url) is export {
|
||||||
return "http://" ~ $url unless $url ~~ $starts-with-protocol;
|
return "http://" ~ $url unless $url ~~ $starts-with-protocol;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue