line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package LWP::Protocol::nogo; |
2
|
|
|
|
|
|
|
# If you want to disable access to a particular scheme, use this |
3
|
|
|
|
|
|
|
# class and then call |
4
|
|
|
|
|
|
|
# LWP::Protocol::implementor(that_scheme, 'LWP::Protocol::nogo'); |
5
|
|
|
|
|
|
|
# For then on, attempts to access URLs with that scheme will generate |
6
|
|
|
|
|
|
|
# a 500 error. |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '6.34'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require HTTP::Response; |
13
|
|
|
|
|
|
|
require HTTP::Status; |
14
|
1
|
|
|
1
|
|
5
|
use base qw(LWP::Protocol); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
152
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub request { |
17
|
1
|
|
|
1
|
1
|
2
|
my($self, $request) = @_; |
18
|
1
|
|
|
|
|
4
|
my $scheme = $request->uri->scheme; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
26
|
return HTTP::Response->new( |
21
|
|
|
|
|
|
|
HTTP::Status::RC_INTERNAL_SERVER_ERROR, |
22
|
|
|
|
|
|
|
"Access to \'$scheme\' URIs has been disabled" |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
1; |