Mercurial > hg > nginx-tests
annotate spdy.t @ 501:0ee2899fbe3e
Tests: proxy_cache_lock_age tests.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 24 Nov 2014 17:01:25 +0300 |
parents | 8474d27c9147 |
children | 071e8941e3bf |
rev | line source |
---|---|
374 | 1 #!/usr/bin/perl |
2 | |
3 # (C) Sergey Kandaurov | |
4 # (C) Nginx, Inc. | |
5 | |
6 # Tests for SPDY protocol version 3.1. | |
7 | |
8 ############################################################################### | |
9 | |
10 use warnings; | |
11 use strict; | |
12 | |
13 use Test::More; | |
14 | |
15 use IO::Select; | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
16 use Socket qw/ CRLF /; |
374 | 17 |
18 BEGIN { use FindBin; chdir($FindBin::Bin); } | |
19 | |
20 use lib 'lib'; | |
21 use Test::Nginx; | |
22 | |
23 ############################################################################### | |
24 | |
25 select STDERR; $| = 1; | |
26 select STDOUT; $| = 1; | |
27 | |
28 eval { | |
29 require Compress::Raw::Zlib; | |
30 Compress::Raw::Zlib->Z_OK; | |
31 Compress::Raw::Zlib->Z_SYNC_FLUSH; | |
32 Compress::Raw::Zlib->Z_NO_COMPRESSION; | |
33 Compress::Raw::Zlib->WANT_GZIP_OR_ZLIB; | |
34 }; | |
35 plan(skip_all => 'Compress::Raw::Zlib not installed') if $@; | |
36 plan(skip_all => 'win32') if $^O eq 'MSWin32'; | |
37 | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
38 my $t = Test::Nginx->new() |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
39 ->has(qw/http proxy cache limit_conn rewrite spdy realip/); |
374 | 40 |
487
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
41 $t->plan(82)->write_file_expand('nginx.conf', <<'EOF'); |
374 | 42 |
43 %%TEST_GLOBALS%% | |
44 | |
45 daemon off; | |
46 | |
47 events { | |
48 } | |
49 | |
50 http { | |
51 %%TEST_GLOBALS_HTTP%% | |
52 | |
53 proxy_cache_path %%TESTDIR%%/cache keys_zone=NAME:10m; | |
54 limit_conn_zone $binary_remote_addr zone=conn:1m; | |
55 | |
56 server { | |
57 listen 127.0.0.1:8080 spdy; | |
58 listen 127.0.0.1:8081; | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
59 listen 127.0.0.1:8082 proxy_protocol spdy; |
374 | 60 server_name localhost; |
61 | |
62 location /s { | |
63 add_header X-Header X-Foo; | |
64 return 200 'body'; | |
65 } | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
66 location /pp { |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
67 set_real_ip_from 127.0.0.1/32; |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
68 real_ip_header proxy_protocol; |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
69 alias %%TESTDIR%%/t2.html; |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
70 add_header X-PP $remote_addr; |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
71 } |
374 | 72 location /spdy { |
73 return 200 $spdy; | |
74 } | |
75 location /prio { | |
76 return 200 $spdy_request_priority; | |
77 } | |
78 location /chunk_size { | |
79 spdy_chunk_size 1; | |
80 return 200 'body'; | |
81 } | |
82 location /redirect { | |
83 error_page 405 /s; | |
84 return 405; | |
85 } | |
86 location /proxy { | |
87 add_header X-Body "$request_body"; | |
88 proxy_pass http://127.0.0.1:8081/; | |
89 proxy_cache NAME; | |
90 proxy_cache_valid 1m; | |
91 } | |
487
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
92 location /header/ { |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
93 proxy_pass http://127.0.0.1:8083/; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
94 } |
428
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
95 location /proxy_buffering_off { |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
96 proxy_pass http://127.0.0.1:8081/; |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
97 proxy_cache NAME; |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
98 proxy_cache_valid 1m; |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
99 proxy_buffering off; |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
100 } |
374 | 101 location /t3.html { |
102 limit_conn conn 1; | |
103 } | |
442
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
104 location /set-cookie { |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
105 add_header Set-Cookie val1; |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
106 add_header Set-Cookie val2; |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
107 return 200; |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
108 } |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
109 location /cookie { |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
110 add_header X-Cookie $http_cookie; |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
111 return 200; |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
112 } |
374 | 113 } |
114 } | |
115 | |
116 EOF | |
117 | |
487
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
118 $t->run_daemon(\&http_daemon); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
119 $t->run()->waitforsocket('127.0.0.1:8083'); |
374 | 120 |
121 # file size is slightly beyond initial window size: 2**16 + 80 bytes | |
122 | |
123 $t->write_file('t1.html', | |
124 join('', map { sprintf "X%04dXXX", $_ } (1 .. 8202))); | |
125 | |
126 $t->write_file('t2.html', 'SEE-THIS'); | |
127 $t->write_file('t3.html', 'SEE-THIS'); | |
128 | |
129 my %cframe = ( | |
130 2 => \&syn_reply, | |
131 3 => \&rst_stream, | |
132 4 => \&settings, | |
133 6 => \&ping, | |
134 7 => \&goaway, | |
135 9 => \&window_update | |
136 ); | |
137 | |
138 ############################################################################### | |
139 | |
140 # PING | |
141 | |
142 my $sess = new_session(); | |
143 spdy_ping($sess, 0x12345678); | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
144 my $frames = spdy_read($sess, all => [{ type => 'PING' }]); |
374 | 145 |
146 my ($frame) = grep { $_->{type} eq "PING" } @$frames; | |
147 ok($frame, 'PING frame'); | |
148 is($frame->{value}, 0x12345678, 'PING payload'); | |
149 | |
150 # GET | |
151 | |
152 $sess = new_session(); | |
153 my $sid1 = spdy_stream($sess, { path => '/s' }); | |
154 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
155 | |
156 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
157 ok($frame, 'SYN_REPLAY frame'); | |
158 is($frame->{sid}, $sid1, 'SYN_REPLAY stream'); | |
159 is($frame->{headers}->{':status'}, 200, 'SYN_REPLAY status'); | |
160 is($frame->{headers}->{'x-header'}, 'X-Foo', 'SYN_REPLAY header'); | |
161 | |
162 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
163 ok($frame, 'DATA frame'); | |
164 is($frame->{length}, length 'body', 'DATA length'); | |
165 is($frame->{data}, 'body', 'DATA payload'); | |
166 | |
167 # GET in new SPDY stream in same session | |
168 | |
169 my $sid2 = spdy_stream($sess, { path => '/s' }); | |
170 $frames = spdy_read($sess, all => [{ sid => $sid2, fin => 1 }]); | |
171 | |
172 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
173 is($frame->{sid}, $sid2, 'SYN_REPLAY stream 2'); | |
174 is($frame->{headers}->{':status'}, 200, 'SYN_REPLAY status 2'); | |
175 is($frame->{headers}->{'x-header'}, 'X-Foo', 'SYN_REPLAY header 2'); | |
176 | |
177 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
178 ok($frame, 'DATA frame 2'); | |
179 is($frame->{sid}, $sid2, 'SYN_REPLAY stream 2'); | |
180 is($frame->{length}, length 'body', 'DATA length 2'); | |
181 is($frame->{data}, 'body', 'DATA payload 2'); | |
182 | |
183 # HEAD | |
184 | |
185 $sess = new_session(); | |
186 $sid1 = spdy_stream($sess, { path => '/s', method => 'HEAD' }); | |
187 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
188 | |
189 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
190 is($frame->{sid}, $sid1, 'SYN_REPLAY stream HEAD'); | |
191 is($frame->{headers}->{':status'}, 200, 'SYN_REPLAY status HEAD'); | |
192 is($frame->{headers}->{'x-header'}, 'X-Foo', 'SYN_REPLAY header HEAD'); | |
193 | |
194 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
195 is($frame, undef, 'HEAD no body'); | |
196 | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
197 # GET with PROXY protocol |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
198 |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
199 my $proxy = 'PROXY TCP4 192.0.2.1 192.0.2.2 1234 5678' . CRLF; |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
200 $sess = new_session(8082, proxy => $proxy); |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
201 $sid1 = spdy_stream($sess, { path => '/pp' }); |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
202 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
203 |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
204 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
205 ok($frame, 'PROXY SYN_REPLAY frame'); |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
206 is($frame->{headers}->{'x-pp'}, '192.0.2.1', 'PROXY remote addr'); |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
207 |
374 | 208 # request header |
209 | |
210 $sess = new_session(); | |
211 $sid1 = spdy_stream($sess, { path => '/t1.html', | |
212 headers => { "range" => "bytes=10-19" } | |
213 }); | |
214 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
215 | |
216 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
217 is($frame->{headers}->{':status'}, 206, 'SYN_REPLAY status range'); | |
218 | |
219 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
220 is($frame->{length}, 10, 'DATA length range'); | |
221 is($frame->{data}, '002XXXX000', 'DATA payload range'); | |
222 | |
442
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
223 TODO: { |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
224 local $TODO = 'not yet' unless $t->has_version('1.7.4'); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
225 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
226 # request header with multiple values |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
227 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
228 $sess = new_session(); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
229 $sid1 = spdy_stream($sess, { path => '/cookie', |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
230 headers => { "cookie" => "val1\0val2" } |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
231 }); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
232 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
233 ok(grep ({ $_->{type} eq "SYN_REPLY" } @$frames), |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
234 'multiple request header values'); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
235 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
236 # request header with multiple values proxied to http backend |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
237 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
238 $sess = new_session(); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
239 $sid1 = spdy_stream($sess, { path => '/proxy/cookie', |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
240 headers => { "cookie" => "val1\0val2" } |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
241 }); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
242 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
243 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
244 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
245 is($frame->{headers}->{'x-cookie'}, 'val1; val2', |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
246 'multiple request header values - proxied'); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
247 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
248 } |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
249 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
250 # response header with multiple values |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
251 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
252 $sess = new_session(); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
253 $sid1 = spdy_stream($sess, { path => '/set-cookie' }); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
254 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
255 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
256 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
257 is($frame->{headers}->{'set-cookie'}, "val1\0val2", |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
258 'response header with multiple values'); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
259 |
487
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
260 # response header with multiple values - no empty values inside |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
261 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
262 TODO: { |
488
8474d27c9147
Tests: adjusted SPDY TODOs, fix committed.
Sergey Kandaurov <pluknet@nginx.com>
parents:
487
diff
changeset
|
263 local $TODO = 'not yet' unless $t->has_version('1.7.8'); |
487
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
264 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
265 $sess = new_session(); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
266 $sid1 = spdy_stream($sess, { path => '/header/inside' }); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
267 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
268 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
269 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
270 is($frame->{headers}->{'x-foo'}, "val1\0val2", 'no empty header value inside'); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
271 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
272 $sid1 = spdy_stream($sess, { path => '/header/first' }); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
273 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
274 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
275 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
276 is($frame->{headers}->{'x-foo'}, "val1\0val2", 'no empty header value first'); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
277 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
278 $sid1 = spdy_stream($sess, { path => '/header/last' }); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
279 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
280 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
281 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
282 is($frame->{headers}->{'x-foo'}, "val1\0val2", 'no empty header value last'); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
283 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
284 } |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
285 |
374 | 286 # $spdy |
287 | |
288 $sess = new_session(); | |
289 $sid1 = spdy_stream($sess, { path => '/spdy' }); | |
290 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
291 | |
292 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
293 is($frame->{data}, '3.1', 'spdy variable'); | |
294 | |
295 # spdy_chunk_size=1 | |
296 | |
297 $sess = new_session(); | |
298 $sid1 = spdy_stream($sess, { path => '/chunk_size' }); | |
299 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
300 | |
301 my @data = grep { $_->{type} eq "DATA" } @$frames; | |
302 is(@data, 4, 'chunk_size body chunks'); | |
303 is($data[0]->{data}, 'b', 'chunk_size body 1'); | |
304 is($data[1]->{data}, 'o', 'chunk_size body 2'); | |
305 is($data[2]->{data}, 'd', 'chunk_size body 3'); | |
306 is($data[3]->{data}, 'y', 'chunk_size body 4'); | |
307 | |
308 # redirect | |
309 | |
310 $sess = new_session(); | |
311 $sid1 = spdy_stream($sess, { path => '/redirect' }); | |
312 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
313 | |
314 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
315 is($frame->{headers}->{':status'}, 405, 'SYN_REPLAY status with redirect'); | |
316 | |
317 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
318 ok($frame, 'DATA frame with redirect'); | |
319 is($frame->{data}, 'body', 'DATA payload with redirect'); | |
320 | |
428
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
321 # SYN_REPLY could be received with fin, followed by DATA |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
322 |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
323 $sess = new_session(); |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
324 $sid1 = spdy_stream($sess, { path => '/proxy/t2.html', method => 'HEAD' }); |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
325 |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
326 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
327 push @$frames, $_ for @{spdy_read($sess, all => [{ sid => $sid1 }])}; |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
328 ok(!grep ({ $_->{type} eq "DATA" } @$frames), 'proxy cache HEAD - no body'); |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
329 |
374 | 330 # ensure that HEAD-like requests, i.e., without response body, do not lead to |
331 # client connection close due to cache filling up with upstream response body | |
332 | |
333 TODO: { | |
429
89f7a882d692
Tests: spdy.t TODO updated.
Maxim Dounin <mdounin@mdounin.ru>
parents:
428
diff
changeset
|
334 local $TODO = 'premature client connection close' |
89f7a882d692
Tests: spdy.t TODO updated.
Maxim Dounin <mdounin@mdounin.ru>
parents:
428
diff
changeset
|
335 unless $t->has_version('1.7.3'); |
374 | 336 |
337 $sid2 = spdy_stream($sess, { path => '/' }); | |
443
d1c4b0d15484
Tests: fixed SPDY test for premature client connection close.
Sergey Kandaurov <pluknet@nginx.com>
parents:
442
diff
changeset
|
338 $frames = spdy_read($sess, all => [{ sid => $sid2, fin => 1 }]); |
374 | 339 ok(grep ({ $_->{type} eq "SYN_REPLY" } @$frames), 'proxy cache headers only'); |
340 | |
341 } | |
342 | |
428
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
343 # HEAD on empty cache with proxy_buffering off |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
344 |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
345 $sess = new_session(); |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
346 $sid1 = spdy_stream($sess, |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
347 { path => '/proxy_buffering_off/t2.html?1', method => 'HEAD' }); |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
348 |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
349 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
350 push @$frames, $_ for @{spdy_read($sess, all => [{ sid => $sid1 }])}; |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
351 ok(!grep ({ $_->{type} eq "DATA" } @$frames), |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
352 'proxy cache HEAD buffering off - no body'); |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
353 |
374 | 354 # simple proxy cache test |
355 | |
356 $sess = new_session(); | |
357 $sid1 = spdy_stream($sess, { path => '/proxy/t2.html' }); | |
358 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
359 | |
360 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
361 is($frame->{headers}->{':status'}, '200 OK', 'proxy cache unconditional'); | |
362 | |
363 $sid2 = spdy_stream($sess, { path => '/proxy/t2.html', | |
416
5c25acbc870a
Tests: etags support is present in all supported branches.
Maxim Dounin <mdounin@mdounin.ru>
parents:
397
diff
changeset
|
364 headers => { "if-none-match" => $frame->{headers}->{'etag'} } |
374 | 365 }); |
366 $frames = spdy_read($sess, all => [{ sid => $sid2, fin => 1 }]); | |
367 | |
368 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
369 is($frame->{headers}->{':status'}, 304, 'proxy cache conditional'); | |
370 | |
371 # request body (uses proxied response) | |
372 | |
373 $sess = new_session(); | |
374 $sid1 = spdy_stream($sess, { path => '/proxy/t2.html', body => 'TEST' }); | |
375 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
376 | |
377 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
378 is($frame->{headers}->{'x-body'}, 'TEST', 'request body'); | |
379 | |
380 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
381 is($frame->{length}, length 'SEE-THIS', 'proxied response length'); | |
382 is($frame->{data}, 'SEE-THIS', 'proxied response'); | |
383 | |
384 # WINDOW_UPDATE (client side) | |
385 | |
386 $sess = new_session(); | |
387 $sid1 = spdy_stream($sess, { path => '/t1.html' }); | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
388 $frames = spdy_read($sess, all => [{ sid => $sid1, length => 2**16 }]); |
374 | 389 |
390 @data = grep { $_->{type} eq "DATA" } @$frames; | |
391 my $sum = eval join '+', map { $_->{length} } @data; | |
392 is($sum, 2**16, 'iws - stream blocked on initial window size'); | |
393 | |
394 spdy_ping($sess, 0xf00ff00f); | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
395 $frames = spdy_read($sess, all => [{ type => 'PING' }]); |
374 | 396 |
397 ($frame) = grep { $_->{type} eq "PING" } @$frames; | |
398 ok($frame, 'iws - PING not blocked'); | |
399 | |
400 spdy_window($sess, 2**16, $sid1); | |
401 $frames = spdy_read($sess); | |
402 is(@$frames, 0, 'iws - updated stream window'); | |
403 | |
404 spdy_window($sess, 2**16); | |
405 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
406 | |
407 @data = grep { $_->{type} eq "DATA" } @$frames; | |
408 $sum = eval join '+', map { $_->{length} } @data; | |
409 is($sum, 80, 'iws - updated connection window'); | |
410 | |
411 # SETTINGS (initial window size, client side) | |
412 | |
413 $sess = new_session(); | |
414 spdy_settings($sess, 7 => 2**17); | |
415 spdy_window($sess, 2**17); | |
416 | |
417 $sid1 = spdy_stream($sess, { path => '/t1.html' }); | |
418 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
419 | |
420 @data = grep { $_->{type} eq "DATA" } @$frames; | |
421 $sum = eval join '+', map { $_->{length} } @data; | |
422 is($sum, 2**16 + 80, 'increased initial window size'); | |
423 | |
424 # probe for negative available space in a flow control window | |
425 | |
426 $sess = new_session(); | |
427 $sid1 = spdy_stream($sess, { path => '/t1.html' }); | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
428 spdy_read($sess, all => [{ sid => $sid1, length => 2**16 }]); |
374 | 429 |
430 spdy_window($sess, 1); | |
431 spdy_settings($sess, 7 => 42); | |
432 spdy_window($sess, 1024, $sid1); | |
433 | |
434 $frames = spdy_read($sess); | |
435 is(@$frames, 0, 'negative window - no data'); | |
436 | |
437 spdy_window($sess, 2**16 - 42 - 1024, $sid1); | |
438 $frames = spdy_read($sess); | |
439 is(@$frames, 0, 'zero window - no data'); | |
440 | |
441 spdy_window($sess, 1, $sid1); | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
442 $frames = spdy_read($sess, all => [{ sid => $sid1, length => 1 }]); |
374 | 443 is(@$frames, 1, 'positive window - data'); |
444 is(@$frames[0]->{length}, 1, 'positive window - data length'); | |
445 | |
446 # stream multiplexing | |
447 | |
448 $sess = new_session(); | |
449 $sid1 = spdy_stream($sess, { path => '/t1.html' }); | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
450 $frames = spdy_read($sess, all => [{ sid => $sid1, length => 2**16 }]); |
374 | 451 |
452 @data = grep { $_->{type} eq "DATA" } @$frames; | |
453 $sum = eval join '+', map { $_->{length} } @data; | |
454 is($sum, 2**16, 'multiple - stream1 data'); | |
455 | |
456 $sid2 = spdy_stream($sess, { path => '/t1.html' }); | |
457 $frames = spdy_read($sess, all => [{ sid => $sid2, fin => 0 }]); | |
458 | |
459 @data = grep { $_->{type} eq "DATA" } @$frames; | |
460 is(@data, 0, 'multiple - stream2 no data'); | |
461 | |
462 spdy_window($sess, 2**17, $sid1); | |
463 spdy_window($sess, 2**17, $sid2); | |
464 spdy_window($sess, 2**17); | |
465 | |
466 $frames = spdy_read($sess, all => [ | |
467 { sid => $sid1, fin => 1 }, | |
468 { sid => $sid2, fin => 1 } | |
469 ]); | |
470 | |
471 @data = grep { $_->{type} eq "DATA" && $_->{sid} == $sid1 } @$frames; | |
472 $sum = eval join '+', map { $_->{length} } @data; | |
473 is($sum, 80, 'multiple - stream1 remain data'); | |
474 | |
475 @data = grep { $_->{type} eq "DATA" && $_->{sid} == $sid2 } @$frames; | |
476 $sum = eval join '+', map { $_->{length} } @data; | |
477 is($sum, 2**16 + 80, 'multiple - stream2 full data'); | |
478 | |
479 # request priority parsing in $spdy_request_priority | |
480 | |
481 $sess = new_session(); | |
482 $sid1 = spdy_stream($sess, { path => '/prio', prio => 0 }); | |
483 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
484 | |
485 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
486 is($frame->{data}, 0, 'priority 0'); | |
487 | |
488 $sid1 = spdy_stream($sess, { path => '/prio', prio => 1 }); | |
489 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
490 | |
491 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
492 is($frame->{data}, 1, 'priority 1'); | |
493 | |
494 $sid1 = spdy_stream($sess, { path => '/prio', prio => 7 }); | |
495 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
496 | |
497 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
498 is($frame->{data}, 7, 'priority 7'); | |
499 | |
500 # stream muliplexing + priority | |
501 | |
502 $sess = new_session(); | |
503 $sid1 = spdy_stream($sess, { path => '/t1.html', prio => 7 }); | |
504 $sid2 = spdy_stream($sess, { path => '/t2.html', prio => 0 }); | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
505 spdy_read($sess, all => [ |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
506 { sid => $sid1, length => 2**16 }, |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
507 { sid => $sid2, fin => 0 } |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
508 ]); |
374 | 509 |
510 spdy_window($sess, 2**17, $sid1); | |
511 spdy_window($sess, 2**17, $sid2); | |
512 spdy_window($sess, 2**17); | |
513 | |
514 $frames = spdy_read($sess, all => [ | |
515 { sid => $sid1, fin => 1 }, | |
516 { sid => $sid2, fin => 1 } | |
517 ]); | |
518 | |
519 @data = grep { $_->{type} eq "DATA" } @$frames; | |
520 is(join (' ', map { $_->{sid} } @data), "$sid2 $sid1", 'multiple priority 1'); | |
521 | |
522 # and vice versa | |
523 | |
524 $sess = new_session(); | |
525 $sid1 = spdy_stream($sess, { path => '/t1.html', prio => 0 }); | |
526 $sid2 = spdy_stream($sess, { path => '/t2.html', prio => 7 }); | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
527 spdy_read($sess, all => [ |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
528 { sid => $sid1, length => 2**16 }, |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
529 { sid => $sid2, fin => 0 } |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
530 ]); |
374 | 531 |
532 spdy_window($sess, 2**17, $sid1); | |
533 spdy_window($sess, 2**17, $sid2); | |
534 spdy_window($sess, 2**17); | |
535 | |
536 $frames = spdy_read($sess, all => [ | |
537 { sid => $sid1, fin => 1 }, | |
538 { sid => $sid2, fin => 1 } | |
539 ]); | |
540 | |
541 @data = grep { $_->{type} eq "DATA" } @$frames; | |
542 is(join (' ', map { $_->{sid} } @data), "$sid1 $sid2", 'multiple priority 2'); | |
543 | |
544 # limit_conn | |
545 | |
546 $sess = new_session(); | |
547 spdy_settings($sess, 7 => 1); | |
548 $sid1 = spdy_stream($sess, { path => '/t3.html' }); | |
549 $sid2 = spdy_stream($sess, { path => '/t3.html' }); | |
550 $frames = spdy_read($sess, all => [ | |
551 { sid => $sid1, fin => 0 }, | |
552 { sid => $sid2, fin => 0 } | |
553 ]); | |
554 | |
555 ($frame) = grep { $_->{type} eq "SYN_REPLY" && $_->{sid} == $sid1 } @$frames; | |
556 is($frame->{headers}->{':status'}, 200, 'conn_limit 1'); | |
557 | |
558 ($frame) = grep { $_->{type} eq "SYN_REPLY" && $_->{sid} == $sid2 } @$frames; | |
559 is($frame->{headers}->{':status'}, 503, 'conn_limit 2'); | |
560 | |
470
00275fa9091c
Tests: fixed SPDY test with limit_conn.
Sergey Kandaurov <pluknet@nginx.com>
parents:
443
diff
changeset
|
561 spdy_settings($sess, 7 => 2**16); |
00275fa9091c
Tests: fixed SPDY test with limit_conn.
Sergey Kandaurov <pluknet@nginx.com>
parents:
443
diff
changeset
|
562 |
00275fa9091c
Tests: fixed SPDY test with limit_conn.
Sergey Kandaurov <pluknet@nginx.com>
parents:
443
diff
changeset
|
563 spdy_read($sess, all => [ |
00275fa9091c
Tests: fixed SPDY test with limit_conn.
Sergey Kandaurov <pluknet@nginx.com>
parents:
443
diff
changeset
|
564 { sid => $sid1, fin => 1 }, |
00275fa9091c
Tests: fixed SPDY test with limit_conn.
Sergey Kandaurov <pluknet@nginx.com>
parents:
443
diff
changeset
|
565 { sid => $sid2, fin => 1 } |
00275fa9091c
Tests: fixed SPDY test with limit_conn.
Sergey Kandaurov <pluknet@nginx.com>
parents:
443
diff
changeset
|
566 ]); |
00275fa9091c
Tests: fixed SPDY test with limit_conn.
Sergey Kandaurov <pluknet@nginx.com>
parents:
443
diff
changeset
|
567 |
374 | 568 # limit_conn + client's RST_STREAM |
569 | |
570 $sess = new_session(); | |
571 spdy_settings($sess, 7 => 1); | |
572 $sid1 = spdy_stream($sess, { path => '/t3.html' }); | |
573 spdy_rst($sess, $sid1, 5); | |
574 $sid2 = spdy_stream($sess, { path => '/t3.html' }); | |
575 $frames = spdy_read($sess, all => [ | |
576 { sid => $sid1, fin => 0 }, | |
577 { sid => $sid2, fin => 0 } | |
578 ]); | |
579 | |
580 ($frame) = grep { $_->{type} eq "SYN_REPLY" && $_->{sid} == $sid1 } @$frames; | |
581 is($frame->{headers}->{':status'}, 200, 'RST_STREAM 1'); | |
582 | |
583 ($frame) = grep { $_->{type} eq "SYN_REPLY" && $_->{sid} == $sid2 } @$frames; | |
584 is($frame->{headers}->{':status'}, 200, 'RST_STREAM 2'); | |
585 | |
586 # GOAWAY on SYN_STREAM with even StreamID | |
587 | |
588 TODO: { | |
589 local $TODO = 'not yet'; | |
590 | |
591 $sess = new_session(); | |
592 spdy_stream($sess, { path => '/s' }, 2); | |
593 $frames = spdy_read($sess); | |
594 | |
595 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | |
596 ok($frame, 'even stream - GOAWAY frame'); | |
597 is($frame->{code}, 1, 'even stream - error code'); | |
598 is($frame->{sid}, 0, 'even stream - last used stream'); | |
599 | |
600 } | |
601 | |
602 # GOAWAY on SYN_STREAM with backward StreamID | |
603 | |
604 TODO: { | |
605 local $TODO = 'not yet'; | |
606 | |
607 $sess = new_session(); | |
608 $sid1 = spdy_stream($sess, { path => '/s' }, 3); | |
609 spdy_read($sess); | |
610 | |
611 $sid2 = spdy_stream($sess, { path => '/s' }, 1); | |
612 $frames = spdy_read($sess); | |
613 | |
614 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | |
615 ok($frame, 'backward stream - GOAWAY frame'); | |
616 is($frame->{code}, 1, 'backward stream - error code'); | |
617 is($frame->{sid}, $sid1, 'backward stream - last used stream'); | |
618 | |
619 } | |
620 | |
621 # RST_STREAM on the second SYN_STREAM with same StreamID | |
622 | |
623 TODO: { | |
624 local $TODO = 'not yet'; | |
625 | |
626 $sess = new_session(); | |
627 $sid1 = spdy_stream($sess, { path => '/s' }, 3); | |
628 spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
629 $sid2 = spdy_stream($sess, { path => '/s' }, 3); | |
630 $frames = spdy_read($sess); | |
631 | |
632 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; | |
633 ok($frame, 'dup stream - RST_STREAM frame'); | |
634 is($frame->{code}, 1, 'dup stream - error code'); | |
635 is($frame->{sid}, $sid1, 'dup stream - stream'); | |
636 | |
637 } | |
638 | |
639 # awkward protocol version | |
640 | |
641 $sess = new_session(); | |
642 $sid1 = spdy_stream($sess, { path => '/s', version => 'HTTP/1.10' }); | |
643 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
644 | |
645 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
646 is($frame->{headers}->{':status'}, 200, 'awkward version'); | |
647 | |
648 # missing mandatory request header | |
649 | |
650 $sess = new_session(); | |
651 $sid1 = spdy_stream($sess, { path => '/s', version => '' }); | |
652 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
653 | |
654 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
655 is($frame->{headers}->{':status'}, 400, 'incomplete headers'); | |
656 | |
657 # GOAWAY before closing a connection by server | |
658 | |
659 $t->stop(); | |
660 | |
661 TODO: { | |
662 local $TODO = 'not yet'; | |
663 | |
664 $frames = spdy_read($sess); | |
665 | |
666 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | |
667 ok($frame, 'GOAWAY on connection close'); | |
668 | |
669 } | |
670 | |
671 ############################################################################### | |
672 | |
673 sub spdy_ping { | |
674 my ($sess, $payload) = @_; | |
675 | |
676 raw_write($sess->{socket}, pack("N3", 0x80030006, 0x4, $payload)); | |
677 } | |
678 | |
679 sub spdy_rst { | |
680 my ($sess, $sid, $error) = @_; | |
681 | |
682 raw_write($sess->{socket}, pack("N4", 0x80030003, 0x8, $sid, $error)); | |
683 } | |
684 | |
685 sub spdy_window { | |
686 my ($sess, $win, $stream) = @_; | |
687 | |
688 $stream = 0 unless defined $stream; | |
689 raw_write($sess->{socket}, pack("N4", 0x80030009, 8, $stream, $win)); | |
690 } | |
691 | |
692 sub spdy_settings { | |
693 my ($sess, %extra) = @_; | |
694 | |
695 my $cnt = keys %extra; | |
696 my $len = 4 + 8 * $cnt; | |
697 | |
698 my $buf = pack "N3", 0x80030004, $len, $cnt; | |
699 $buf .= join '', map { pack "N2", $_, $extra{$_} } keys %extra; | |
700 raw_write($sess->{socket}, $buf); | |
701 } | |
702 | |
703 sub spdy_read { | |
704 my ($sess, %extra) = @_; | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
705 my ($length, @got); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
706 my $s = $sess->{socket}; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
707 my $buf = ''; |
374 | 708 |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
709 eval { |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
710 local $SIG{ALRM} = sub { die "timeout\n" }; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
711 local $SIG{PIPE} = sub { die "sigpipe\n" }; |
374 | 712 again: |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
713 alarm(1); |
374 | 714 |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
715 $buf = raw_read($s, $buf, 8); |
379
f42de3a9fd74
Tests: avoid uninitialized warnings in spdy.t.
Maxim Dounin <mdounin@mdounin.ru>
parents:
377
diff
changeset
|
716 |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
717 my $type = unpack("B", $buf); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
718 $length = 8 + hex unpack("x5 H6", $buf); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
719 $buf = raw_read($s, $buf, $length); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
720 |
374 | 721 if ($type == 0) { |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
722 push @got, dframe($buf); |
374 | 723 |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
724 } else { |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
725 my $ctype = unpack("x2 n", $buf); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
726 push @got, $cframe{$ctype}($sess, $buf); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
727 } |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
728 $buf = substr($buf, $length); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
729 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
730 goto again if test_fin($got[-1], $extra{all}); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
731 alarm(0); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
732 }; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
733 alarm(0); |
374 | 734 return \@got; |
735 } | |
736 | |
737 sub test_fin { | |
738 my ($frame, $all) = @_; | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
739 my @test = @{$all}; |
374 | 740 |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
741 # wait for the specified DATA length |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
742 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
743 for (@test) { |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
744 if ($_->{length} && $frame->{type} eq 'DATA') { |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
745 # check also for StreamID if needed |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
746 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
747 if (!$_->{sid} || $_->{sid} == $frame->{sid}) { |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
748 $_->{length} -= $frame->{length}; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
749 } |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
750 } |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
751 } |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
752 @test = grep { !(defined $_->{length} && $_->{length} == 0) } @test; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
753 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
754 # wait for the fin flag |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
755 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
756 @test = grep { !(defined $_->{fin} |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
757 && $_->{sid} == $frame->{sid} && $_->{fin} == $frame->{fin}) |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
758 } @test if defined $frame->{fin}; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
759 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
760 # wait for the specified frame |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
761 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
762 @test = grep { !($_->{type} && $_->{type} eq $frame->{type}) } @test; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
763 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
764 @{$all} = @test; |
374 | 765 } |
766 | |
767 sub dframe { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
768 my ($buf) = @_; |
374 | 769 my %frame; |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
770 my $skip = 0; |
374 | 771 |
772 my $stream = unpack "\@$skip B32", $buf; $skip += 4; | |
773 substr($stream, 0, 1) = 0; | |
774 $stream = unpack("N", pack("B32", $stream)); | |
775 $frame{sid} = $stream; | |
776 | |
777 my $flags = unpack "\@$skip B8", $buf; $skip += 1; | |
778 $frame{fin} = substr($flags, 7, 1); | |
779 | |
780 my $length = hex (unpack "\@$skip H6", $buf); $skip += 3; | |
781 $frame{length} = $length; | |
782 | |
783 $frame{data} = substr($buf, $skip, $length); | |
784 $frame{type} = "DATA"; | |
785 return \%frame; | |
786 } | |
787 | |
788 sub spdy_stream { | |
789 my ($ctx, $uri, $stream) = @_; | |
790 my ($input, $output, $buf); | |
791 my ($d, $status); | |
792 | |
793 my $host = $uri->{host} || '127.0.0.1:8080'; | |
794 my $method = $uri->{method} || 'GET'; | |
795 my $headers = $uri->{headers} || {}; | |
796 my $body = $uri->{body}; | |
797 my $prio = defined $uri->{prio} ? $uri->{prio} : 4; | |
798 my $version = defined $uri->{version} ? $uri->{version} : "HTTP/1.1"; | |
799 | |
800 if ($stream) { | |
801 $ctx->{last_stream} = $stream; | |
802 } else { | |
803 $ctx->{last_stream} += 2; | |
804 } | |
805 | |
806 $buf = pack("NC", 0x80030001, not $body); | |
807 $buf .= pack("xxx"); # Length stub | |
808 $buf .= pack("N", $ctx->{last_stream}); # Stream-ID | |
809 $buf .= pack("N", 0); # Assoc. Stream-ID | |
810 $buf .= pack("n", $prio << 13); | |
811 | |
812 my $ent = 4 + keys %{$headers}; | |
813 $ent++ if $body; | |
814 $ent++ if $version; | |
815 | |
816 $input = pack("N", $ent); | |
817 $input .= hpack(":host", $host); | |
818 $input .= hpack(":method", $method); | |
819 $input .= hpack(":path", $uri->{path}); | |
820 $input .= hpack(":scheme", "http"); | |
821 if ($version) { | |
822 $input .= hpack(":version", $version); | |
823 } | |
824 if ($body) { | |
825 $input .= hpack("content-length", length $body); | |
826 } | |
827 $input .= join '', map { hpack($_, $headers->{$_}) } keys %{$headers}; | |
828 | |
829 $d = $ctx->{zlib}->{d}; | |
830 $status = $d->deflate($input => \my $start); | |
831 $status == Compress::Raw::Zlib->Z_OK or fail "deflate failed"; | |
832 $status = $d->flush(\my $tail => Compress::Raw::Zlib->Z_SYNC_FLUSH); | |
833 $status == Compress::Raw::Zlib->Z_OK or fail "flush failed"; | |
834 $output = $start . $tail; | |
835 | |
426
7cb6af00afdd
Tests: fixed SPDY tests with large header length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
425
diff
changeset
|
836 # set length, attach headers and optional body |
7cb6af00afdd
Tests: fixed SPDY tests with large header length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
425
diff
changeset
|
837 |
7cb6af00afdd
Tests: fixed SPDY tests with large header length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
425
diff
changeset
|
838 $buf |= pack "x4N", length($output) + 10; |
374 | 839 $buf .= $output; |
840 | |
841 if (defined $body) { | |
842 $buf .= pack "NCxn", $ctx->{last_stream}, 0x01, length $body; | |
843 $buf .= $body; | |
844 } | |
845 | |
846 raw_write($ctx->{socket}, $buf); | |
847 return $ctx->{last_stream}; | |
848 } | |
849 | |
850 sub syn_reply { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
851 my ($ctx, $buf) = @_; |
374 | 852 my ($i, $status); |
853 my %payload; | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
854 my $skip = 4; |
374 | 855 |
856 my $flags = unpack "\@$skip B8", $buf; $skip += 1; | |
857 $payload{fin} = substr($flags, 7, 1); | |
858 | |
859 my $length = hex unpack "\@$skip H6", $buf; $skip += 3; | |
860 $payload{length} = $length; | |
861 $payload{type} = 'SYN_REPLY'; | |
862 | |
863 my $stream = unpack "\@$skip B32", $buf; $skip += 4; | |
864 substr($stream, 0, 1) = 0; | |
865 $stream = unpack("N", pack("B32", $stream)); | |
866 $payload{sid} = $stream; | |
867 | |
868 my $input = substr($buf, $skip, $length - 4); | |
869 $i = $ctx->{zlib}->{i}; | |
870 | |
871 $status = $i->inflate($input => \my $out); | |
872 fail "Failed: $status" unless $status == Compress::Raw::Zlib->Z_OK; | |
873 $payload{headers} = hunpack($out); | |
874 return \%payload; | |
875 } | |
876 | |
877 sub rst_stream { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
878 my ($ctx, $buf) = @_; |
374 | 879 my %payload; |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
880 my $skip = 5; |
374 | 881 |
882 $payload{length} = hex(unpack "\@$skip H6", $buf); $skip += 3; | |
883 $payload{type} = 'RST_STREAM'; | |
884 $payload{sid} = unpack "\@$skip N", $buf; $skip += 4; | |
885 $payload{code} = unpack "\@$skip N", $buf; | |
886 return \%payload; | |
887 } | |
888 | |
889 sub settings { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
890 my ($ctx, $buf) = @_; |
374 | 891 my %payload; |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
892 my $skip = 4; |
374 | 893 |
894 $payload{flags} = unpack "\@$skip H", $buf; $skip += 1; | |
895 $payload{length} = hex(unpack "\@$skip H6", $buf); $skip += 3; | |
896 $payload{type} = 'SETTINGS'; | |
897 | |
898 my $nent = unpack "\@$skip N", $buf; $skip += 4; | |
899 for (1 .. $nent) { | |
900 my $flags = hex unpack "\@$skip H2", $buf; $skip += 1; | |
901 my $id = hex unpack "\@$skip H6", $buf; $skip += 3; | |
902 $payload{$id}{flags} = $flags; | |
903 $payload{$id}{value} = unpack "\@$skip N", $buf; $skip += 4; | |
904 } | |
905 return \%payload; | |
906 } | |
907 | |
908 sub ping { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
909 my ($ctx, $buf) = @_; |
374 | 910 my %payload; |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
911 my $skip = 5; |
374 | 912 |
913 $payload{length} = hex(unpack "\@$skip H6", $buf); $skip += 3; | |
914 $payload{type} = 'PING'; | |
915 $payload{value} = unpack "\@$skip N", $buf; | |
916 return \%payload; | |
917 } | |
918 | |
919 sub goaway { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
920 my ($ctx, $buf) = @_; |
374 | 921 my %payload; |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
922 my $skip = 5; |
374 | 923 |
924 $payload{length} = hex unpack "\@$skip H6", $buf; $skip += 3; | |
925 $payload{type} = 'GOAWAY'; | |
926 $payload{sid} = unpack "\@$skip N", $buf; $skip += 4; | |
927 $payload{code} = unpack "\@$skip N", $buf; | |
928 return \%payload; | |
929 } | |
930 | |
931 sub window_update { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
932 my ($ctx, $buf) = @_; |
374 | 933 my %payload; |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
934 my $skip = 5; |
374 | 935 |
936 $payload{length} = hex(unpack "\@$skip H6", $buf); $skip += 3; | |
937 $payload{type} = 'WINDOW_UPDATE'; | |
938 | |
939 my $stream = unpack "\@$skip B32", $buf; $skip += 4; | |
940 substr($stream, 0, 1) = 0; | |
941 $stream = unpack("N", pack("B32", $stream)); | |
942 $payload{sid} = $stream; | |
943 | |
944 my $value = unpack "\@$skip B32", $buf; | |
945 substr($value, 0, 1) = 0; | |
946 $payload{wdelta} = unpack("N", pack("B32", $value)); | |
947 return \%payload; | |
948 } | |
949 | |
950 sub hpack { | |
951 my ($name, $value) = @_; | |
952 | |
953 pack("N", length($name)) . $name . pack("N", length($value)) . $value; | |
954 } | |
955 | |
956 sub hunpack { | |
957 my ($data) = @_; | |
958 my %headers; | |
959 my $skip = 0; | |
960 | |
961 my $nent = unpack "\@$skip N", $data; $skip += 4; | |
962 for (1 .. $nent) { | |
963 my $len = unpack("\@$skip N", $data); $skip += 4; | |
964 my $name = unpack("\@$skip A$len", $data); $skip += $len; | |
965 | |
966 $len = unpack("\@$skip N", $data); $skip += 4; | |
967 my $value = unpack("\@$skip A$len", $data); $skip += $len; | |
486
c2c1eb6d7a76
Tests: worked around a bug in perl unpack.
Sergey Kandaurov <pluknet@nginx.com>
parents:
470
diff
changeset
|
968 $value .= "\0" x ($len - length $value); |
374 | 969 |
970 $headers{$name} = $value; | |
971 } | |
972 return \%headers; | |
973 } | |
974 | |
975 sub raw_read { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
976 my ($s, $buf, $len) = @_; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
977 my $got = ''; |
374 | 978 |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
979 while (length($buf) < $len) { |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
980 $s->sysread($got, $len - length($buf)) or die; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
981 log_in($got); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
982 $buf .= $got; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
983 } |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
984 return $buf; |
374 | 985 } |
986 | |
987 sub raw_write { | |
988 my ($s, $message) = @_; | |
989 | |
990 local $SIG{PIPE} = 'IGNORE'; | |
991 | |
992 while (IO::Select->new($s)->can_write(0.4)) { | |
993 log_out($message); | |
994 my $n = $s->syswrite($message); | |
995 last unless $n; | |
996 $message = substr($message, $n); | |
997 last unless length $message; | |
998 } | |
999 } | |
1000 | |
1001 sub new_session { | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1002 my ($port, %extra) = @_; |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1003 my ($d, $i, $status, $s); |
374 | 1004 |
1005 ($d, $status) = Compress::Raw::Zlib::Deflate->new( | |
1006 -WindowBits => 12, | |
1007 -Dictionary => dictionary(), | |
1008 -Level => Compress::Raw::Zlib->Z_NO_COMPRESSION | |
1009 ); | |
1010 fail "Zlib failure: $status" unless $d; | |
1011 | |
1012 ($i, $status) = Compress::Raw::Zlib::Inflate->new( | |
1013 -WindowBits => Compress::Raw::Zlib->WANT_GZIP_OR_ZLIB, | |
1014 -Dictionary => dictionary() | |
1015 ); | |
1016 fail "Zlib failure: $status" unless $i; | |
1017 | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1018 $s = new_socket($port); |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1019 |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1020 if ($extra{proxy}) { |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1021 raw_write($s, $extra{proxy}); |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1022 } |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1023 |
374 | 1024 return { zlib => { i => $i, d => $d }, |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1025 socket => $s, last_stream => -1 }; |
374 | 1026 } |
1027 | |
1028 sub new_socket { | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1029 my ($port) = @_; |
374 | 1030 my $s; |
1031 | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1032 $port = 8080 unless defined $port; |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1033 |
374 | 1034 eval { |
1035 local $SIG{ALRM} = sub { die "timeout\n" }; | |
1036 local $SIG{PIPE} = sub { die "sigpipe\n" }; | |
1037 alarm(2); | |
1038 $s = IO::Socket::INET->new( | |
1039 Proto => 'tcp', | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1040 PeerAddr => "127.0.0.1:$port", |
374 | 1041 ); |
1042 alarm(0); | |
1043 }; | |
1044 alarm(0); | |
1045 | |
1046 if ($@) { | |
1047 log_in("died: $@"); | |
1048 return undef; | |
1049 } | |
1050 | |
1051 return $s; | |
1052 } | |
1053 | |
1054 sub dictionary { | |
1055 join('', (map pack('N/a*', $_), qw( | |
1056 options | |
1057 head | |
1058 post | |
1059 put | |
1060 delete | |
1061 trace | |
1062 accept | |
1063 accept-charset | |
1064 accept-encoding | |
1065 accept-language | |
1066 accept-ranges | |
1067 age | |
1068 allow | |
1069 authorization | |
1070 cache-control | |
1071 connection | |
1072 content-base | |
1073 content-encoding | |
1074 content-language | |
1075 content-length | |
1076 content-location | |
1077 content-md5 | |
1078 content-range | |
1079 content-type | |
1080 date | |
1081 etag | |
1082 expect | |
1083 expires | |
1084 from | |
1085 host | |
1086 if-match | |
1087 if-modified-since | |
1088 if-none-match | |
1089 if-range | |
1090 if-unmodified-since | |
1091 last-modified | |
1092 location | |
1093 max-forwards | |
1094 pragma | |
1095 proxy-authenticate | |
1096 proxy-authorization | |
1097 range | |
1098 referer | |
1099 retry-after | |
1100 server | |
1101 te | |
1102 trailer | |
1103 transfer-encoding | |
1104 upgrade | |
1105 user-agent | |
1106 vary | |
1107 via | |
1108 warning | |
1109 www-authenticate | |
1110 method | |
1111 get | |
1112 status), "200 OK", | |
1113 qw(version HTTP/1.1 url public set-cookie keep-alive origin)), | |
1114 "100101201202205206300302303304305306307402405406407408409410", | |
1115 "411412413414415416417502504505", | |
1116 "203 Non-Authoritative Information", | |
1117 "204 No Content", | |
1118 "301 Moved Permanently", | |
1119 "400 Bad Request", | |
1120 "401 Unauthorized", | |
1121 "403 Forbidden", | |
1122 "404 Not Found", | |
1123 "500 Internal Server Error", | |
1124 "501 Not Implemented", | |
1125 "503 Service Unavailable", | |
1126 "Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec", | |
1127 " 00:00:00", | |
1128 " Mon, Tue, Wed, Thu, Fri, Sat, Sun, GMT", | |
1129 "chunked,text/html,image/png,image/jpg,image/gif,", | |
1130 "application/xml,application/xhtml+xml,text/plain,", | |
1131 "text/javascript,public", "privatemax-age=gzip,deflate,", | |
1132 "sdchcharset=utf-8charset=iso-8859-1,utf-,*,enq=0." | |
1133 ); | |
1134 } | |
1135 | |
1136 ############################################################################### | |
487
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1137 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1138 # reply with multiple (also empty) header values |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1139 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1140 sub http_daemon { |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1141 my $server = IO::Socket::INET->new( |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1142 Proto => 'tcp', |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1143 LocalHost => '127.0.0.1', |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1144 LocalPort => 8083, |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1145 Listen => 5, |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1146 Reuse => 1 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1147 ) |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1148 or die "Can't create listening socket: $!\n"; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1149 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1150 local $SIG{PIPE} = 'IGNORE'; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1151 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1152 while (my $client = $server->accept()) { |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1153 $client->autoflush(1); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1154 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1155 my $headers = ''; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1156 my $uri = ''; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1157 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1158 while (<$client>) { |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1159 $headers .= $_; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1160 last if (/^\x0d?\x0a?$/); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1161 } |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1162 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1163 next if $headers eq ''; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1164 $uri = $1 if $headers =~ /^\S+\s+([^ ]+)\s+HTTP/i; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1165 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1166 if ($uri eq '/inside') { |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1167 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1168 print $client <<EOF; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1169 HTTP/1.1 200 OK |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1170 Connection: close |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1171 X-Foo: val1 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1172 X-Foo: |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1173 X-Foo: val2 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1174 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1175 EOF |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1176 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1177 } elsif ($uri eq '/first') { |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1178 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1179 print $client <<EOF; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1180 HTTP/1.1 200 OK |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1181 Connection: close |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1182 X-Foo: |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1183 X-Foo: val1 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1184 X-Foo: val2 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1185 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1186 EOF |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1187 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1188 } elsif ($uri eq '/last') { |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1189 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1190 print $client <<EOF; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1191 HTTP/1.1 200 OK |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1192 Connection: close |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1193 X-Foo: val1 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1194 X-Foo: val2 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1195 X-Foo: |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1196 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1197 EOF |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1198 } |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1199 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1200 } continue { |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1201 close $client; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1202 } |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1203 } |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1204 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1205 ############################################################################### |