line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::RequestBase; |
2
|
1
|
|
|
1
|
|
582
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.3'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub register { |
7
|
1
|
|
|
1
|
1
|
36
|
my ($self, $app, $config) = @_; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$app->hook( |
10
|
|
|
|
|
|
|
before_dispatch => sub { |
11
|
6
|
|
|
6
|
|
51818
|
my $c = shift; |
12
|
6
|
100
|
|
|
|
27
|
if (my $base = $c->req->headers->header('X-Request-Base')) { |
13
|
5
|
|
|
|
|
111
|
my $url = Mojo::URL->new($base); |
14
|
5
|
100
|
|
|
|
262
|
if ($url->host) { |
15
|
4
|
|
|
|
|
21
|
$c->req->url->base($url); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
else { |
18
|
1
|
|
|
|
|
7
|
$c->req->url->base->path($url->path); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
} |
22
|
1
|
|
|
|
|
10
|
); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
__END__ |