line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Protocol::SPDY::Frame::Control::HEADERS; |
2
|
|
|
|
|
|
|
$Protocol::SPDY::Frame::Control::HEADERS::VERSION = '1.001'; |
3
|
3
|
|
|
3
|
|
11
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
97
|
|
4
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
77
|
|
5
|
3
|
|
|
3
|
|
11
|
use parent qw(Protocol::SPDY::Frame::HeaderSupport Protocol::SPDY::Frame::Control); |
|
3
|
|
|
|
|
2
|
|
|
3
|
|
|
|
|
16
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Protocol::SPDY::Frame::Control::HEADERS - header update packet |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
version 1.001 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
See L and L. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
3
|
|
|
3
|
|
216
|
use Compress::Raw::Zlib qw(Z_OK WANT_GZIP_OR_ZLIB adler32); |
|
3
|
|
|
|
|
2
|
|
|
3
|
|
|
|
|
182
|
|
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
3
|
|
14
|
use Protocol::SPDY::Constants ':all'; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
1311
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head2 type_name |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
The string type for this frame ('HEADERS'). |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
12
|
|
|
12
|
1
|
40
|
sub type_name { 'HEADERS' } |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 new |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Instantiate. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub new { |
42
|
4
|
|
|
4
|
1
|
7
|
my $class = shift; |
43
|
4
|
|
|
|
|
15
|
my %args = @_; |
44
|
4
|
50
|
50
|
|
|
19
|
$args{headers} = $class->header_hashref_to_arrayref($args{headers}) if (ref($args{headers}) || '') eq 'HASH'; |
45
|
4
|
|
|
|
|
32
|
$class->SUPER::new(%args) |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 from_data |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Instantiate from the given data. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub from_data { |
55
|
2
|
|
|
2
|
1
|
3
|
my $class = shift; |
56
|
2
|
|
|
|
|
7
|
my %args = @_; |
57
|
2
|
|
|
|
|
7
|
my ($stream_id) = unpack "N1", substr $args{data}, 0, 4, ''; |
58
|
2
|
|
|
|
|
3
|
$stream_id &= ~0x80000000; |
59
|
|
|
|
|
|
|
|
60
|
2
|
|
|
|
|
4
|
my $zlib = delete $args{zlib}; |
61
|
2
|
|
|
|
|
8
|
my $out = $zlib->decompress($args{data}); |
62
|
2
|
|
|
|
|
19
|
my ($headers) = $class->extract_headers($out); |
63
|
2
|
|
|
|
|
9
|
$class->new( |
64
|
|
|
|
|
|
|
%args, |
65
|
|
|
|
|
|
|
stream_id => $stream_id, |
66
|
|
|
|
|
|
|
headers => $headers, |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 stream_id |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Which stream this frame applies to. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
4
|
|
|
4
|
1
|
13
|
sub stream_id { shift->{stream_id} } |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 as_packet |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Byte representation for this packet. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub as_packet { |
85
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
86
|
2
|
|
|
|
|
2
|
my $zlib = shift; |
87
|
2
|
|
|
|
|
8
|
my $payload = pack 'N1', $self->stream_id & 0x7FFFFFFF; |
88
|
2
|
|
|
|
|
4
|
my $block = $self->pairs_to_nv_header(map {; $_->[0], join "\0", @{$_}[1..$#$_] } @{$self->headers}); |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
17
|
|
|
2
|
|
|
|
|
10
|
|
89
|
2
|
|
|
|
|
9
|
$payload .= $zlib->compress($block); |
90
|
2
|
|
|
|
|
22
|
return $self->SUPER::as_packet( |
91
|
|
|
|
|
|
|
payload => $payload, |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 to_string |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
String representation, for debugging. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub to_string { |
102
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
103
|
0
|
|
|
|
|
|
$self->SUPER::to_string . ', id=' . $self->stream_id . ', ' . $self->header_line; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
__END__ |