Mercurial > hg > nginx-tests
comparison spdy.t @ 639:2b43ad56bce0
Tests: fixed typos.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 30 Jul 2015 13:26:50 +0300 |
parents | 6cdfd177319b |
children | 626bc3a0fdaa |
comparison
equal
deleted
inserted
replaced
638:f758c780c508 | 639:2b43ad56bce0 |
---|---|
151 $sess = new_session(); | 151 $sess = new_session(); |
152 my $sid1 = spdy_stream($sess, { path => '/s' }); | 152 my $sid1 = spdy_stream($sess, { path => '/s' }); |
153 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | 153 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); |
154 | 154 |
155 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | 155 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
156 ok($frame, 'SYN_REPLAY frame'); | 156 ok($frame, 'SYN_REPLY frame'); |
157 is($frame->{sid}, $sid1, 'SYN_REPLAY stream'); | 157 is($frame->{sid}, $sid1, 'SYN_REPLY stream'); |
158 is($frame->{headers}->{':status'}, 200, 'SYN_REPLAY status'); | 158 is($frame->{headers}->{':status'}, 200, 'SYN_REPLY status'); |
159 is($frame->{headers}->{'x-header'}, 'X-Foo', 'SYN_REPLAY header'); | 159 is($frame->{headers}->{'x-header'}, 'X-Foo', 'SYN_REPLY header'); |
160 | 160 |
161 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | 161 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
162 ok($frame, 'DATA frame'); | 162 ok($frame, 'DATA frame'); |
163 is($frame->{length}, length 'body', 'DATA length'); | 163 is($frame->{length}, length 'body', 'DATA length'); |
164 is($frame->{data}, 'body', 'DATA payload'); | 164 is($frame->{data}, 'body', 'DATA payload'); |
167 | 167 |
168 my $sid2 = spdy_stream($sess, { path => '/s' }); | 168 my $sid2 = spdy_stream($sess, { path => '/s' }); |
169 $frames = spdy_read($sess, all => [{ sid => $sid2, fin => 1 }]); | 169 $frames = spdy_read($sess, all => [{ sid => $sid2, fin => 1 }]); |
170 | 170 |
171 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | 171 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
172 is($frame->{sid}, $sid2, 'SYN_REPLAY stream 2'); | 172 is($frame->{sid}, $sid2, 'SYN_REPLY stream 2'); |
173 is($frame->{headers}->{':status'}, 200, 'SYN_REPLAY status 2'); | 173 is($frame->{headers}->{':status'}, 200, 'SYN_REPLY status 2'); |
174 is($frame->{headers}->{'x-header'}, 'X-Foo', 'SYN_REPLAY header 2'); | 174 is($frame->{headers}->{'x-header'}, 'X-Foo', 'SYN_REPLY header 2'); |
175 | 175 |
176 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | 176 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
177 ok($frame, 'DATA frame 2'); | 177 ok($frame, 'DATA frame 2'); |
178 is($frame->{sid}, $sid2, 'SYN_REPLAY stream 2'); | 178 is($frame->{sid}, $sid2, 'SYN_REPLY stream 2'); |
179 is($frame->{length}, length 'body', 'DATA length 2'); | 179 is($frame->{length}, length 'body', 'DATA length 2'); |
180 is($frame->{data}, 'body', 'DATA payload 2'); | 180 is($frame->{data}, 'body', 'DATA payload 2'); |
181 | 181 |
182 # HEAD | 182 # HEAD |
183 | 183 |
184 $sess = new_session(); | 184 $sess = new_session(); |
185 $sid1 = spdy_stream($sess, { path => '/s', method => 'HEAD' }); | 185 $sid1 = spdy_stream($sess, { path => '/s', method => 'HEAD' }); |
186 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | 186 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); |
187 | 187 |
188 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | 188 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
189 is($frame->{sid}, $sid1, 'SYN_REPLAY stream HEAD'); | 189 is($frame->{sid}, $sid1, 'SYN_REPLY stream HEAD'); |
190 is($frame->{headers}->{':status'}, 200, 'SYN_REPLAY status HEAD'); | 190 is($frame->{headers}->{':status'}, 200, 'SYN_REPLY status HEAD'); |
191 is($frame->{headers}->{'x-header'}, 'X-Foo', 'SYN_REPLAY header HEAD'); | 191 is($frame->{headers}->{'x-header'}, 'X-Foo', 'SYN_REPLY header HEAD'); |
192 | 192 |
193 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | 193 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
194 is($frame, undef, 'HEAD no body'); | 194 is($frame, undef, 'HEAD no body'); |
195 | 195 |
196 # GET with PROXY protocol | 196 # GET with PROXY protocol |
199 $sess = new_session(8082, proxy => $proxy); | 199 $sess = new_session(8082, proxy => $proxy); |
200 $sid1 = spdy_stream($sess, { path => '/pp' }); | 200 $sid1 = spdy_stream($sess, { path => '/pp' }); |
201 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | 201 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); |
202 | 202 |
203 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | 203 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
204 ok($frame, 'PROXY SYN_REPLAY frame'); | 204 ok($frame, 'PROXY SYN_REPLY frame'); |
205 is($frame->{headers}->{'x-pp'}, '192.0.2.1', 'PROXY remote addr'); | 205 is($frame->{headers}->{'x-pp'}, '192.0.2.1', 'PROXY remote addr'); |
206 | 206 |
207 # request header | 207 # request header |
208 | 208 |
209 $sess = new_session(); | 209 $sess = new_session(); |
211 headers => { "range" => "bytes=10-19" } | 211 headers => { "range" => "bytes=10-19" } |
212 }); | 212 }); |
213 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | 213 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); |
214 | 214 |
215 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | 215 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
216 is($frame->{headers}->{':status'}, 206, 'SYN_REPLAY status range'); | 216 is($frame->{headers}->{':status'}, 206, 'SYN_REPLY status range'); |
217 | 217 |
218 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | 218 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
219 is($frame->{length}, 10, 'DATA length range'); | 219 is($frame->{length}, 10, 'DATA length range'); |
220 is($frame->{data}, '002XXXX000', 'DATA payload range'); | 220 is($frame->{data}, '002XXXX000', 'DATA payload range'); |
221 | 221 |
299 $sess = new_session(); | 299 $sess = new_session(); |
300 $sid1 = spdy_stream($sess, { path => '/redirect' }); | 300 $sid1 = spdy_stream($sess, { path => '/redirect' }); |
301 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | 301 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); |
302 | 302 |
303 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | 303 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
304 is($frame->{headers}->{':status'}, 405, 'SYN_REPLAY status with redirect'); | 304 is($frame->{headers}->{':status'}, 405, 'SYN_REPLY status with redirect'); |
305 | 305 |
306 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | 306 ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
307 ok($frame, 'DATA frame with redirect'); | 307 ok($frame, 'DATA frame with redirect'); |
308 is($frame->{data}, 'body', 'DATA payload with redirect'); | 308 is($frame->{data}, 'body', 'DATA payload with redirect'); |
309 | 309 |