line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Proxy::BodyFilter::htmltext; |
2
|
|
|
|
|
|
|
$HTTP::Proxy::BodyFilter::htmltext::VERSION = '0.302'; |
3
|
4
|
|
|
4
|
|
17788
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
123
|
|
4
|
4
|
|
|
4
|
|
14
|
use Carp; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
198
|
|
5
|
4
|
|
|
4
|
|
353
|
use HTTP::Proxy::BodyFilter; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
98
|
|
6
|
4
|
|
|
4
|
|
17
|
use vars qw( @ISA ); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
1673
|
|
7
|
|
|
|
|
|
|
@ISA = qw( HTTP::Proxy::BodyFilter ); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub init { |
10
|
3
|
50
|
|
3
|
1
|
11
|
croak "Parameter must be a CODE reference" unless ref $_[1] eq 'CODE'; |
11
|
3
|
|
|
|
|
17
|
$_[0]->{_filter} = $_[1]; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
1
|
5
|
sub begin { $_[0]->{js} = 0; } # per message initialisation |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub filter { |
17
|
6
|
|
|
6
|
1
|
20
|
my ( $self, $dataref, $message, $protocol, $buffer ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
6
|
|
|
|
|
18
|
my $pos = pos($$dataref) = 0; |
20
|
66
|
|
|
|
|
52
|
SCAN: |
21
|
|
|
|
|
|
|
{ |
22
|
6
|
|
|
|
|
10
|
$pos = pos($$dataref); |
23
|
|
|
|
|
|
|
$$dataref =~ /\G<\s*(?:script|style)[^>]*>/cgi # protect |
24
|
66
|
50
|
|
|
|
176
|
&& do { $self->{js} = 1; redo SCAN; }; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
25
|
|
|
|
|
|
|
$$dataref =~ /\G<\s*\/\s*(?:script|style)[^>]*>/cgi # unprotect |
26
|
66
|
100
|
|
|
|
106
|
&& do { $self->{js} = 0; redo SCAN; }; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1
|
|
27
|
|
|
|
|
|
|
# comments are considered as text |
28
|
|
|
|
|
|
|
# if you want comments as comments, |
29
|
|
|
|
|
|
|
# use HTTP::Proxy::BodyFilter::htmlparser |
30
|
65
|
50
|
|
|
|
104
|
$$dataref =~ /\G |