Use static types to troubleshoot the Libarchive/POST body thing...
This commit is contained in:
parent
2c2a196171
commit
2f440817c4
|
@ -24,19 +24,19 @@ $router.get(-> $request, $response {
|
||||||
});
|
});
|
||||||
|
|
||||||
$router.post(-> $request, $response {
|
$router.post(-> $request, $response {
|
||||||
my $return-url = $request.content.{'hyperlink'};
|
my Str $return-url = $request.content.{'hyperlink'};
|
||||||
my $url-scheme = $request.headers.{'X-Forwarded-Proto'} || 'http';
|
my Str $url-scheme = $request.headers.{'X-Forwarded-Proto'} || 'http';
|
||||||
my $url-host = $request.headers.{'Host'};
|
my Str $url-host = $request.headers.{'Host'};
|
||||||
my $base-url = $url-scheme ~ '://' ~ $url-host ~ '/';
|
my Str $base-url = $url-scheme ~ '://' ~ $url-host ~ '/';
|
||||||
my $hyperlink = $base-url ~ encode-base64(gzip($return-url), :str);
|
my Str $hyperlink = $base-url ~ encode-base64(gzip($return-url), :str);
|
||||||
|
|
||||||
$response.html($templates.process: 'index', :$hyperlink);
|
$response.html($templates.process: 'index', :$hyperlink);
|
||||||
});
|
});
|
||||||
|
|
||||||
# Try a wildcard to catch 'all' path
|
# Try a wildcard to catch 'all' path
|
||||||
$router.get('/**', -> $request, $response {
|
$router.get('/**', -> $request, $response {
|
||||||
my $return-url = $request.path.substr(1); # Omits the leading slash
|
my Str $return-url = $request.path.substr(1); # Omits the leading slash
|
||||||
my $redirect-url = gunzip(decode-base64($return-url, :bin));
|
my Str $redirect-url = gunzip(decode-base64($return-url, :bin));
|
||||||
|
|
||||||
$response.redirect($redirect-url);
|
$response.redirect($redirect-url);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user