line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenPlugin::HttpHeader; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# $Id: HttpHeader.pm,v 1.21 2003/04/03 01:51:24 andreychek Exp $ |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1135
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
@OpenPlugin::HttpHeader::ISA = qw( OpenPlugin::Plugin ); |
8
|
|
|
|
|
|
|
$OpenPlugin::HttpHeader::VERSION = sprintf("%d.%02d", q$Revision: 1.21 $ =~ /(\d+)\.(\d+)/); |
9
|
|
|
|
|
|
|
|
10
|
12
|
|
|
12
|
0
|
67
|
sub OP { return $_[0]->{_m}{OP} } |
11
|
0
|
|
|
0
|
0
|
0
|
sub type { return 'httpheader' } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
*get = \*get_incoming; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Retrieve a list of headers sent from the browser to us |
17
|
|
|
|
|
|
|
sub get_incoming { |
18
|
1
|
|
|
1
|
0
|
2
|
my ( $self, $name ) = @_; |
19
|
|
|
|
|
|
|
|
20
|
1
|
50
|
|
|
|
4
|
unless ( $name ) { |
21
|
0
|
|
|
|
|
0
|
return keys %{ $self->state->{incoming} }; |
|
0
|
|
|
|
|
0
|
|
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
50
|
|
|
3
|
return $self->state->{ incoming }{ $name } || undef; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Tell OpenPlugin about the headers we've been sent |
28
|
|
|
|
|
|
|
sub set_incoming { |
29
|
1
|
|
|
1
|
0
|
4
|
my ( $self, $name, $value ) = @_; |
30
|
1
|
50
|
|
|
|
6
|
return undef if ( $name eq "Cookie" ); |
31
|
1
|
50
|
33
|
|
|
8
|
return undef unless ( $name ) && ( defined($value) ); |
32
|
1
|
|
|
|
|
17
|
$self->state->{ incoming }{ $name } = $value; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Display headers in the outgoing headers queue |
36
|
|
|
|
|
|
|
sub get_outgoing { |
37
|
1
|
|
|
1
|
0
|
2
|
my ( $self, $name ) = @_; |
38
|
|
|
|
|
|
|
|
39
|
1
|
50
|
|
|
|
4
|
unless ( $name ) { |
40
|
0
|
|
|
|
|
0
|
return keys %{ $self->state->{ outgoing } }; |
|
0
|
|
|
|
|
0
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
50
|
|
|
4
|
return $self->state->{ outgoing }{ $name } || undef; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
*set = \*set_outgoing; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# Save a header to the outgoing queue |
49
|
|
|
|
|
|
|
sub set_outgoing { |
50
|
1
|
|
|
1
|
0
|
4
|
my ( $self, $name, $value ) = @_; |
51
|
1
|
50
|
|
|
|
4
|
return undef unless ( $name ); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# If the headers were passed in as a reference to a hash |
54
|
1
|
50
|
|
|
|
4
|
if( ref $name eq "HASH" ) { |
55
|
0
|
|
|
|
|
0
|
while( my( $key, $val ) = each %{ $name } ) { |
|
0
|
|
|
|
|
0
|
|
56
|
0
|
|
|
|
|
0
|
$self->_set_outgoing( $key, $val ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
else { |
60
|
1
|
|
|
|
|
9
|
$self->_set_outgoing( $name, $value ); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# Called by set_outgoing, tells OpenPlugin to add a header to the outgoing queue |
65
|
|
|
|
|
|
|
sub _set_outgoing { |
66
|
1
|
|
|
1
|
|
3
|
my ( $self, $name, $value ) = @_; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# Remove a header from the outgoing queue |
69
|
1
|
50
|
33
|
|
|
7
|
if (( $name ) && ( !defined $value )) { |
70
|
0
|
|
|
|
|
0
|
delete $self->{_m}{OP}{_state}{HttpHeader}{outgoing}{ $name }; |
71
|
0
|
|
|
|
|
0
|
return; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
1
|
|
|
|
|
4
|
return $self->state->{ outgoing }{ $name } = $value; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
0
|
0
|
|
sub send_outgoing {} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |