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