line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Protocol::SPDY::Frame::Control::SYN_STREAM; |
2
|
|
|
|
|
|
|
$Protocol::SPDY::Frame::Control::SYN_STREAM::VERSION = '1.001'; |
3
|
3
|
|
|
3
|
|
13
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
87
|
|
4
|
3
|
|
|
3
|
|
11
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
80
|
|
5
|
3
|
|
|
3
|
|
12
|
use parent qw(Protocol::SPDY::Frame::HeaderSupport Protocol::SPDY::Frame::Control); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
12
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Protocol::SPDY::Frame::Control::SYN_STREAM - stream creation request packet for SPDY protocol |
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
|
|
158
|
use Protocol::SPDY::Constants ':all'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1543
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 type_name |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
The string type for this frame ('SYN_STREAM'). |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
11
|
|
|
11
|
1
|
58
|
sub type_name { 'SYN_STREAM' } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 new |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Instantiate. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub new { |
40
|
18
|
|
|
18
|
1
|
25
|
my $class = shift; |
41
|
18
|
|
|
|
|
88
|
my %args = @_; |
42
|
18
|
50
|
50
|
|
|
75
|
$args{headers} = $class->header_hashref_to_arrayref($args{headers}) if (ref($args{headers}) || '') eq 'HASH'; |
43
|
18
|
|
|
|
|
120
|
$class->SUPER::new(%args) |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 slot |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Which credential slot we're using (unimplemented). |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
9
|
|
|
9
|
1
|
26
|
sub slot { shift->{slot} } |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 from_data |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Instantiate from the given data. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub from_data { |
61
|
10
|
|
|
10
|
1
|
17
|
my $class = shift; |
62
|
10
|
|
|
|
|
30
|
my %args = @_; |
63
|
10
|
|
|
|
|
70
|
my ($stream_id, $associated_stream_id, $slot) = unpack "N1N1n1", substr $args{data}, 0, 10, ''; |
64
|
10
|
|
|
|
|
17
|
$stream_id &= ~0x80000000; |
65
|
10
|
|
|
|
|
14
|
$associated_stream_id &= ~0x80000000; |
66
|
10
|
|
|
|
|
17
|
my $pri = ($slot & 0xE000) >> 13; |
67
|
10
|
|
|
|
|
13
|
$slot &= 0xFF; |
68
|
|
|
|
|
|
|
|
69
|
10
|
|
|
|
|
25
|
my $zlib = delete $args{zlib}; |
70
|
10
|
|
|
|
|
109
|
my $out = $zlib->decompress($args{data}); |
71
|
10
|
|
|
|
|
64
|
my ($headers) = $class->extract_headers($out); |
72
|
10
|
|
|
|
|
57
|
$class->new( |
73
|
|
|
|
|
|
|
%args, |
74
|
|
|
|
|
|
|
stream_id => $stream_id, |
75
|
|
|
|
|
|
|
associated_stream_id => $associated_stream_id, |
76
|
|
|
|
|
|
|
priority => $pri, |
77
|
|
|
|
|
|
|
slot => $slot, |
78
|
|
|
|
|
|
|
headers => $headers, |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 stream_id |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Our stream ID. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
87
|
|
|
|
|
|
|
|
88
|
25
|
|
|
25
|
1
|
2973
|
sub stream_id { shift->{stream_id} } |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 associated_stream_id |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
The stream to which we're associated. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
11
|
|
|
11
|
1
|
61
|
sub associated_stream_id { shift->{associated_stream_id} } |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 priority |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Our priority. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
15
|
|
|
15
|
1
|
62
|
sub priority { shift->{priority} } |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 as_packet |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Returns byte representation for this frame. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub as_packet { |
113
|
9
|
|
|
9
|
1
|
15
|
my $self = shift; |
114
|
9
|
|
|
|
|
18
|
my $zlib = shift; |
115
|
9
|
|
|
|
|
52
|
my $payload = pack 'N1', $self->stream_id & 0x7FFFFFFF; |
116
|
9
|
|
50
|
|
|
30
|
$payload .= pack 'N1', ($self->associated_stream_id || 0) & 0x7FFFFFFF; |
117
|
9
|
|
|
|
|
26
|
$payload .= pack 'C1', ($self->priority & 0x07) << 5; |
118
|
9
|
|
|
|
|
31
|
$payload .= pack 'C1', $self->slot; |
119
|
9
|
|
|
|
|
14
|
my $block = $self->pairs_to_nv_header(map {; $_->[0], join "\0", @{$_}[1..$#$_] } @{$self->headers}); |
|
11
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
42
|
|
|
9
|
|
|
|
|
46
|
|
120
|
9
|
|
|
|
|
39
|
$payload .= $zlib->compress($block); |
121
|
9
|
|
|
|
|
59
|
return $self->SUPER::as_packet( |
122
|
|
|
|
|
|
|
payload => $payload, |
123
|
|
|
|
|
|
|
); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 to_string |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
String representation, for debugging. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub to_string { |
133
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
134
|
0
|
|
|
|
|
|
$self->SUPER::to_string . ', id=' . $self->stream_id . ', ' . $self->header_line; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
__END__ |