line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package URI::Coralize; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
77401
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
76
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
60
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
7485
|
use URI (); |
|
2
|
|
|
|
|
8777
|
|
|
2
|
|
|
|
|
366
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
9
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub URI::coralize { |
12
|
5
|
|
|
5
|
0
|
15424
|
my ($uri) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# CoralCDN doesn't proxy secure requests and simply redirects to the |
15
|
|
|
|
|
|
|
# requested resource. |
16
|
5
|
100
|
|
|
|
28
|
return $uri if 'http' ne $uri->scheme; |
17
|
|
|
|
|
|
|
|
18
|
4
|
|
|
|
|
217
|
my $host = eval { $uri->host }; |
|
4
|
|
|
|
|
16
|
|
19
|
4
|
50
|
|
|
|
168
|
return $uri unless $host; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Don't coralize the coralized. |
22
|
4
|
100
|
|
|
|
18
|
return $uri if $host =~ m[ (?:^ | \.) nyud.net $]x; |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
|
|
18
|
my $new = $uri->clone; |
25
|
|
|
|
|
|
|
|
26
|
3
|
100
|
|
|
|
29
|
if (80 != $uri->port) { |
27
|
1
|
|
|
|
|
38
|
$host .= '.' . $uri->port; |
28
|
1
|
|
|
|
|
28
|
$new->port(undef); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
|
|
|
145
|
$host .= '.nyud.net'; |
32
|
|
|
|
|
|
|
|
33
|
3
|
|
|
|
|
11
|
$new->host($host); |
34
|
|
|
|
|
|
|
|
35
|
3
|
|
|
|
|
197
|
return $new; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |