Handle Referer not having a trailing slash

Fixes #415.
This commit is contained in:
Eelco Dolstra 2016-11-01 11:00:30 +01:00
parent d6ccbeedbd
commit ef711ce845

View file

@ -66,6 +66,8 @@ sub begin :Private {
my $referer = $c->req->header('Origin');
$referer //= $c->req->header('Referer');
my $base = $c->req->base;
die unless $base =~ /\/$/;
$referer .= "/";
error($c, "POST requests should come from $base.")
unless defined $referer && substr($referer, 0, length $base) eq $base;
}