line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Protocol::SPDY::Frame::HeaderSupport; |
2
|
|
|
|
|
|
|
$Protocol::SPDY::Frame::HeaderSupport::VERSION = '1.001'; |
3
|
3
|
|
|
3
|
|
1143
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
92
|
|
4
|
3
|
|
|
3
|
|
10
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
66
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Protocol::SPDY::Frame::HeaderSupport - helper methods for frames which contain header data |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
version 1.001 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
The SYN_STREAM, SYN_REPLY and HEADERS frame types all use the same method for specifying |
19
|
|
|
|
|
|
|
HTTP-style headers. This class provides common methods for interacting with that header |
20
|
|
|
|
|
|
|
data. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Mainly for internal use - see L and L |
23
|
|
|
|
|
|
|
instead. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
3
|
|
|
3
|
|
9
|
use Protocol::SPDY::Constants ':all'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
1416
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 header |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Returns undef if the given header is not found, otherwise returns |
32
|
|
|
|
|
|
|
a scalar holding the \0-separated values found for this header. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub header { |
37
|
26
|
|
|
26
|
1
|
12771
|
my $self = shift; |
38
|
26
|
|
|
|
|
43
|
my $k = shift; |
39
|
26
|
|
|
|
|
32
|
my ($hdr) = grep $_->[0] eq $k, @{$self->{headers}}; |
|
26
|
|
|
|
|
170
|
|
40
|
26
|
50
|
|
|
|
74
|
return undef unless $hdr; |
41
|
26
|
|
|
|
|
210
|
return join "\0", @$hdr[1..$#$hdr]; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 headers |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Returns the arrayref structure of headers. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
[ [ header1 => value1, value2 ], [ header2 => value... ] ] |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
18
|
|
|
18
|
1
|
86
|
sub headers { shift->{headers} } |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 header_list |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Returns the list of header names (in the order in which we received them). |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub header_list { |
61
|
4
|
|
|
4
|
1
|
10
|
my $self = shift; |
62
|
4
|
|
|
|
|
6
|
map $_->[0], @{$self->{headers}}; |
|
4
|
|
|
|
|
96
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 header_line |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Returns a string describing the current header values, for debugging. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub header_line { |
72
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
73
|
0
|
|
|
|
|
0
|
join ',', map { $_->[0] . '=' . join ',', @{$_}[ 1 .. $#{$_} ] } @{$self->{headers}}; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 headers_as_hashref |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Returns a hashref representation of the headers. Values |
79
|
|
|
|
|
|
|
are all arrayrefs. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub headers_as_hashref { |
84
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
85
|
|
|
|
|
|
|
# this all seems needlessly overcomplicated |
86
|
0
|
|
|
|
|
0
|
my %h = map { |
87
|
0
|
|
|
|
|
0
|
$_->[0] => [ @{$_}[ 1 .. $#{$_} ] ] |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
88
|
0
|
|
|
|
|
0
|
} @{$self->{headers}}; |
89
|
0
|
|
|
|
|
0
|
\%h |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 headers_as_simple_hashref |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Returns a hashref representation of the headers where values |
95
|
|
|
|
|
|
|
are comma-separated strings. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub headers_as_simple_hashref { |
100
|
8
|
|
|
8
|
1
|
12
|
my $self = shift; |
101
|
|
|
|
|
|
|
# this all seems needlessly overcomplicated |
102
|
2
|
|
|
|
|
11
|
my %h = map { |
103
|
2
|
|
|
|
|
7
|
$_->[0] => join ',', @{$_}[ 1 .. $#{$_} ] |
|
2
|
|
|
|
|
4
|
|
|
8
|
|
|
|
|
27
|
|
104
|
8
|
|
|
|
|
10
|
} @{$self->{headers}}; |
105
|
8
|
|
|
|
|
20
|
\%h |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 header_hashref_to_arrayref |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Converts a hashref of key=>value information into an arrayref structure. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub header_hashref_to_arrayref { |
115
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
116
|
0
|
|
|
|
|
|
my $hdr = shift; |
117
|
|
|
|
|
|
|
return [ |
118
|
0
|
|
|
|
|
|
map {; [ $_ => split /\0/, $hdr->{$_} ] } sort keys %$hdr |
|
0
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
] |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
__END__ |