Mercurial > hg > nginx-tests
annotate spdy.t @ 569:adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 06 May 2015 11:22:21 +0300 |
parents | 907e89fba9c3 |
children | 2cd00179f4b2 |
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 | |
503
071e8941e3bf
Tests: reduce shared memory zone sizes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
488
diff
changeset
|
53 proxy_cache_path %%TESTDIR%%/cache keys_zone=NAME:1m; |
374 | 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 # 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
|
224 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
225 $sess = new_session(); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
226 $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
|
227 headers => { "cookie" => "val1\0val2" } |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
228 }); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
229 $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
|
230 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
|
231 'multiple request header values'); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
232 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
233 # 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
|
234 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
235 $sess = new_session(); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
236 $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
|
237 headers => { "cookie" => "val1\0val2" } |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
238 }); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
239 $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
|
240 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
241 ($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
|
242 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
|
243 '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
|
244 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
245 # 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
|
246 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
247 $sess = new_session(); |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
248 $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
|
249 $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
|
250 |
cc4697d6bd16
Tests: added SPDY tests for header field with multiple values.
Sergey Kandaurov <pluknet@nginx.com>
parents:
429
diff
changeset
|
251 ($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
|
252 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
|
253 '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
|
254 |
487
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
255 # 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
|
256 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
257 $sess = new_session(); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
258 $sid1 = spdy_stream($sess, { path => '/header/inside' }); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
259 $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
|
260 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
261 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
262 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
|
263 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
264 $sid1 = spdy_stream($sess, { path => '/header/first' }); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
265 $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
|
266 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
267 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
268 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
|
269 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
270 $sid1 = spdy_stream($sess, { path => '/header/last' }); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
271 $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
|
272 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
273 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
274 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
|
275 |
374 | 276 # $spdy |
277 | |
278 $sess = new_session(); | |
279 $sid1 = spdy_stream($sess, { path => '/spdy' }); | |
280 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
281 | |
282 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
283 is($frame->{data}, '3.1', 'spdy variable'); | |
284 | |
285 # spdy_chunk_size=1 | |
286 | |
287 $sess = new_session(); | |
288 $sid1 = spdy_stream($sess, { path => '/chunk_size' }); | |
289 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
290 | |
291 my @data = grep { $_->{type} eq "DATA" } @$frames; | |
292 is(@data, 4, 'chunk_size body chunks'); | |
293 is($data[0]->{data}, 'b', 'chunk_size body 1'); | |
294 is($data[1]->{data}, 'o', 'chunk_size body 2'); | |
295 is($data[2]->{data}, 'd', 'chunk_size body 3'); | |
296 is($data[3]->{data}, 'y', 'chunk_size body 4'); | |
297 | |
298 # redirect | |
299 | |
300 $sess = new_session(); | |
301 $sid1 = spdy_stream($sess, { path => '/redirect' }); | |
302 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
303 | |
304 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
305 is($frame->{headers}->{':status'}, 405, 'SYN_REPLAY status with redirect'); | |
306 | |
307 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
308 ok($frame, 'DATA frame with redirect'); | |
309 is($frame->{data}, 'body', 'DATA payload with redirect'); | |
310 | |
428
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
311 # 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
|
312 |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
313 $sess = new_session(); |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
314 $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
|
315 |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
316 $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
|
317 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
|
318 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
|
319 |
374 | 320 # ensure that HEAD-like requests, i.e., without response body, do not lead to |
321 # client connection close due to cache filling up with upstream response body | |
322 | |
323 $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
|
324 $frames = spdy_read($sess, all => [{ sid => $sid2, fin => 1 }]); |
374 | 325 ok(grep ({ $_->{type} eq "SYN_REPLY" } @$frames), 'proxy cache headers only'); |
326 | |
428
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
327 # 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
|
328 |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
329 $sess = new_session(); |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
330 $sid1 = spdy_stream($sess, |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
331 { 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
|
332 |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
333 $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
|
334 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
|
335 ok(!grep ({ $_->{type} eq "DATA" } @$frames), |
e95c3340d94a
Tests: more SPDY tests for caching HEAD requests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
427
diff
changeset
|
336 '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
|
337 |
374 | 338 # simple proxy cache test |
339 | |
340 $sess = new_session(); | |
341 $sid1 = spdy_stream($sess, { path => '/proxy/t2.html' }); | |
342 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
343 | |
344 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
345 is($frame->{headers}->{':status'}, '200 OK', 'proxy cache unconditional'); | |
346 | |
347 $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
|
348 headers => { "if-none-match" => $frame->{headers}->{'etag'} } |
374 | 349 }); |
350 $frames = spdy_read($sess, all => [{ sid => $sid2, fin => 1 }]); | |
351 | |
352 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
353 is($frame->{headers}->{':status'}, 304, 'proxy cache conditional'); | |
354 | |
355 # request body (uses proxied response) | |
356 | |
357 $sess = new_session(); | |
358 $sid1 = spdy_stream($sess, { path => '/proxy/t2.html', body => 'TEST' }); | |
359 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
360 | |
361 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
362 is($frame->{headers}->{'x-body'}, 'TEST', 'request body'); | |
363 | |
364 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
365 is($frame->{length}, length 'SEE-THIS', 'proxied response length'); | |
366 is($frame->{data}, 'SEE-THIS', 'proxied response'); | |
367 | |
368 # WINDOW_UPDATE (client side) | |
369 | |
370 $sess = new_session(); | |
371 $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
|
372 $frames = spdy_read($sess, all => [{ sid => $sid1, length => 2**16 }]); |
374 | 373 |
374 @data = grep { $_->{type} eq "DATA" } @$frames; | |
375 my $sum = eval join '+', map { $_->{length} } @data; | |
376 is($sum, 2**16, 'iws - stream blocked on initial window size'); | |
377 | |
378 spdy_ping($sess, 0xf00ff00f); | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
379 $frames = spdy_read($sess, all => [{ type => 'PING' }]); |
374 | 380 |
381 ($frame) = grep { $_->{type} eq "PING" } @$frames; | |
382 ok($frame, 'iws - PING not blocked'); | |
383 | |
384 spdy_window($sess, 2**16, $sid1); | |
385 $frames = spdy_read($sess); | |
386 is(@$frames, 0, 'iws - updated stream window'); | |
387 | |
388 spdy_window($sess, 2**16); | |
389 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
390 | |
391 @data = grep { $_->{type} eq "DATA" } @$frames; | |
392 $sum = eval join '+', map { $_->{length} } @data; | |
393 is($sum, 80, 'iws - updated connection window'); | |
394 | |
395 # SETTINGS (initial window size, client side) | |
396 | |
397 $sess = new_session(); | |
398 spdy_settings($sess, 7 => 2**17); | |
399 spdy_window($sess, 2**17); | |
400 | |
401 $sid1 = spdy_stream($sess, { path => '/t1.html' }); | |
402 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
403 | |
404 @data = grep { $_->{type} eq "DATA" } @$frames; | |
405 $sum = eval join '+', map { $_->{length} } @data; | |
406 is($sum, 2**16 + 80, 'increased initial window size'); | |
407 | |
408 # probe for negative available space in a flow control window | |
409 | |
410 $sess = new_session(); | |
411 $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
|
412 spdy_read($sess, all => [{ sid => $sid1, length => 2**16 }]); |
374 | 413 |
414 spdy_window($sess, 1); | |
415 spdy_settings($sess, 7 => 42); | |
416 spdy_window($sess, 1024, $sid1); | |
417 | |
418 $frames = spdy_read($sess); | |
419 is(@$frames, 0, 'negative window - no data'); | |
420 | |
421 spdy_window($sess, 2**16 - 42 - 1024, $sid1); | |
422 $frames = spdy_read($sess); | |
423 is(@$frames, 0, 'zero window - no data'); | |
424 | |
425 spdy_window($sess, 1, $sid1); | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
426 $frames = spdy_read($sess, all => [{ sid => $sid1, length => 1 }]); |
374 | 427 is(@$frames, 1, 'positive window - data'); |
428 is(@$frames[0]->{length}, 1, 'positive window - data length'); | |
429 | |
430 # stream multiplexing | |
431 | |
432 $sess = new_session(); | |
433 $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
|
434 $frames = spdy_read($sess, all => [{ sid => $sid1, length => 2**16 }]); |
374 | 435 |
436 @data = grep { $_->{type} eq "DATA" } @$frames; | |
437 $sum = eval join '+', map { $_->{length} } @data; | |
438 is($sum, 2**16, 'multiple - stream1 data'); | |
439 | |
440 $sid2 = spdy_stream($sess, { path => '/t1.html' }); | |
441 $frames = spdy_read($sess, all => [{ sid => $sid2, fin => 0 }]); | |
442 | |
443 @data = grep { $_->{type} eq "DATA" } @$frames; | |
444 is(@data, 0, 'multiple - stream2 no data'); | |
445 | |
446 spdy_window($sess, 2**17, $sid1); | |
447 spdy_window($sess, 2**17, $sid2); | |
448 spdy_window($sess, 2**17); | |
449 | |
450 $frames = spdy_read($sess, all => [ | |
451 { sid => $sid1, fin => 1 }, | |
452 { sid => $sid2, fin => 1 } | |
453 ]); | |
454 | |
455 @data = grep { $_->{type} eq "DATA" && $_->{sid} == $sid1 } @$frames; | |
456 $sum = eval join '+', map { $_->{length} } @data; | |
457 is($sum, 80, 'multiple - stream1 remain data'); | |
458 | |
459 @data = grep { $_->{type} eq "DATA" && $_->{sid} == $sid2 } @$frames; | |
460 $sum = eval join '+', map { $_->{length} } @data; | |
461 is($sum, 2**16 + 80, 'multiple - stream2 full data'); | |
462 | |
463 # request priority parsing in $spdy_request_priority | |
464 | |
465 $sess = new_session(); | |
466 $sid1 = spdy_stream($sess, { path => '/prio', prio => 0 }); | |
467 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
468 | |
469 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
470 is($frame->{data}, 0, 'priority 0'); | |
471 | |
472 $sid1 = spdy_stream($sess, { path => '/prio', prio => 1 }); | |
473 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
474 | |
475 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
476 is($frame->{data}, 1, 'priority 1'); | |
477 | |
478 $sid1 = spdy_stream($sess, { path => '/prio', prio => 7 }); | |
479 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
480 | |
481 ($frame) = grep { $_->{type} eq "DATA" } @$frames; | |
482 is($frame->{data}, 7, 'priority 7'); | |
483 | |
484 # stream muliplexing + priority | |
485 | |
486 $sess = new_session(); | |
487 $sid1 = spdy_stream($sess, { path => '/t1.html', prio => 7 }); | |
529
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
488 spdy_read($sess, all => [{ sid => $sid1, length => 2**16 }]); |
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
489 |
374 | 490 $sid2 = spdy_stream($sess, { path => '/t2.html', prio => 0 }); |
529
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
491 spdy_read($sess, all => [{ sid => $sid2, fin => 0 }]); |
374 | 492 |
493 spdy_window($sess, 2**17, $sid1); | |
494 spdy_window($sess, 2**17, $sid2); | |
495 spdy_window($sess, 2**17); | |
496 | |
497 $frames = spdy_read($sess, all => [ | |
498 { sid => $sid1, fin => 1 }, | |
499 { sid => $sid2, fin => 1 } | |
500 ]); | |
501 | |
502 @data = grep { $_->{type} eq "DATA" } @$frames; | |
503 is(join (' ', map { $_->{sid} } @data), "$sid2 $sid1", 'multiple priority 1'); | |
504 | |
505 # and vice versa | |
506 | |
507 $sess = new_session(); | |
508 $sid1 = spdy_stream($sess, { path => '/t1.html', prio => 0 }); | |
529
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
509 spdy_read($sess, all => [{ sid => $sid1, length => 2**16 }]); |
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
510 |
374 | 511 $sid2 = spdy_stream($sess, { path => '/t2.html', prio => 7 }); |
529
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
512 spdy_read($sess, all => [{ sid => $sid2, fin => 0 }]); |
374 | 513 |
514 spdy_window($sess, 2**17, $sid1); | |
515 spdy_window($sess, 2**17, $sid2); | |
516 spdy_window($sess, 2**17); | |
517 | |
518 $frames = spdy_read($sess, all => [ | |
519 { sid => $sid1, fin => 1 }, | |
520 { sid => $sid2, fin => 1 } | |
521 ]); | |
522 | |
523 @data = grep { $_->{type} eq "DATA" } @$frames; | |
524 is(join (' ', map { $_->{sid} } @data), "$sid1 $sid2", 'multiple priority 2'); | |
525 | |
526 # limit_conn | |
527 | |
528 $sess = new_session(); | |
529 spdy_settings($sess, 7 => 1); | |
529
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
530 |
374 | 531 $sid1 = spdy_stream($sess, { path => '/t3.html' }); |
529
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
532 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 0 }]); |
374 | 533 |
534 ($frame) = grep { $_->{type} eq "SYN_REPLY" && $_->{sid} == $sid1 } @$frames; | |
535 is($frame->{headers}->{':status'}, 200, 'conn_limit 1'); | |
536 | |
529
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
537 $sid2 = spdy_stream($sess, { path => '/t3.html' }); |
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
538 $frames = spdy_read($sess, all => [{ sid => $sid2, fin => 0 }]); |
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
539 |
374 | 540 ($frame) = grep { $_->{type} eq "SYN_REPLY" && $_->{sid} == $sid2 } @$frames; |
541 is($frame->{headers}->{':status'}, 503, 'conn_limit 2'); | |
542 | |
470
00275fa9091c
Tests: fixed SPDY test with limit_conn.
Sergey Kandaurov <pluknet@nginx.com>
parents:
443
diff
changeset
|
543 spdy_settings($sess, 7 => 2**16); |
00275fa9091c
Tests: fixed SPDY test with limit_conn.
Sergey Kandaurov <pluknet@nginx.com>
parents:
443
diff
changeset
|
544 |
00275fa9091c
Tests: fixed SPDY test with limit_conn.
Sergey Kandaurov <pluknet@nginx.com>
parents:
443
diff
changeset
|
545 spdy_read($sess, all => [ |
00275fa9091c
Tests: fixed SPDY test with limit_conn.
Sergey Kandaurov <pluknet@nginx.com>
parents:
443
diff
changeset
|
546 { sid => $sid1, fin => 1 }, |
00275fa9091c
Tests: fixed SPDY test with limit_conn.
Sergey Kandaurov <pluknet@nginx.com>
parents:
443
diff
changeset
|
547 { sid => $sid2, fin => 1 } |
00275fa9091c
Tests: fixed SPDY test with limit_conn.
Sergey Kandaurov <pluknet@nginx.com>
parents:
443
diff
changeset
|
548 ]); |
00275fa9091c
Tests: fixed SPDY test with limit_conn.
Sergey Kandaurov <pluknet@nginx.com>
parents:
443
diff
changeset
|
549 |
374 | 550 # limit_conn + client's RST_STREAM |
551 | |
552 $sess = new_session(); | |
553 spdy_settings($sess, 7 => 1); | |
529
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
554 |
374 | 555 $sid1 = spdy_stream($sess, { path => '/t3.html' }); |
529
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
556 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 0 }]); |
374 | 557 spdy_rst($sess, $sid1, 5); |
558 | |
559 ($frame) = grep { $_->{type} eq "SYN_REPLY" && $_->{sid} == $sid1 } @$frames; | |
560 is($frame->{headers}->{':status'}, 200, 'RST_STREAM 1'); | |
561 | |
529
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
562 $sid2 = spdy_stream($sess, { path => '/t3.html' }); |
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
563 $frames = spdy_read($sess, all => [{ sid => $sid2, fin => 0 }]); |
42810c40ebb8
Tests: removed races from SPDY tests with consecutive streams.
Sergey Kandaurov <pluknet@nginx.com>
parents:
503
diff
changeset
|
564 |
374 | 565 ($frame) = grep { $_->{type} eq "SYN_REPLY" && $_->{sid} == $sid2 } @$frames; |
566 is($frame->{headers}->{':status'}, 200, 'RST_STREAM 2'); | |
567 | |
568 # GOAWAY on SYN_STREAM with even StreamID | |
569 | |
570 TODO: { | |
571 local $TODO = 'not yet'; | |
572 | |
573 $sess = new_session(); | |
574 spdy_stream($sess, { path => '/s' }, 2); | |
575 $frames = spdy_read($sess); | |
576 | |
577 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | |
578 ok($frame, 'even stream - GOAWAY frame'); | |
579 is($frame->{code}, 1, 'even stream - error code'); | |
580 is($frame->{sid}, 0, 'even stream - last used stream'); | |
581 | |
582 } | |
583 | |
584 # GOAWAY on SYN_STREAM with backward StreamID | |
585 | |
586 TODO: { | |
587 local $TODO = 'not yet'; | |
588 | |
589 $sess = new_session(); | |
590 $sid1 = spdy_stream($sess, { path => '/s' }, 3); | |
591 spdy_read($sess); | |
592 | |
593 $sid2 = spdy_stream($sess, { path => '/s' }, 1); | |
594 $frames = spdy_read($sess); | |
595 | |
596 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | |
597 ok($frame, 'backward stream - GOAWAY frame'); | |
598 is($frame->{code}, 1, 'backward stream - error code'); | |
599 is($frame->{sid}, $sid1, 'backward stream - last used stream'); | |
600 | |
601 } | |
602 | |
603 # RST_STREAM on the second SYN_STREAM with same StreamID | |
604 | |
605 TODO: { | |
606 local $TODO = 'not yet'; | |
607 | |
608 $sess = new_session(); | |
609 $sid1 = spdy_stream($sess, { path => '/s' }, 3); | |
610 spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
611 $sid2 = spdy_stream($sess, { path => '/s' }, 3); | |
612 $frames = spdy_read($sess); | |
613 | |
614 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; | |
615 ok($frame, 'dup stream - RST_STREAM frame'); | |
616 is($frame->{code}, 1, 'dup stream - error code'); | |
617 is($frame->{sid}, $sid1, 'dup stream - stream'); | |
618 | |
619 } | |
620 | |
621 # awkward protocol version | |
622 | |
623 $sess = new_session(); | |
624 $sid1 = spdy_stream($sess, { path => '/s', version => 'HTTP/1.10' }); | |
625 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
626 | |
627 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
628 is($frame->{headers}->{':status'}, 200, 'awkward version'); | |
629 | |
630 # missing mandatory request header | |
631 | |
632 $sess = new_session(); | |
633 $sid1 = spdy_stream($sess, { path => '/s', version => '' }); | |
634 $frames = spdy_read($sess, all => [{ sid => $sid1, fin => 1 }]); | |
635 | |
636 ($frame) = grep { $_->{type} eq "SYN_REPLY" } @$frames; | |
637 is($frame->{headers}->{':status'}, 400, 'incomplete headers'); | |
638 | |
639 # GOAWAY before closing a connection by server | |
640 | |
641 $t->stop(); | |
642 | |
643 TODO: { | |
644 local $TODO = 'not yet'; | |
645 | |
646 $frames = spdy_read($sess); | |
647 | |
648 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | |
649 ok($frame, 'GOAWAY on connection close'); | |
650 | |
651 } | |
652 | |
653 ############################################################################### | |
654 | |
655 sub spdy_ping { | |
656 my ($sess, $payload) = @_; | |
657 | |
658 raw_write($sess->{socket}, pack("N3", 0x80030006, 0x4, $payload)); | |
659 } | |
660 | |
661 sub spdy_rst { | |
662 my ($sess, $sid, $error) = @_; | |
663 | |
664 raw_write($sess->{socket}, pack("N4", 0x80030003, 0x8, $sid, $error)); | |
665 } | |
666 | |
667 sub spdy_window { | |
668 my ($sess, $win, $stream) = @_; | |
669 | |
670 $stream = 0 unless defined $stream; | |
671 raw_write($sess->{socket}, pack("N4", 0x80030009, 8, $stream, $win)); | |
672 } | |
673 | |
674 sub spdy_settings { | |
675 my ($sess, %extra) = @_; | |
676 | |
677 my $cnt = keys %extra; | |
678 my $len = 4 + 8 * $cnt; | |
679 | |
680 my $buf = pack "N3", 0x80030004, $len, $cnt; | |
681 $buf .= join '', map { pack "N2", $_, $extra{$_} } keys %extra; | |
682 raw_write($sess->{socket}, $buf); | |
683 } | |
684 | |
685 sub spdy_read { | |
686 my ($sess, %extra) = @_; | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
687 my ($length, @got); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
688 my $s = $sess->{socket}; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
689 my $buf = ''; |
374 | 690 |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
691 eval { |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
692 local $SIG{ALRM} = sub { die "timeout\n" }; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
693 local $SIG{PIPE} = sub { die "sigpipe\n" }; |
374 | 694 again: |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
695 alarm(1); |
374 | 696 |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
697 $buf = raw_read($s, $buf, 8); |
379
f42de3a9fd74
Tests: avoid uninitialized warnings in spdy.t.
Maxim Dounin <mdounin@mdounin.ru>
parents:
377
diff
changeset
|
698 |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
699 my $type = unpack("B", $buf); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
700 $length = 8 + hex unpack("x5 H6", $buf); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
701 $buf = raw_read($s, $buf, $length); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
702 |
374 | 703 if ($type == 0) { |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
704 push @got, dframe($buf); |
374 | 705 |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
706 } else { |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
707 my $ctype = unpack("x2 n", $buf); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
708 push @got, $cframe{$ctype}($sess, $buf); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
709 } |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
710 $buf = substr($buf, $length); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
711 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
712 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
|
713 alarm(0); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
714 }; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
715 alarm(0); |
374 | 716 return \@got; |
717 } | |
718 | |
719 sub test_fin { | |
720 my ($frame, $all) = @_; | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
721 my @test = @{$all}; |
374 | 722 |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
723 # wait for the specified DATA length |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
724 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
725 for (@test) { |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
726 if ($_->{length} && $frame->{type} eq 'DATA') { |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
727 # check also for StreamID if needed |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
728 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
729 if (!$_->{sid} || $_->{sid} == $frame->{sid}) { |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
730 $_->{length} -= $frame->{length}; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
731 } |
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 } |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
734 @test = grep { !(defined $_->{length} && $_->{length} == 0) } @test; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
735 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
736 # wait for the fin flag |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
737 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
738 @test = grep { !(defined $_->{fin} |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
739 && $_->{sid} == $frame->{sid} && $_->{fin} == $frame->{fin}) |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
740 } @test if defined $frame->{fin}; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
741 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
742 # wait for the specified frame |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
743 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
744 @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
|
745 |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
746 @{$all} = @test; |
374 | 747 } |
748 | |
749 sub dframe { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
750 my ($buf) = @_; |
374 | 751 my %frame; |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
752 my $skip = 0; |
374 | 753 |
754 my $stream = unpack "\@$skip B32", $buf; $skip += 4; | |
755 substr($stream, 0, 1) = 0; | |
756 $stream = unpack("N", pack("B32", $stream)); | |
757 $frame{sid} = $stream; | |
758 | |
759 my $flags = unpack "\@$skip B8", $buf; $skip += 1; | |
760 $frame{fin} = substr($flags, 7, 1); | |
761 | |
762 my $length = hex (unpack "\@$skip H6", $buf); $skip += 3; | |
763 $frame{length} = $length; | |
764 | |
765 $frame{data} = substr($buf, $skip, $length); | |
766 $frame{type} = "DATA"; | |
767 return \%frame; | |
768 } | |
769 | |
770 sub spdy_stream { | |
771 my ($ctx, $uri, $stream) = @_; | |
772 my ($input, $output, $buf); | |
773 my ($d, $status); | |
774 | |
775 my $host = $uri->{host} || '127.0.0.1:8080'; | |
776 my $method = $uri->{method} || 'GET'; | |
777 my $headers = $uri->{headers} || {}; | |
778 my $body = $uri->{body}; | |
779 my $prio = defined $uri->{prio} ? $uri->{prio} : 4; | |
780 my $version = defined $uri->{version} ? $uri->{version} : "HTTP/1.1"; | |
781 | |
782 if ($stream) { | |
783 $ctx->{last_stream} = $stream; | |
784 } else { | |
785 $ctx->{last_stream} += 2; | |
786 } | |
787 | |
788 $buf = pack("NC", 0x80030001, not $body); | |
789 $buf .= pack("xxx"); # Length stub | |
790 $buf .= pack("N", $ctx->{last_stream}); # Stream-ID | |
791 $buf .= pack("N", 0); # Assoc. Stream-ID | |
792 $buf .= pack("n", $prio << 13); | |
793 | |
794 my $ent = 4 + keys %{$headers}; | |
795 $ent++ if $body; | |
796 $ent++ if $version; | |
797 | |
798 $input = pack("N", $ent); | |
799 $input .= hpack(":host", $host); | |
800 $input .= hpack(":method", $method); | |
801 $input .= hpack(":path", $uri->{path}); | |
802 $input .= hpack(":scheme", "http"); | |
803 if ($version) { | |
804 $input .= hpack(":version", $version); | |
805 } | |
806 if ($body) { | |
807 $input .= hpack("content-length", length $body); | |
808 } | |
809 $input .= join '', map { hpack($_, $headers->{$_}) } keys %{$headers}; | |
810 | |
811 $d = $ctx->{zlib}->{d}; | |
812 $status = $d->deflate($input => \my $start); | |
813 $status == Compress::Raw::Zlib->Z_OK or fail "deflate failed"; | |
814 $status = $d->flush(\my $tail => Compress::Raw::Zlib->Z_SYNC_FLUSH); | |
815 $status == Compress::Raw::Zlib->Z_OK or fail "flush failed"; | |
816 $output = $start . $tail; | |
817 | |
426
7cb6af00afdd
Tests: fixed SPDY tests with large header length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
425
diff
changeset
|
818 # 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
|
819 |
7cb6af00afdd
Tests: fixed SPDY tests with large header length.
Sergey Kandaurov <pluknet@nginx.com>
parents:
425
diff
changeset
|
820 $buf |= pack "x4N", length($output) + 10; |
374 | 821 $buf .= $output; |
822 | |
823 if (defined $body) { | |
824 $buf .= pack "NCxn", $ctx->{last_stream}, 0x01, length $body; | |
825 $buf .= $body; | |
826 } | |
827 | |
828 raw_write($ctx->{socket}, $buf); | |
829 return $ctx->{last_stream}; | |
830 } | |
831 | |
832 sub syn_reply { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
833 my ($ctx, $buf) = @_; |
374 | 834 my ($i, $status); |
835 my %payload; | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
836 my $skip = 4; |
374 | 837 |
838 my $flags = unpack "\@$skip B8", $buf; $skip += 1; | |
839 $payload{fin} = substr($flags, 7, 1); | |
840 | |
841 my $length = hex unpack "\@$skip H6", $buf; $skip += 3; | |
842 $payload{length} = $length; | |
843 $payload{type} = 'SYN_REPLY'; | |
844 | |
845 my $stream = unpack "\@$skip B32", $buf; $skip += 4; | |
846 substr($stream, 0, 1) = 0; | |
847 $stream = unpack("N", pack("B32", $stream)); | |
848 $payload{sid} = $stream; | |
849 | |
850 my $input = substr($buf, $skip, $length - 4); | |
851 $i = $ctx->{zlib}->{i}; | |
852 | |
853 $status = $i->inflate($input => \my $out); | |
854 fail "Failed: $status" unless $status == Compress::Raw::Zlib->Z_OK; | |
855 $payload{headers} = hunpack($out); | |
856 return \%payload; | |
857 } | |
858 | |
859 sub rst_stream { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
860 my ($ctx, $buf) = @_; |
374 | 861 my %payload; |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
862 my $skip = 5; |
374 | 863 |
864 $payload{length} = hex(unpack "\@$skip H6", $buf); $skip += 3; | |
865 $payload{type} = 'RST_STREAM'; | |
866 $payload{sid} = unpack "\@$skip N", $buf; $skip += 4; | |
867 $payload{code} = unpack "\@$skip N", $buf; | |
868 return \%payload; | |
869 } | |
870 | |
871 sub settings { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
872 my ($ctx, $buf) = @_; |
374 | 873 my %payload; |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
874 my $skip = 4; |
374 | 875 |
876 $payload{flags} = unpack "\@$skip H", $buf; $skip += 1; | |
877 $payload{length} = hex(unpack "\@$skip H6", $buf); $skip += 3; | |
878 $payload{type} = 'SETTINGS'; | |
879 | |
880 my $nent = unpack "\@$skip N", $buf; $skip += 4; | |
881 for (1 .. $nent) { | |
882 my $flags = hex unpack "\@$skip H2", $buf; $skip += 1; | |
883 my $id = hex unpack "\@$skip H6", $buf; $skip += 3; | |
884 $payload{$id}{flags} = $flags; | |
885 $payload{$id}{value} = unpack "\@$skip N", $buf; $skip += 4; | |
886 } | |
887 return \%payload; | |
888 } | |
889 | |
890 sub ping { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
891 my ($ctx, $buf) = @_; |
374 | 892 my %payload; |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
893 my $skip = 5; |
374 | 894 |
895 $payload{length} = hex(unpack "\@$skip H6", $buf); $skip += 3; | |
896 $payload{type} = 'PING'; | |
897 $payload{value} = unpack "\@$skip N", $buf; | |
898 return \%payload; | |
899 } | |
900 | |
901 sub goaway { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
902 my ($ctx, $buf) = @_; |
374 | 903 my %payload; |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
904 my $skip = 5; |
374 | 905 |
906 $payload{length} = hex unpack "\@$skip H6", $buf; $skip += 3; | |
907 $payload{type} = 'GOAWAY'; | |
908 $payload{sid} = unpack "\@$skip N", $buf; $skip += 4; | |
909 $payload{code} = unpack "\@$skip N", $buf; | |
910 return \%payload; | |
911 } | |
912 | |
913 sub window_update { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
914 my ($ctx, $buf) = @_; |
374 | 915 my %payload; |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
916 my $skip = 5; |
374 | 917 |
918 $payload{length} = hex(unpack "\@$skip H6", $buf); $skip += 3; | |
919 $payload{type} = 'WINDOW_UPDATE'; | |
920 | |
921 my $stream = unpack "\@$skip B32", $buf; $skip += 4; | |
922 substr($stream, 0, 1) = 0; | |
923 $stream = unpack("N", pack("B32", $stream)); | |
924 $payload{sid} = $stream; | |
925 | |
926 my $value = unpack "\@$skip B32", $buf; | |
927 substr($value, 0, 1) = 0; | |
928 $payload{wdelta} = unpack("N", pack("B32", $value)); | |
929 return \%payload; | |
930 } | |
931 | |
932 sub hpack { | |
933 my ($name, $value) = @_; | |
934 | |
935 pack("N", length($name)) . $name . pack("N", length($value)) . $value; | |
936 } | |
937 | |
938 sub hunpack { | |
939 my ($data) = @_; | |
940 my %headers; | |
941 my $skip = 0; | |
942 | |
943 my $nent = unpack "\@$skip N", $data; $skip += 4; | |
944 for (1 .. $nent) { | |
945 my $len = unpack("\@$skip N", $data); $skip += 4; | |
946 my $name = unpack("\@$skip A$len", $data); $skip += $len; | |
947 | |
948 $len = unpack("\@$skip N", $data); $skip += 4; | |
949 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
|
950 $value .= "\0" x ($len - length $value); |
374 | 951 |
952 $headers{$name} = $value; | |
953 } | |
954 return \%headers; | |
955 } | |
956 | |
957 sub raw_read { | |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
958 my ($s, $buf, $len) = @_; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
959 my $got = ''; |
374 | 960 |
425
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
961 while (length($buf) < $len) { |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
962 $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
|
963 log_in($got); |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
964 $buf .= $got; |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
965 } |
cc7da696a330
Tests: reduced execution time of SPDY tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
416
diff
changeset
|
966 return $buf; |
374 | 967 } |
968 | |
969 sub raw_write { | |
970 my ($s, $message) = @_; | |
971 | |
972 local $SIG{PIPE} = 'IGNORE'; | |
973 | |
974 while (IO::Select->new($s)->can_write(0.4)) { | |
975 log_out($message); | |
976 my $n = $s->syswrite($message); | |
977 last unless $n; | |
978 $message = substr($message, $n); | |
979 last unless length $message; | |
980 } | |
981 } | |
982 | |
983 sub new_session { | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
984 my ($port, %extra) = @_; |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
985 my ($d, $i, $status, $s); |
374 | 986 |
987 ($d, $status) = Compress::Raw::Zlib::Deflate->new( | |
988 -WindowBits => 12, | |
989 -Dictionary => dictionary(), | |
990 -Level => Compress::Raw::Zlib->Z_NO_COMPRESSION | |
991 ); | |
992 fail "Zlib failure: $status" unless $d; | |
993 | |
994 ($i, $status) = Compress::Raw::Zlib::Inflate->new( | |
995 -WindowBits => Compress::Raw::Zlib->WANT_GZIP_OR_ZLIB, | |
996 -Dictionary => dictionary() | |
997 ); | |
998 fail "Zlib failure: $status" unless $i; | |
999 | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1000 $s = new_socket($port); |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1001 |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1002 if ($extra{proxy}) { |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1003 raw_write($s, $extra{proxy}); |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1004 } |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1005 |
374 | 1006 return { zlib => { i => $i, d => $d }, |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1007 socket => $s, last_stream => -1 }; |
374 | 1008 } |
1009 | |
1010 sub new_socket { | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1011 my ($port) = @_; |
374 | 1012 my $s; |
1013 | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1014 $port = 8080 unless defined $port; |
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1015 |
374 | 1016 eval { |
1017 local $SIG{ALRM} = sub { die "timeout\n" }; | |
1018 local $SIG{PIPE} = sub { die "sigpipe\n" }; | |
1019 alarm(2); | |
1020 $s = IO::Socket::INET->new( | |
1021 Proto => 'tcp', | |
427
daea9cf92c14
Tests: added proxy protocol tests over SPDY.
Sergey Kandaurov <pluknet@nginx.com>
parents:
426
diff
changeset
|
1022 PeerAddr => "127.0.0.1:$port", |
374 | 1023 ); |
1024 alarm(0); | |
1025 }; | |
1026 alarm(0); | |
1027 | |
1028 if ($@) { | |
1029 log_in("died: $@"); | |
1030 return undef; | |
1031 } | |
1032 | |
1033 return $s; | |
1034 } | |
1035 | |
1036 sub dictionary { | |
1037 join('', (map pack('N/a*', $_), qw( | |
1038 options | |
1039 head | |
1040 post | |
1041 put | |
1042 delete | |
1043 trace | |
1044 accept | |
1045 accept-charset | |
1046 accept-encoding | |
1047 accept-language | |
1048 accept-ranges | |
1049 age | |
1050 allow | |
1051 authorization | |
1052 cache-control | |
1053 connection | |
1054 content-base | |
1055 content-encoding | |
1056 content-language | |
1057 content-length | |
1058 content-location | |
1059 content-md5 | |
1060 content-range | |
1061 content-type | |
1062 date | |
1063 etag | |
1064 expect | |
1065 expires | |
1066 from | |
1067 host | |
1068 if-match | |
1069 if-modified-since | |
1070 if-none-match | |
1071 if-range | |
1072 if-unmodified-since | |
1073 last-modified | |
1074 location | |
1075 max-forwards | |
1076 pragma | |
1077 proxy-authenticate | |
1078 proxy-authorization | |
1079 range | |
1080 referer | |
1081 retry-after | |
1082 server | |
1083 te | |
1084 trailer | |
1085 transfer-encoding | |
1086 upgrade | |
1087 user-agent | |
1088 vary | |
1089 via | |
1090 warning | |
1091 www-authenticate | |
1092 method | |
1093 get | |
1094 status), "200 OK", | |
1095 qw(version HTTP/1.1 url public set-cookie keep-alive origin)), | |
1096 "100101201202205206300302303304305306307402405406407408409410", | |
1097 "411412413414415416417502504505", | |
1098 "203 Non-Authoritative Information", | |
1099 "204 No Content", | |
1100 "301 Moved Permanently", | |
1101 "400 Bad Request", | |
1102 "401 Unauthorized", | |
1103 "403 Forbidden", | |
1104 "404 Not Found", | |
1105 "500 Internal Server Error", | |
1106 "501 Not Implemented", | |
1107 "503 Service Unavailable", | |
1108 "Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec", | |
1109 " 00:00:00", | |
1110 " Mon, Tue, Wed, Thu, Fri, Sat, Sun, GMT", | |
1111 "chunked,text/html,image/png,image/jpg,image/gif,", | |
1112 "application/xml,application/xhtml+xml,text/plain,", | |
1113 "text/javascript,public", "privatemax-age=gzip,deflate,", | |
1114 "sdchcharset=utf-8charset=iso-8859-1,utf-,*,enq=0." | |
1115 ); | |
1116 } | |
1117 | |
1118 ############################################################################### | |
487
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1119 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1120 # reply with multiple (also empty) header values |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1121 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1122 sub http_daemon { |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1123 my $server = IO::Socket::INET->new( |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1124 Proto => 'tcp', |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1125 LocalHost => '127.0.0.1', |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1126 LocalPort => 8083, |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1127 Listen => 5, |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1128 Reuse => 1 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1129 ) |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1130 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
|
1131 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1132 local $SIG{PIPE} = 'IGNORE'; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1133 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1134 while (my $client = $server->accept()) { |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1135 $client->autoflush(1); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1136 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1137 my $headers = ''; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1138 my $uri = ''; |
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 while (<$client>) { |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1141 $headers .= $_; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1142 last if (/^\x0d?\x0a?$/); |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1143 } |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1144 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1145 next if $headers eq ''; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1146 $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
|
1147 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1148 if ($uri eq '/inside') { |
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 print $client <<EOF; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1151 HTTP/1.1 200 OK |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1152 Connection: close |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1153 X-Foo: val1 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1154 X-Foo: |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1155 X-Foo: val2 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1156 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1157 EOF |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1158 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1159 } elsif ($uri eq '/first') { |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1160 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1161 print $client <<EOF; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1162 HTTP/1.1 200 OK |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1163 Connection: close |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1164 X-Foo: |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1165 X-Foo: val1 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1166 X-Foo: val2 |
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 EOF |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1169 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1170 } elsif ($uri eq '/last') { |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1171 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1172 print $client <<EOF; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1173 HTTP/1.1 200 OK |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1174 Connection: close |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1175 X-Foo: val1 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1176 X-Foo: val2 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1177 X-Foo: |
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 EOF |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1180 } |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1181 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1182 } continue { |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1183 close $client; |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1184 } |
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 |
c5ff54b56710
Tests: SPDY tests for empty header value.
Sergey Kandaurov <pluknet@nginx.com>
parents:
486
diff
changeset
|
1187 ############################################################################### |