annotate h2.t @ 846:9b5e1c5f0240

Tests: added HTTP/2 test with charset.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 05 Feb 2016 17:40:56 +0300
parents e31f1b5bb569
children 7de036e89770
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1 #!/usr/bin/perl
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3 # (C) Sergey Kandaurov
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4 # (C) Nginx, Inc.
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
5
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
6 # Tests for HTTP/2 protocol [RFC7540].
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
7
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
8 ###############################################################################
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
9
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
10 use warnings;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
11 use strict;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
12
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
13 use Test::More;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
14
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
15 use IO::Select;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
16 use Socket qw/ CRLF /;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
17
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
18 BEGIN { use FindBin; chdir($FindBin::Bin); }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
19
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
20 use lib 'lib';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
21 use Test::Nginx;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
22
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
23 ###############################################################################
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
24
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
25 select STDERR; $| = 1;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
26 select STDOUT; $| = 1;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
27
650
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
28 eval { require IO::Socket::SSL; };
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
29 plan(skip_all => 'IO::Socket::SSL not installed') if $@;
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
30 eval { IO::Socket::SSL::SSL_VERIFY_NONE(); };
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
31 plan(skip_all => 'IO::Socket::SSL too old') if $@;
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
32
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
33 my $t = Test::Nginx->new()->has(qw/http http_ssl http_v2 proxy cache/)
650
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
34 ->has(qw/limit_conn rewrite realip shmem/)
846
9b5e1c5f0240 Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents: 845
diff changeset
35 ->has_daemon('openssl')->plan(307);
704
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
36
755
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
37 # Some systems may have also a bug in not treating zero writev iovcnt as EINVAL
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
38
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
39 $t->todo_alerts();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
40
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
41 $t->write_file_expand('nginx.conf', <<'EOF');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
42
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
43 %%TEST_GLOBALS%%
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
44
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
45 daemon off;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
46
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
47 events {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
48 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
49
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
50 http {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
51 %%TEST_GLOBALS_HTTP%%
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
52
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
53 proxy_cache_path %%TESTDIR%%/cache keys_zone=NAME:1m;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
54 limit_conn_zone $binary_remote_addr zone=conn:1m;
776
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
55 limit_req_zone $binary_remote_addr zone=req:1m rate=1r/s;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
56
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
57 server {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
58 listen 127.0.0.1:8080 http2;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
59 listen 127.0.0.1:8081;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
60 listen 127.0.0.1:8082 proxy_protocol http2;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
61 listen 127.0.0.1:8084 http2 ssl;
784
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
62 listen 127.0.0.1:8092 http2 sndbuf=128;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
63 server_name localhost;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
64
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
65 ssl_certificate_key localhost.key;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
66 ssl_certificate localhost.crt;
696
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
67 http2_max_field_size 128k;
698
f86c8314d205 Tests: one more HTTP/2 test for max frame size.
Sergey Kandaurov <pluknet@nginx.com>
parents: 697
diff changeset
68 http2_max_header_size 128k;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
69
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
70 location / {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
71 add_header X-Header X-Foo;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
72 add_header X-Sent-Foo $http_x_foo;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
73 add_header X-Referer $http_referer;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
74 return 200 'body';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
75 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
76 location /t {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
77 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
78 location /t3.html {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
79 limit_conn conn 1;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
80 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
81 location /gzip.html {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
82 gzip on;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
83 gzip_min_length 0;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
84 alias %%TESTDIR%%/t2.html;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
85 }
680
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
86 location /frame_size {
784
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
87 add_header X-LongHeader $arg_h;
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
88 add_header X-LongHeader $arg_h;
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
89 add_header X-LongHeader $arg_h;
680
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
90 http2_chunk_size 64k;
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
91 alias %%TESTDIR%%/t1.html;
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
92 output_buffers 2 1m;
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
93 }
696
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
94 location /continuation {
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
95 add_header X-LongHeader $arg_h;
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
96 add_header X-LongHeader $arg_h;
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
97 add_header X-LongHeader $arg_h;
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
98 return 200 body;
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
99
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
100 location /continuation/204 {
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
101 return 204;
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
102 }
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
103 }
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
104 location /pp {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
105 set_real_ip_from 127.0.0.1/32;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
106 real_ip_header proxy_protocol;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
107 alias %%TESTDIR%%/t2.html;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
108 add_header X-PP $remote_addr;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
109 }
650
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
110 location /h2 {
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
111 return 200 $http2;
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
112 }
716
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
113 location /sp {
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
114 return 200 $server_protocol;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
115 }
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
116 location /scheme {
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
117 return 200 $scheme;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
118 }
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
119 location /https {
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
120 return 200 $https;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
121 }
651
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
122 location /chunk_size {
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
123 http2_chunk_size 1;
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
124 return 200 'body';
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
125 }
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
126 location /redirect {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
127 error_page 405 /;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
128 return 405;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
129 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
130 location /return301 {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
131 return 301;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
132 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
133 location /return301_absolute {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
134 return 301 text;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
135 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
136 location /return301_relative {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
137 return 301 /;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
138 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
139 location /proxy/ {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
140 add_header X-UC-a $upstream_cookie_a;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
141 add_header X-UC-c $upstream_cookie_c;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
142 proxy_pass http://127.0.0.1:8083/;
652
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
143 proxy_set_header X-Cookie-a $cookie_a;
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
144 proxy_set_header X-Cookie-c $cookie_c;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
145 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
146 location /proxy2/ {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
147 add_header X-Body "$request_body";
845
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
148 add_header X-Body-File $request_body_file;
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
149 client_body_in_file_only on;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
150 proxy_pass http://127.0.0.1:8081/;
764
5dcd998daace Tests: fixed HTTP/2 proxy cache tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 763
diff changeset
151 }
822
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
152 location /limit_req {
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
153 limit_req zone=req burst=2;
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
154 alias %%TESTDIR%%/t2.html;
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
155 }
776
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
156 location /proxy_limit_req/ {
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
157 add_header X-Body $request_body;
845
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
158 add_header X-Body-File $request_body_file;
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
159 client_body_in_file_only on;
776
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
160 proxy_pass http://127.0.0.1:8081/;
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
161 limit_req zone=req burst=2;
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
162 }
764
5dcd998daace Tests: fixed HTTP/2 proxy cache tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 763
diff changeset
163 location /cache/ {
5dcd998daace Tests: fixed HTTP/2 proxy cache tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 763
diff changeset
164 proxy_pass http://127.0.0.1:8081/;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
165 proxy_cache NAME;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
166 proxy_cache_valid 1m;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
167 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
168 location /proxy_buffering_off {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
169 proxy_pass http://127.0.0.1:8081/;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
170 proxy_cache NAME;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
171 proxy_cache_valid 1m;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
172 proxy_buffering off;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
173 }
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
174 location /client_max_body_size {
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
175 add_header X-Body $request_body;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
176 add_header X-Body-File $request_body_file;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
177 client_body_in_single_buffer on;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
178 client_body_in_file_only on;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
179 proxy_pass http://127.0.0.1:8081/;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
180 client_max_body_size 10;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
181 }
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
182 location /set-cookie {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
183 add_header Set-Cookie a=b;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
184 add_header Set-Cookie c=d;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
185 return 200;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
186 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
187 location /cookie {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
188 add_header X-Cookie $http_cookie;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
189 add_header X-Cookie-a $cookie_a;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
190 add_header X-Cookie-c $cookie_c;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
191 return 200;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
192 }
846
9b5e1c5f0240 Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents: 845
diff changeset
193 location /charset {
9b5e1c5f0240 Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents: 845
diff changeset
194 charset utf-8;
9b5e1c5f0240 Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents: 845
diff changeset
195 return 200;
9b5e1c5f0240 Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents: 845
diff changeset
196 }
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
197 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
198
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
199 server {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
200 listen 127.0.0.1:8085 http2;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
201 server_name localhost;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
202 return 200 first;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
203 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
204
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
205 server {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
206 listen 127.0.0.1:8085 http2;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
207 server_name localhost2;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
208 return 200 second;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
209 }
654
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
210
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
211 server {
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
212 listen 127.0.0.1:8086 http2;
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
213 server_name localhost;
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
214
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
215 http2_max_concurrent_streams 1;
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
216 }
684
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
217
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
218 server {
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
219 listen 127.0.0.1:8087 http2;
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
220 server_name localhost;
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
221
766
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
222 http2_max_field_size 22;
684
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
223 }
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
224
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
225 server {
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
226 listen 127.0.0.1:8088 http2;
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
227 server_name localhost;
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
228
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
229 http2_max_header_size 64;
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
230 }
714
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
231
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
232 server {
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
233 listen 127.0.0.1:8089 http2;
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
234 server_name localhost;
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
235
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
236 http2_recv_timeout 1s;
842
60b3e0cfba77 Tests: adjusted h2.t configuration for per-request timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 841
diff changeset
237 client_header_timeout 1s;
60b3e0cfba77 Tests: adjusted h2.t configuration for per-request timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 841
diff changeset
238 send_timeout 1s;
714
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
239 }
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
240
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
241 server {
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
242 listen 127.0.0.1:8090 http2;
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
243 server_name localhost;
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
244
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
245 http2_idle_timeout 1s;
842
60b3e0cfba77 Tests: adjusted h2.t configuration for per-request timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 841
diff changeset
246 client_body_timeout 1s;
755
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
247
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
248 location /proxy2/ {
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
249 add_header X-Body "$request_body";
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
250 proxy_pass http://127.0.0.1:8081/;
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
251 }
714
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
252 }
763
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
253
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
254 server {
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
255 listen 127.0.0.1:8091 http2;
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
256 server_name localhost;
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
257
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
258 send_timeout 1s;
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
259 }
830
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
260
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
261 server {
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
262 listen 127.0.0.1:8093 http2;
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
263 server_name localhost;
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
264
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
265 client_header_timeout 1s;
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
266 client_body_timeout 1s;
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
267
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
268 location /proxy/ {
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
269 proxy_pass http://127.0.0.1:8081/;
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
270 }
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
271 }
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
272 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
273
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
274 EOF
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
275
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
276 $t->write_file('openssl.conf', <<EOF);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
277 [ req ]
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
278 default_bits = 2048
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
279 encrypt_key = no
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
280 distinguished_name = req_distinguished_name
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
281 [ req_distinguished_name ]
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
282 EOF
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
283
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
284 my $d = $t->testdir();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
285
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
286 foreach my $name ('localhost') {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
287 system('openssl req -x509 -new '
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
288 . "-config '$d/openssl.conf' -subj '/CN=$name/' "
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
289 . "-out '$d/$name.crt' -keyout '$d/$name.key' "
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
290 . ">>$d/openssl.out 2>&1") == 0
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
291 or die "Can't create certificate for $name: $!\n";
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
292 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
293
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
294 $t->run_daemon(\&http_daemon);
741
a2e7f5ff3aa8 Tests: hid unwanted output with old OpenSSL.
Sergey Kandaurov <pluknet@nginx.com>
parents: 740
diff changeset
295
a2e7f5ff3aa8 Tests: hid unwanted output with old OpenSSL.
Sergey Kandaurov <pluknet@nginx.com>
parents: 740
diff changeset
296 open OLDERR, ">&", \*STDERR; close STDERR;
a2e7f5ff3aa8 Tests: hid unwanted output with old OpenSSL.
Sergey Kandaurov <pluknet@nginx.com>
parents: 740
diff changeset
297 $t->run();
a2e7f5ff3aa8 Tests: hid unwanted output with old OpenSSL.
Sergey Kandaurov <pluknet@nginx.com>
parents: 740
diff changeset
298 open STDERR, ">&", \*OLDERR;
a2e7f5ff3aa8 Tests: hid unwanted output with old OpenSSL.
Sergey Kandaurov <pluknet@nginx.com>
parents: 740
diff changeset
299
a2e7f5ff3aa8 Tests: hid unwanted output with old OpenSSL.
Sergey Kandaurov <pluknet@nginx.com>
parents: 740
diff changeset
300 $t->waitforsocket('127.0.0.1:8083');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
301
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
302 # file size is slightly beyond initial window size: 2**16 + 80 bytes
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
303
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
304 $t->write_file('t1.html',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
305 join('', map { sprintf "X%04dXXX", $_ } (1 .. 8202)));
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
306 $t->write_file('tbig.html',
723
bc4d6e2bd031 Tests: adjusted HTTP/2 test to trigger write handler in v2 module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 722
diff changeset
307 join('', map { sprintf "XX%06dXX", $_ } (1 .. 500000)));
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
308
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
309 $t->write_file('t2.html', 'SEE-THIS');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
310 $t->write_file('t3.html', 'SEE-THIS');
764
5dcd998daace Tests: fixed HTTP/2 proxy cache tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 763
diff changeset
311 $t->write_file('t4.html', 'SEE-THIS');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
312
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
313 my %cframe = (
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
314 0 => { name => 'DATA', value => \&data },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
315 1 => { name => 'HEADERS', value => \&headers },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
316 # 2 => { name => 'PRIORITY', value => \&priority },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
317 3 => { name => 'RST_STREAM', value => \&rst_stream },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
318 4 => { name => 'SETTINGS', value => \&settings },
720
3c09ccf97d80 Tests: typo.
Sergey Kandaurov <pluknet@nginx.com>
parents: 719
diff changeset
319 # 5 => { name => 'PUSH_PROMISE', value => \&push_promise },
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
320 6 => { name => 'PING', value => \&ping },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
321 7 => { name => 'GOAWAY', value => \&goaway },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
322 8 => { name => 'WINDOW_UPDATE', value => \&window_update },
696
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
323 9 => { name => 'CONTINUATION', value => \&headers },
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
324 );
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
325
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
326 ###############################################################################
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
327
738
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
328 # Upgrade mechanism
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
329
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
330 my $r = http(<<EOF);
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
331 GET / HTTP/1.1
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
332 Host: localhost
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
333 Connection: Upgrade, HTTP2-Settings
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
334 Upgrade: h2c
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
335 HTTP2-Settings: AAMAAABkAAQAAP__
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
336
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
337 EOF
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
338
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
339 SKIP: {
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
340 skip 'no Upgrade-based negotiation', 2 if $r !~ m!HTTP/1.1 101!;
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
341
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
342 like($r, qr!Connection: Upgrade!, 'upgrade - connection');
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
343 like($r, qr!Upgrade: h2c!, 'upgrade - token');
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
344
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
345 }
0881219c0699 Tests: HTTP/2 tests for Upgrade-based negotiation.
Sergey Kandaurov <pluknet@nginx.com>
parents: 737
diff changeset
346
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
347 # SETTINGS
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
348
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
349 my $sess = new_session(8080, pure => 1);
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
350 my $frames = h2_read($sess, all => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
351 { type => 'WINDOW_UPDATE' },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
352 { type => 'SETTINGS'}
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
353 ]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
354
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
355 my ($frame) = grep { $_->{type} eq 'WINDOW_UPDATE' } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
356 ok($frame, 'WINDOW_UPDATE frame');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
357 is($frame->{flags}, 0, 'WINDOW_UPDATE zero flags');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
358 is($frame->{sid}, 0, 'WINDOW_UPDATE zero sid');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
359 is($frame->{length}, 4, 'WINDOW_UPDATE fixed length');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
360
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
361 ($frame) = grep { $_->{type} eq 'SETTINGS' } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
362 ok($frame, 'SETTINGS frame');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
363 is($frame->{flags}, 0, 'SETTINGS flags');
655
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
364 is($frame->{sid}, 0, 'SETTINGS stream');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
365
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
366 h2_settings($sess, 1);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
367 h2_settings($sess, 0);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
368
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
369 $frames = h2_read($sess, all => [{ type => 'SETTINGS' }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
370
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
371 ($frame) = grep { $_->{type} eq 'SETTINGS' } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
372 ok($frame, 'SETTINGS frame ack');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
373 is($frame->{flags}, 1, 'SETTINGS flags ack');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
374
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
375 # PING
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
376
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
377 h2_ping($sess, 'SEE-THIS');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
378 $frames = h2_read($sess, all => [{ type => 'PING' }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
379
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
380 ($frame) = grep { $_->{type} eq "PING" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
381 ok($frame, 'PING frame');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
382 is($frame->{value}, 'SEE-THIS', 'PING payload');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
383 is($frame->{flags}, 1, 'PING flags ack');
655
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
384 is($frame->{sid}, 0, 'PING stream');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
385
714
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
386 # timeouts
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
387
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
388 push my @sess, new_session(8089);
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
389 push @sess, new_session(8089);
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
390 h2_ping($sess[-1], 'SEE-THIS');
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
391 push @sess, new_session(8090);
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
392 push @sess, new_session(8090);
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
393 h2_ping($sess[-1], 'SEE-THIS');
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
394
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
395 select undef, undef, undef, 2.1;
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
396
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
397 $frames = h2_read(shift @sess, all => [{ type => "GOAWAY" }]);
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
398 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
399 ok($frame, 'recv timeout - new connection GOAWAY');
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
400 is($frame->{code}, 1, 'recv timeout - new connection code');
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
401
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
402 $frames = h2_read(shift @sess, all => [{ type => "GOAWAY" }]);
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
403 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
404 is($frame, undef, 'recv timeout - idle connection GOAWAY');
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
405
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
406 $frames = h2_read(shift @sess, all => [{ type => "GOAWAY" }]);
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
407 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
408 is($frame, undef, 'idle timeout - new connection GOAWAY');
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
409
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
410 $frames = h2_read(shift @sess, all => [{ type => "GOAWAY" }]);
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
411 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
412 ok($frame, 'idle timeout - idle connection GOAWAY');
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
413 is($frame->{code}, 0, 'idle timeout - idle connection code');
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
414
759
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
415 # GOAWAY
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
416
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
417 h2_goaway(new_session(), 0, 0, 5);
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
418 h2_goaway(new_session(), 0, 0, 5, 'foobar');
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
419 h2_goaway(new_session(), 0, 0, 5, 'foobar', split => [ 8, 8, 4 ]);
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
420
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
421 $sess = new_session();
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
422 h2_goaway($sess, 0, 0, 5);
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
423 h2_goaway($sess, 0, 0, 5);
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
424
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
425 $sess = new_session();
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
426 h2_goaway($sess, 0, 0, 5, 'foobar', len => 0);
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
427 $frames = h2_read($sess, all => [{ type => "GOAWAY" }]);
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
428
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
429 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
430 ok($frame, 'GOAWAY invalid length - GOAWAY frame');
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
431 is($frame->{code}, 6, 'GOAWAY invalid length - GOAWAY FRAME_SIZE_ERROR');
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
432
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
433 # 6.8. GOAWAY
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
434 # An endpoint MUST treat a GOAWAY frame with a stream identifier other
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
435 # than 0x0 as a connection error (Section 5.4.1) of type PROTOCOL_ERROR.
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
436
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
437 TODO: {
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
438 local $TODO = 'not yet';
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
439
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
440 $sess = new_session();
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
441 h2_goaway($sess, 1, 0, 5, 'foobar');
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
442 $frames = h2_read($sess, all => [{ type => "GOAWAY" }]);
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
443
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
444 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
445 ok($frame, 'GOAWAY invalid stream - GOAWAY frame');
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
446 is($frame->{code}, 1, 'GOAWAY invalid stream - GOAWAY PROTOCOL_ERROR');
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
447
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
448 }
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
449
760
4db976a91540 Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 759
diff changeset
450 # client-initiated PUSH_PROMISE, just to ensure nothing went wrong
4db976a91540 Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 759
diff changeset
451 # N.B. other implementation returns zero code, which is not anyhow regulated
4db976a91540 Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 759
diff changeset
452
4db976a91540 Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 759
diff changeset
453 $sess = new_session();
4db976a91540 Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 759
diff changeset
454 raw_write($sess->{socket}, pack("x2C2xN", 4, 0x5, 1));
4db976a91540 Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 759
diff changeset
455 $frames = h2_read($sess, all => [{ type => "GOAWAY" }]);
4db976a91540 Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 759
diff changeset
456
4db976a91540 Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 759
diff changeset
457 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
4db976a91540 Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 759
diff changeset
458 ok($frame, 'client-initiated PUSH_PROMISE - GOAWAY frame');
4db976a91540 Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 759
diff changeset
459 is($frame->{code}, 1, 'client-initiated PUSH_PROMISE - GOAWAY PROTOCOL_ERROR');
4db976a91540 Tests: HTTP/2 tests for client-initiated PUSH_PROMISE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 759
diff changeset
460
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
461 # GET
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
462
714
ccc9f389e1f8 Tests: HTTP/2 connection timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 712
diff changeset
463 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
464 my $sid = new_stream($sess);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
465 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
466
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
467 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
468 ok($frame, 'HEADERS frame');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
469 is($frame->{sid}, $sid, 'HEADERS stream');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
470 is($frame->{headers}->{':status'}, 200, 'HEADERS status');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
471 is($frame->{headers}->{'x-header'}, 'X-Foo', 'HEADERS header');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
472
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
473 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
474 ok($frame, 'DATA frame');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
475 is($frame->{length}, length 'body', 'DATA length');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
476 is($frame->{data}, 'body', 'DATA payload');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
477
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
478 # GET in the new stream on same connection
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
479
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
480 $sid = new_stream($sess);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
481 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
482
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
483 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
484 is($frame->{sid}, $sid, 'HEADERS stream 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
485 is($frame->{headers}->{':status'}, 200, 'HEADERS status 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
486 is($frame->{headers}->{'x-header'}, 'X-Foo', 'HEADERS header 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
487
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
488 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
489 ok($frame, 'DATA frame 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
490 is($frame->{sid}, $sid, 'HEADERS stream 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
491 is($frame->{length}, length 'body', 'DATA length 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
492 is($frame->{data}, 'body', 'DATA payload 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
493
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
494 # various HEADERS compression/encoding, see hpack() for mode details
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
495
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
496 # 6.1. Indexed Header Field Representation
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
497
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
498 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
499 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
500 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
501 { name => ':scheme', value => 'http', mode => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
502 { name => ':path', value => '/', mode => 0 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
503 { name => ':authority', value => 'localhost', mode => 1 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
504 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
505
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
506 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
507 is($frame->{headers}->{':status'}, 200, 'indexed header field');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
508
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
509 # 6.2.1. Literal Header Field with Incremental Indexing
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
510
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
511 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
512 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
513 { name => ':method', value => 'GET', mode => 1, huff => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
514 { name => ':scheme', value => 'http', mode => 1, huff => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
515 { name => ':path', value => '/', mode => 1, huff => 0 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
516 { name => ':authority', value => 'localhost', mode => 1, huff => 0 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
517 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
518
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
519 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
520 is($frame->{headers}->{':status'}, 200, 'literal with indexing');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
521
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
522 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
523 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
524 { name => ':method', value => 'GET', mode => 1, huff => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
525 { name => ':scheme', value => 'http', mode => 1, huff => 1 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
526 { name => ':path', value => '/', mode => 1, huff => 1 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
527 { name => ':authority', value => 'localhost', mode => 1, huff => 1 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
528 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
529
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
530 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
531 is($frame->{headers}->{':status'}, 200, 'literal with indexing - huffman');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
532
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
533 # 6.2.1. Literal Header Field with Incremental Indexing -- New Name
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
534
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
535 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
536 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
537 { name => ':method', value => 'GET', mode => 2, huff => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
538 { name => ':scheme', value => 'http', mode => 2, huff => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
539 { name => ':path', value => '/', mode => 2, huff => 0 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
540 { name => ':authority', value => 'localhost', mode => 2, huff => 0 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
541 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
542
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
543 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
544 is($frame->{headers}->{':status'}, 200, 'literal with indexing - new');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
545
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
546 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
547 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
548 { name => ':method', value => 'GET', mode => 2, huff => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
549 { name => ':scheme', value => 'http', mode => 2, huff => 1 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
550 { name => ':path', value => '/', mode => 2, huff => 1 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
551 { name => ':authority', value => 'localhost', mode => 2, huff => 1 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
552 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
553
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
554 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
555 is($frame->{headers}->{':status'}, 200, 'literal with indexing - new huffman');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
556
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
557 # 6.2.2. Literal Header Field without Indexing
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
558
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
559 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
560 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
561 { name => ':method', value => 'GET', mode => 3, huff => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
562 { name => ':scheme', value => 'http', mode => 3, huff => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
563 { name => ':path', value => '/', mode => 3, huff => 0 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
564 { name => ':authority', value => 'localhost', mode => 3, huff => 0 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
565 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
566
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
567 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
568 is($frame->{headers}->{':status'}, 200, 'literal without indexing');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
569
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
570 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
571 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
572 { name => ':method', value => 'GET', mode => 3, huff => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
573 { name => ':scheme', value => 'http', mode => 3, huff => 1 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
574 { name => ':path', value => '/', mode => 3, huff => 1 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
575 { name => ':authority', value => 'localhost', mode => 3, huff => 1 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
576 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
577
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
578 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
579 is($frame->{headers}->{':status'}, 200, 'literal without indexing - huffman');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
580
743
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
581 $sess = new_session();
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
582 $sid = new_stream($sess, { headers => [
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
583 { name => ':method', value => 'GET', mode => 3, huff => 0 },
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
584 { name => ':scheme', value => 'http', mode => 3, huff => 0 },
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
585 { name => ':path', value => '/', mode => 3, huff => 0 },
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
586 { name => ':authority', value => 'localhost', mode => 3, huff => 0 },
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
587 { name => 'referer', value => 'foo', mode => 3, huff => 0 }]});
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
588 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
589
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
590 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
591 is($frame->{headers}->{':status'}, 200,
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
592 'literal without indexing - multibyte index');
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
593 is($frame->{headers}->{'x-referer'}, 'foo',
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
594 'literal without indexing - multibyte index value');
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
595
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
596 # 6.2.2. Literal Header Field without Indexing -- New Name
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
597
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
598 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
599 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
600 { name => ':method', value => 'GET', mode => 4, huff => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
601 { name => ':scheme', value => 'http', mode => 4, huff => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
602 { name => ':path', value => '/', mode => 4, huff => 0 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
603 { name => ':authority', value => 'localhost', mode => 4, huff => 0 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
604 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
605
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
606 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
607 is($frame->{headers}->{':status'}, 200, 'literal without indexing - new');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
608
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
609 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
610 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
611 { name => ':method', value => 'GET', mode => 4, huff => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
612 { name => ':scheme', value => 'http', mode => 4, huff => 1 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
613 { name => ':path', value => '/', mode => 4, huff => 1 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
614 { name => ':authority', value => 'localhost', mode => 4, huff => 1 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
615 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
616
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
617 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
744
51a413e673d6 Tests: style.
Sergey Kandaurov <pluknet@nginx.com>
parents: 743
diff changeset
618 is($frame->{headers}->{':status'}, 200,
51a413e673d6 Tests: style.
Sergey Kandaurov <pluknet@nginx.com>
parents: 743
diff changeset
619 'literal without indexing - new huffman');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
620
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
621 # 6.2.3. Literal Header Field Never Indexed
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
622
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
623 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
624 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
625 { name => ':method', value => 'GET', mode => 5, huff => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
626 { name => ':scheme', value => 'http', mode => 5, huff => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
627 { name => ':path', value => '/', mode => 5, huff => 0 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
628 { name => ':authority', value => 'localhost', mode => 5, huff => 0 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
629 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
630
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
631 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
632 is($frame->{headers}->{':status'}, 200, 'literal never indexed');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
633
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
634 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
635 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
636 { name => ':method', value => 'GET', mode => 5, huff => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
637 { name => ':scheme', value => 'http', mode => 5, huff => 1 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
638 { name => ':path', value => '/', mode => 5, huff => 1 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
639 { name => ':authority', value => 'localhost', mode => 5, huff => 1 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
640 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
641
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
642 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
643 is($frame->{headers}->{':status'}, 200, 'literal never indexed - huffman');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
644
743
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
645 $sess = new_session();
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
646 $sid = new_stream($sess, { headers => [
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
647 { name => ':method', value => 'GET', mode => 5, huff => 0 },
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
648 { name => ':scheme', value => 'http', mode => 5, huff => 0 },
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
649 { name => ':path', value => '/', mode => 5, huff => 0 },
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
650 { name => ':authority', value => 'localhost', mode => 5, huff => 0 },
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
651 { name => 'referer', value => 'foo', mode => 5, huff => 0 }]});
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
652 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
653
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
654 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
655 is($frame->{headers}->{':status'}, 200,
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
656 'literal never indexed - multibyte index');
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
657 is($frame->{headers}->{'x-referer'}, 'foo',
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
658 'literal never indexed - multibyte index value');
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
659
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
660 # 6.2.2. Literal Header Field Never Indexed -- New Name
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
661
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
662 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
663 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
664 { name => ':method', value => 'GET', mode => 6, huff => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
665 { name => ':scheme', value => 'http', mode => 6, huff => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
666 { name => ':path', value => '/', mode => 6, huff => 0 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
667 { name => ':authority', value => 'localhost', mode => 6, huff => 0 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
668 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
669
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
670 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
671 is($frame->{headers}->{':status'}, 200, 'literal never indexed - new');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
672
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
673 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
674 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
675 { name => ':method', value => 'GET', mode => 6, huff => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
676 { name => ':scheme', value => 'http', mode => 6, huff => 1 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
677 { name => ':path', value => '/', mode => 6, huff => 1 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
678 { name => ':authority', value => 'localhost', mode => 6, huff => 1 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
679 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
680
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
681 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
682 is($frame->{headers}->{':status'}, 200, 'literal never indexed - new huffman');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
683
743
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
684 # reuse literal with multibyte indexing
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
685
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
686 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
687 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
688 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
689 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
690 { name => ':path', value => '/', mode => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
691 { name => ':authority', value => 'localhost', mode => 1 },
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
692 { name => 'referer', value => 'foo', mode => 1 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
693 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
694
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
695 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
696 is($frame->{headers}->{'x-referer'}, 'foo', 'value with indexing - new');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
697
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
698 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
699 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
700 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
701 { name => ':path', value => '/', mode => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
702 { name => ':authority', value => 'localhost', mode => 0 },
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
703 { name => 'referer', value => 'foo', mode => 0 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
704 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
705
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
706 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
707 is($frame->{headers}->{'x-referer'}, 'foo', 'value with indexing - indexed');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
708
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
709 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
710 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
711 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
712 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
713 { name => ':path', value => '/', mode => 0 },
742
fc21544a8640 Tests: isolated simple HTTP/2 HPACK tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 741
diff changeset
714 { name => ':authority', value => 'localhost', mode => 1 },
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
715 { name => 'x-foo', value => 'X-Bar', mode => 2 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
716 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
717
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
718 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
719 is($frame->{headers}->{'x-sent-foo'}, 'X-Bar', 'name with indexing - new');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
720
743
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
721 # reuse literal with multibyte indexing - reused name
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
722
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
723 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
724 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
725 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
726 { name => ':path', value => '/', mode => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
727 { name => ':authority', value => 'localhost', mode => 0 },
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
728 { name => 'x-foo', value => 'X-Bar', mode => 0 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
729 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
730
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
731 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
732 is($frame->{headers}->{'x-sent-foo'}, 'X-Bar', 'name with indexing - indexed');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
733
743
9cd16dea1392 Tests: more HTTP/2 HPACK tests with multibyte indices.
Sergey Kandaurov <pluknet@nginx.com>
parents: 742
diff changeset
734 # reuse literal with multibyte indexing - reused name only
737
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
735
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
736 $sid = new_stream($sess, { headers => [
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
737 { name => ':method', value => 'GET', mode => 0 },
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
738 { name => ':scheme', value => 'http', mode => 0 },
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
739 { name => ':path', value => '/', mode => 0 },
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
740 { name => ':authority', value => 'localhost', mode => 0 },
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
741 { name => 'x-foo', value => 'X-Baz', mode => 1 }]});
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
742 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
743
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
744 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
745 is($frame->{headers}->{'x-sent-foo'}, 'X-Baz',
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
746 'name with indexing - indexed name');
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
747
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
748 # 6.3. Dynamic Table Size Update
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
749
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
750 # remove some indexed headers from the dynamic table
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
751 # by maintaining dynamic table space only for index 0
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
752 # 'x-foo' has index 0, and 'referer' has index 1
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
753
737
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
754 $sess = new_session();
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
755 $sid = new_stream($sess, { headers => [
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
756 { name => ':method', value => 'GET', mode => 0 },
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
757 { name => ':scheme', value => 'http', mode => 0 },
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
758 { name => ':path', value => '/', mode => 0 },
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
759 { name => ':authority', value => 'localhost', mode => 1 },
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
760 { name => 'referer', value => 'foo', mode => 1 },
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
761 { name => 'x-foo', value => 'X-Bar', mode => 2 }]});
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
762 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
abf42eb6cf48 Tests: HTTP/2 test for indexed header field name in dynamic table.
Sergey Kandaurov <pluknet@nginx.com>
parents: 736
diff changeset
763
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
764 $sid = new_stream($sess, { table_size => 61, headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
765 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
766 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
767 { name => ':path', value => '/', mode => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
768 { name => 'x-foo', value => 'X-Bar', mode => 0 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
769 { name => ':authority', value => 'localhost', mode => 1 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
770 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
771
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
772 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
773 isnt($frame, undef, 'updated table size - remaining index');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
774
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
775 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
776 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
777 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
778 { name => ':path', value => '/', mode => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
779 { name => ':authority', value => 'localhost', mode => 1 },
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
780 { name => 'referer', value => 'foo', mode => 0 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
781 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
782
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
783 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
672
66f94d6c5047 Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 671
diff changeset
784 is($frame, undef, 'invalid index');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
785
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
786 # 5.4.1. Connection Error Handling
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
787 # An endpoint that encounters a connection error SHOULD first send a
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
788 # GOAWAY frame <..>
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
789
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
790 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
672
66f94d6c5047 Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 671
diff changeset
791 ok($frame, 'invalid index - GOAWAY');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
792
691
3f4a132c6463 Tests: extended HTTP/2 tests for GOAWAY on compression error.
Sergey Kandaurov <pluknet@nginx.com>
parents: 685
diff changeset
793 # RFC 7541, 2.3.3. Index Address Space
3f4a132c6463 Tests: extended HTTP/2 tests for GOAWAY on compression error.
Sergey Kandaurov <pluknet@nginx.com>
parents: 685
diff changeset
794 # Indices strictly greater than the sum of the lengths of both tables
3f4a132c6463 Tests: extended HTTP/2 tests for GOAWAY on compression error.
Sergey Kandaurov <pluknet@nginx.com>
parents: 685
diff changeset
795 # MUST be treated as a decoding error.
3f4a132c6463 Tests: extended HTTP/2 tests for GOAWAY on compression error.
Sergey Kandaurov <pluknet@nginx.com>
parents: 685
diff changeset
796
3f4a132c6463 Tests: extended HTTP/2 tests for GOAWAY on compression error.
Sergey Kandaurov <pluknet@nginx.com>
parents: 685
diff changeset
797 # 4.3. Header Compression and Decompression
3f4a132c6463 Tests: extended HTTP/2 tests for GOAWAY on compression error.
Sergey Kandaurov <pluknet@nginx.com>
parents: 685
diff changeset
798 # A decoding error in a header block MUST be treated
3f4a132c6463 Tests: extended HTTP/2 tests for GOAWAY on compression error.
Sergey Kandaurov <pluknet@nginx.com>
parents: 685
diff changeset
799 # as a connection error of type COMPRESSION_ERROR.
3f4a132c6463 Tests: extended HTTP/2 tests for GOAWAY on compression error.
Sergey Kandaurov <pluknet@nginx.com>
parents: 685
diff changeset
800
3f4a132c6463 Tests: extended HTTP/2 tests for GOAWAY on compression error.
Sergey Kandaurov <pluknet@nginx.com>
parents: 685
diff changeset
801 is($frame->{last_sid}, $sid, 'invalid index - GOAWAY last stream');
3f4a132c6463 Tests: extended HTTP/2 tests for GOAWAY on compression error.
Sergey Kandaurov <pluknet@nginx.com>
parents: 685
diff changeset
802 is($frame->{code}, 9, 'invalid index - GOAWAY COMPRESSION_ERROR');
3f4a132c6463 Tests: extended HTTP/2 tests for GOAWAY on compression error.
Sergey Kandaurov <pluknet@nginx.com>
parents: 685
diff changeset
803
739
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
804 # HPACK zero index
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
805
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
806 # RFC 7541, 6.1 Indexed Header Field Representation
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
807 # The index value of 0 is not used. It MUST be treated as a decoding
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
808 # error if found in an indexed header field representation.
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
809
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
810 $sess = new_session();
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
811 $sid = new_stream($sess, { headers => [
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
812 { name => ':method', value => 'GET', mode => 0 },
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
813 { name => ':scheme', value => 'http', mode => 0 },
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
814 { name => ':path', value => '/', mode => 0 },
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
815 { name => ':authority', value => 'localhost', mode => 1 },
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
816 { name => '', value => '', mode => 0 }]});
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
817 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
818
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
819 ok($frame, 'zero index - GOAWAY');
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
820 is($frame->{code}, 9, 'zero index - GOAWAY COMPRESSION_ERROR');
610e394a6e73 Tests: HTTP/2 tests for HPACK zero index.
Sergey Kandaurov <pluknet@nginx.com>
parents: 738
diff changeset
821
729
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
822 # invalid table size update
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
823
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
824 $sess = new_session();
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
825 $sid = new_stream($sess, { table_size => 4097, headers => [
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
826 { name => ':method', value => 'GET', mode => 0 },
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
827 { name => ':scheme', value => 'http', mode => 0 },
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
828 { name => ':path', value => '/', mode => 0 },
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
829 { name => 'x-foo', value => 'X-Bar', mode => 0 },
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
830 { name => ':authority', value => 'localhost', mode => 1 }]});
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
831 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
832
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
833 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
834 ok($frame, 'invalid table size - GOAWAY');
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
835 is($frame->{last_sid}, $sid, 'invalid table size - GOAWAY last stream');
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
836 is($frame->{code}, 9, 'invalid table size - GOAWAY COMPRESSION_ERROR');
41caaaff9b95 Tests: added HTTP/2 tests for invalid table size update.
Sergey Kandaurov <pluknet@nginx.com>
parents: 728
diff changeset
837
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
838 # HEAD
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
839
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
840 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
841 $sid = new_stream($sess, { method => 'HEAD' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
842 $frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
843
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
844 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
845 is($frame->{sid}, $sid, 'HEAD - HEADERS');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
846 is($frame->{headers}->{':status'}, 200, 'HEAD - HEADERS status');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
847 is($frame->{headers}->{'x-header'}, 'X-Foo', 'HEAD - HEADERS header');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
848
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
849 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
850 is($frame, undef, 'HEAD - no body');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
851
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
852 # GET with PROXY protocol
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
853
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
854 my $proxy = 'PROXY TCP4 192.0.2.1 192.0.2.2 1234 5678' . CRLF;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
855 $sess = new_session(8082, proxy => $proxy);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
856 $sid = new_stream($sess, { path => '/pp' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
857 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
858
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
859 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
860 ok($frame, 'PROXY HEADERS frame');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
861 is($frame->{headers}->{'x-pp'}, '192.0.2.1', 'PROXY remote addr');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
862
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
863 # range filter
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
864
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
865 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
866 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
867 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
868 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
869 { name => ':path', value => '/t1.html', mode => 1 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
870 { name => ':authority', value => 'localhost', mode => 1 },
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
871 { name => 'range', value => 'bytes=10-19', mode => 1 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
872 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
873
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
874 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
875 is($frame->{headers}->{':status'}, 206, 'range - HEADERS status');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
876
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
877 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
878 is($frame->{length}, 10, 'range - DATA length');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
879 is($frame->{data}, '002XXXX000', 'range - DATA payload');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
880
650
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
881 # $http2
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
882
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
883 $sess = new_session();
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
884 $sid = new_stream($sess, { path => '/h2' });
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
885 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
886
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
887 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
888 is($frame->{data}, 'h2c', 'http variable - h2c');
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
889
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
890 # SSL/TLS connection, NPN
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
891
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
892 SKIP: {
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
893 eval { IO::Socket::SSL->can_npn() or die; };
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
894 skip 'OpenSSL NPN support required', 1 if $@;
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
895
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
896 $sess = new_session(8084, SSL => 1, npn => 'h2');
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
897 $sid = new_stream($sess, { path => '/h2' });
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
898 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
899
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
900 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
901 is($frame->{data}, 'h2', 'http variable - npn');
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
902
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
903 }
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
904
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
905 # SSL/TLS connection, ALPN
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
906
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
907 SKIP: {
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
908 eval { IO::Socket::SSL->can_alpn() or die; };
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
909 skip 'OpenSSL ALPN support required', 1 if $@;
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
910
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
911 $sess = new_session(8084, SSL => 1, alpn => 'h2');
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
912 $sid = new_stream($sess, { path => '/h2' });
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
913 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
914
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
915 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
916 is($frame->{data}, 'h2', 'http variable - alpn');
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
917
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
918 }
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
919
716
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
920 # $server_protocol
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
921
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
922 $sess = new_session();
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
923 $sid = new_stream($sess, { path => '/sp' });
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
924 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
925
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
926 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
927 is($frame->{data}, 'HTTP/2.0', 'server_protocol variable');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
928
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
929 # $server_protocol - SSL/TLS connection, NPN
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
930
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
931 SKIP: {
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
932 eval { IO::Socket::SSL->can_npn() or die; };
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
933 skip 'OpenSSL NPN support required', 1 if $@;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
934
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
935 $sess = new_session(8084, SSL => 1, npn => 'h2');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
936 $sid = new_stream($sess, { path => '/sp' });
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
937 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
938
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
939 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
940 is($frame->{data}, 'HTTP/2.0', 'server_protocol variable - npn');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
941
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
942 }
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
943
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
944 # $server_protocol - SSL/TLS connection, ALPN
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
945
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
946 SKIP: {
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
947 eval { IO::Socket::SSL->can_alpn() or die; };
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
948 skip 'OpenSSL ALPN support required', 1 if $@;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
949
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
950 $sess = new_session(8084, SSL => 1, alpn => 'h2');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
951 $sid = new_stream($sess, { path => '/sp' });
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
952 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
953
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
954 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
955 is($frame->{data}, 'HTTP/2.0', 'server_protocol variable - alpn');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
956
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
957 }
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
958
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
959 # $scheme
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
960
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
961 $sess = new_session();
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
962 $sid = new_stream($sess, { path => '/scheme' });
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
963 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
964
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
965 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
966 is($frame->{data}, 'http', 'scheme variable');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
967
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
968 # $scheme - SSL/TLS connection, NPN
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
969
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
970 SKIP: {
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
971 eval { IO::Socket::SSL->can_npn() or die; };
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
972 skip 'OpenSSL NPN support required', 1 if $@;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
973
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
974 $sess = new_session(8084, SSL => 1, npn => 'h2');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
975 $sid = new_stream($sess, { path => '/scheme' });
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
976 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
977
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
978 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
979 is($frame->{data}, 'https', 'scheme variable - npn');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
980
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
981 }
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
982
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
983 # $scheme - SSL/TLS connection, ALPN
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
984
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
985 SKIP: {
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
986 eval { IO::Socket::SSL->can_alpn() or die; };
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
987 skip 'OpenSSL ALPN support required', 1 if $@;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
988
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
989 $sess = new_session(8084, SSL => 1, alpn => 'h2');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
990 $sid = new_stream($sess, { path => '/scheme' });
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
991 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
992
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
993 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
994 is($frame->{data}, 'https', 'scheme variable - alpn');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
995
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
996 }
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
997
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
998 # $https
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
999
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1000 $sess = new_session();
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1001 $sid = new_stream($sess, { path => '/https' });
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1002 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1003
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1004 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1005 is($frame->{data}, '', 'https variable');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1006
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1007 # $https - SSL/TLS connection, NPN
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1008
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1009 SKIP: {
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1010 eval { IO::Socket::SSL->can_npn() or die; };
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1011 skip 'OpenSSL NPN support required', 1 if $@;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1012
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1013 $sess = new_session(8084, SSL => 1, npn => 'h2');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1014 $sid = new_stream($sess, { path => '/https' });
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1015 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1016
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1017 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1018 is($frame->{data}, 'on', 'https variable - npn');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1019
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1020 }
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1021
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1022 # $https - SSL/TLS connection, ALPN
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1023
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1024 SKIP: {
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1025 eval { IO::Socket::SSL->can_alpn() or die; };
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1026 skip 'OpenSSL ALPN support required', 1 if $@;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1027
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1028 $sess = new_session(8084, SSL => 1, alpn => 'h2');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1029 $sid = new_stream($sess, { path => '/https' });
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1030 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1031
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1032 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1033 is($frame->{data}, 'on', 'https variable - alpn');
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1034
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1035 }
e3fd2c8d257e Tests: added HTTP/2 tests for some http core module variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 715
diff changeset
1036
651
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
1037 # http2_chunk_size=1
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
1038
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
1039 $sess = new_session();
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
1040 $sid = new_stream($sess, { path => '/chunk_size' });
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
1041 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
1042
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
1043 my @data = grep { $_->{type} eq "DATA" } @$frames;
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
1044 is(@data, 4, 'chunk_size frames');
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
1045 is(join(' ', map { $_->{data} } @data), 'b o d y', 'chunk_size data');
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
1046 is(join(' ', map { $_->{flags} } @data), '0 0 0 1', 'chunk_size flags');
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
1047
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1048 # CONTINUATION
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1049
650
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
1050 $sess = new_session();
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1051 $sid = new_stream($sess, { continuation => 1, headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1052 { name => ':method', value => 'HEAD', mode => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1053 { name => ':scheme', value => 'http', mode => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
1054 { name => ':path', value => '/', mode => 0 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
1055 { name => ':authority', value => 'localhost', mode => 1 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1056 h2_continue($sess, $sid, { continuation => 1, headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1057 { name => 'x-foo', value => 'X-Bar', mode => 2 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1058 h2_continue($sess, $sid, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1059 { name => 'referer', value => 'foo', mode => 2 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1060 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1061
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1062 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1063 is($frame, undef, 'CONTINUATION - fragment 1');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1064
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1065 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1066 is($frame->{headers}->{'x-sent-foo'}, 'X-Bar', 'CONTINUATION - fragment 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1067 is($frame->{headers}->{'x-referer'}, 'foo', 'CONTINUATION - fragment 3');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1068
699
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
1069 # CONTINUATION - in the middle of request header field
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
1070
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
1071 $sess = new_session();
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
1072 $sid = new_stream($sess, { continuation => [ 2, 4, 1, 5 ], headers => [
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
1073 { name => ':method', value => 'HEAD', mode => 1 },
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
1074 { name => ':scheme', value => 'http', mode => 0 },
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
1075 { name => ':path', value => '/', mode => 0 },
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
1076 { name => ':authority', value => 'localhost', mode => 1 }]});
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
1077 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
1078
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
1079 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
1080 is($frame->{headers}->{':status'}, 200, 'CONTINUATION - in header field');
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
1081
761
01feb5d4d7a4 Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 760
diff changeset
1082 # CONTINUATION on a closed stream
01feb5d4d7a4 Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 760
diff changeset
1083
01feb5d4d7a4 Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 760
diff changeset
1084 h2_continue($sess, 1, { headers => [
01feb5d4d7a4 Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 760
diff changeset
1085 { name => 'x-foo', value => 'X-Bar', mode => 2 }]});
01feb5d4d7a4 Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 760
diff changeset
1086 $frames = h2_read($sess, all => [{ sid => 1, fin => 1 }]);
01feb5d4d7a4 Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 760
diff changeset
1087
01feb5d4d7a4 Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 760
diff changeset
1088 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
01feb5d4d7a4 Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 760
diff changeset
1089 is($frame->{type}, 'GOAWAY', 'GOAWAY - CONTINUATION closed stream');
01feb5d4d7a4 Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 760
diff changeset
1090 is($frame->{code}, 1, 'GOAWAY - CONTINUATION closed stream - PROTOCOL_ERROR');
01feb5d4d7a4 Tests: HTTP/2 test for CONTINUATION on a closed stream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 760
diff changeset
1091
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1092 # frame padding
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1093
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1094 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1095 $sid = new_stream($sess, { padding => 42, headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1096 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1097 { name => ':scheme', value => 'http', mode => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
1098 { name => ':path', value => '/', mode => 0 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
1099 { name => ':authority', value => 'localhost', mode => 1 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1100 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1101
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1102 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1103 is($frame->{headers}->{':status'}, 200, 'padding - HEADERS status');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1104
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1105 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1106 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1107 { name => ':scheme', value => 'http', mode => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
1108 { name => ':path', value => '/', mode => 0 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
1109 { name => ':authority', value => 'localhost', mode => 1 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1110 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1111
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1112 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1113 is($frame->{headers}->{':status'}, 200, 'padding - next stream');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1114
821
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1115 # padding followed by CONTINUATION
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1116
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1117 TODO: {
840
ecffe6c23a14 Tests: updated HTTP/2 padding TODO, fixed in 0e0e2e522fa2 (1.9.11).
Sergey Kandaurov <pluknet@nginx.com>
parents: 833
diff changeset
1118 local $TODO = 'not yet' unless $t->has_version('1.9.11');
821
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1119
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1120 $sess = new_session();
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1121 $sid = new_stream($sess, { padding => 42, continuation => [ 2, 4, 1, 5 ],
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1122 headers => [
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1123 { name => ':method', value => 'GET', mode => 1 },
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1124 { name => ':scheme', value => 'http', mode => 0 },
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1125 { name => ':path', value => '/', mode => 0 },
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1126 { name => ':authority', value => 'localhost', mode => 1 }]});
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1127 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1128
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1129 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1130 is($frame->{headers}->{':status'}, 200, 'padding - CONTINUATION');
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1131
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1132 }
d75000247e1f Tests: added HTTP/2 test for padded HEADERS with CONTINUATION.
Sergey Kandaurov <pluknet@nginx.com>
parents: 818
diff changeset
1133
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1134 # request header field with multiple values
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1135
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1136 # 8.1.2.5. Compressing the Cookie Header Field
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1137 # To allow for better compression efficiency, the Cookie header field
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1138 # MAY be split into separate header fields <..>.
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1139
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1140 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1141 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1142 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1143 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1144 { name => ':path', value => '/cookie', mode => 2 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
1145 { name => ':authority', value => 'localhost', mode => 1 },
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1146 { name => 'cookie', value => 'a=b', mode => 2},
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1147 { name => 'cookie', value => 'c=d', mode => 2}]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1148 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1149
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1150 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1151 is($frame->{headers}->{'x-cookie-a'}, 'b',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1152 'multiple request header fields - cookie');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1153 is($frame->{headers}->{'x-cookie-c'}, 'd',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1154 'multiple request header fields - cookie 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1155 is($frame->{headers}->{'x-cookie'}, 'a=b; c=d',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1156 'multiple request header fields - semi-colon');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1157
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1158 # request header field with multiple values to HTTP backend
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1159
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1160 # 8.1.2.5. Compressing the Cookie Header Field
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1161 # these MUST be concatenated into a single octet string
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1162 # using the two-octet delimiter of 0x3B, 0x20 (the ASCII string "; ")
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1163 # before being passed into a non-HTTP/2 context, such as an HTTP/1.1
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1164 # connection <..>
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1165
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1166 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1167 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1168 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1169 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1170 { name => ':path', value => '/proxy/cookie', mode => 2 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
1171 { name => ':authority', value => 'localhost', mode => 1 },
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1172 { name => 'cookie', value => 'a=b', mode => 2 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1173 { name => 'cookie', value => 'c=d', mode => 2 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1174 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1175
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1176 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
652
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
1177 is($frame->{headers}->{'x-sent-cookie'}, 'a=b; c=d',
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1178 'multiple request header fields proxied - semi-colon');
652
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
1179 is($frame->{headers}->{'x-sent-cookie2'}, '',
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
1180 'multiple request header fields proxied - dublicate cookie');
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
1181 is($frame->{headers}->{'x-sent-cookie-a'}, 'b',
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
1182 'multiple request header fields proxied - cookie 1');
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
1183 is($frame->{headers}->{'x-sent-cookie-c'}, 'd',
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
1184 'multiple request header fields proxied - cookie 2');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1185
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1186 # response header field with multiple values
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1187
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1188 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1189 $sid = new_stream($sess, { path => '/set-cookie' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1190 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1191
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1192 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1193 is($frame->{headers}->{'set-cookie'}[0], 'a=b',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1194 'multiple response header fields - cookie');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1195 is($frame->{headers}->{'set-cookie'}[1], 'c=d',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1196 'multiple response header fields - cookie 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1197
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1198 # response header field with multiple values from HTTP backend
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1199
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1200 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1201 $sid = new_stream($sess, { path => '/proxy/set-cookie' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1202 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1203
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1204 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1205 is($frame->{headers}->{'set-cookie'}[0], 'a=b',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1206 'multiple response header proxied - cookie');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1207 is($frame->{headers}->{'set-cookie'}[1], 'c=d',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1208 'multiple response header proxied - cookie 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1209 is($frame->{headers}->{'x-uc-a'}, 'b',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1210 'multiple response header proxied - upstream cookie');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1211 is($frame->{headers}->{'x-uc-c'}, 'd',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1212 'multiple response header proxied - upstream cookie 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1213
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1214 # internal redirect
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1215
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1216 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1217 $sid = new_stream($sess, { path => '/redirect' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1218 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1219
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1220 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1221 is($frame->{headers}->{':status'}, 405, 'redirect - HEADERS');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1222
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1223 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1224 ok($frame, 'redirect - DATA');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1225 is($frame->{data}, 'body', 'redirect - DATA payload');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1226
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1227 # return 301 with absolute URI
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1228
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1229 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1230 $sid = new_stream($sess, { path => '/return301_absolute' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1231 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1232
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1233 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1234 is($frame->{headers}->{':status'}, 301, 'return 301 absolute - status');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1235 is($frame->{headers}->{'location'}, 'text', 'return 301 absolute - location');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1236
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1237 # return 301 with relative URI
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1238
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1239 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1240 $sid = new_stream($sess, { path => '/return301_relative' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1241 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1242
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1243 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1244 is($frame->{headers}->{':status'}, 301, 'return 301 relative - status');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1245 is($frame->{headers}->{'location'}, 'http://127.0.0.1:8080/',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1246 'return 301 relative - location');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1247
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1248 # return 301 with relative URI and ':authority' request header field
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1249
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1250 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1251 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1252 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1253 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1254 { name => ':path', value => '/return301_relative', mode => 2 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1255 { name => ':authority', value => 'localhost', mode => 2 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1256 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1257
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1258 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1259 is($frame->{headers}->{':status'}, 301,
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1260 'return 301 relative - authority - status');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1261 is($frame->{headers}->{'location'}, 'http://localhost:8080/',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1262 'return 301 relative - authority - location');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1263
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1264 # return 301 with relative URI and 'host' request header field
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1265
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1266 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1267 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1268 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1269 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1270 { name => ':path', value => '/return301_relative', mode => 2 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1271 { name => 'host', value => 'localhost', mode => 2 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1272 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1273
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1274 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1275 is($frame->{headers}->{':status'}, 301,
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1276 'return 301 relative - host - status');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1277 is($frame->{headers}->{'location'}, 'http://localhost:8080/',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1278 'return 301 relative - host - location');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1279
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1280 # virtual host
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1281
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1282 $sess = new_session(8085);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1283 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1284 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1285 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1286 { name => ':path', value => '/', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1287 { name => 'host', value => 'localhost', mode => 2 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1288 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1289
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1290 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1291 is($frame->{headers}->{':status'}, 200,
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1292 'virtual host - host - status');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1293
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1294 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1295 is($frame->{data}, 'first', 'virtual host - host - DATA');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1296
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1297 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1298 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1299 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1300 { name => ':path', value => '/', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1301 { name => ':authority', value => 'localhost', mode => 2 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1302 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1303
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1304 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1305 is($frame->{headers}->{':status'}, 200,
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1306 'virtual host - authority - status');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1307
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1308 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1309 is($frame->{data}, 'first', 'virtual host - authority - DATA');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1310
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1311 # virtual host - second
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1312
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1313 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1314 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1315 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1316 { name => ':path', value => '/', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1317 { name => 'host', value => 'localhost2', mode => 2 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1318 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1319
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1320 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1321 is($frame->{headers}->{':status'}, 200,
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1322 'virtual host 2 - host - status');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1323
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1324 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1325 is($frame->{data}, 'second', 'virtual host 2 - host - DATA');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1326
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1327 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1328 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1329 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1330 { name => ':path', value => '/', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1331 { name => ':authority', value => 'localhost2', mode => 2 }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1332 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1333
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1334 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1335 is($frame->{headers}->{':status'}, 200,
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1336 'virtual host 2 - authority - status');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1337
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1338 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1339 is($frame->{data}, 'second', 'virtual host 2 - authority - DATA');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1340
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1341 # gzip tests for internal nginx version
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1342
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1343 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1344 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1345 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1346 { name => ':scheme', value => 'http', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1347 { name => ':path', value => '/gzip.html' },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
1348 { name => ':authority', value => 'localhost', mode => 1 },
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1349 { name => 'accept-encoding', value => 'gzip' }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1350 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1351
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1352 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1353 is($frame->{headers}->{'content-encoding'}, 'gzip', 'gzip - encoding');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1354
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1355 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
647
4e36550410b3 Tests: h2.t fixes for older perl versions, and gzip test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 646
diff changeset
1356 gunzip_like($frame->{data}, qr/^SEE-THIS\Z/, 'gzip - DATA');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1357
846
9b5e1c5f0240 Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents: 845
diff changeset
1358 # charset
9b5e1c5f0240 Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents: 845
diff changeset
1359
9b5e1c5f0240 Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents: 845
diff changeset
1360 $sess = new_session();
9b5e1c5f0240 Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents: 845
diff changeset
1361 $sid = new_stream($sess, { path => '/charset' });
9b5e1c5f0240 Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents: 845
diff changeset
1362 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
9b5e1c5f0240 Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents: 845
diff changeset
1363
9b5e1c5f0240 Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents: 845
diff changeset
1364 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
9b5e1c5f0240 Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents: 845
diff changeset
1365 is($frame->{headers}->{'content-type'}, 'text/plain; charset=utf-8', 'charset');
9b5e1c5f0240 Tests: added HTTP/2 test with charset.
Sergey Kandaurov <pluknet@nginx.com>
parents: 845
diff changeset
1366
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1367 # simple proxy cache test
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1368
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1369 $sess = new_session();
764
5dcd998daace Tests: fixed HTTP/2 proxy cache tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 763
diff changeset
1370 $sid = new_stream($sess, { path => '/cache/t4.html' });
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1371 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1372
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1373 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1374 is($frame->{headers}->{':status'}, '200', 'proxy cache');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1375
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1376 my $etag = $frame->{headers}->{'etag'};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1377
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1378 ($frame) = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1379 is($frame->{length}, length 'SEE-THIS', 'proxy cache - DATA');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1380 is($frame->{data}, 'SEE-THIS', 'proxy cache - DATA payload');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1381
764
5dcd998daace Tests: fixed HTTP/2 proxy cache tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 763
diff changeset
1382 $t->write_file('t4.html', 'NOOP');
5dcd998daace Tests: fixed HTTP/2 proxy cache tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 763
diff changeset
1383
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1384 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1385 { name => ':method', value => 'GET', mode => 0 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1386 { name => ':scheme', value => 'http', mode => 0 },
764
5dcd998daace Tests: fixed HTTP/2 proxy cache tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 763
diff changeset
1387 { name => ':path', value => '/cache/t4.html' },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
1388 { name => ':authority', value => 'localhost', mode => 1 },
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1389 { name => 'if-none-match', value => $etag }]});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1390 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1391
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1392 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1393 is($frame->{headers}->{':status'}, 304, 'proxy cache conditional');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1394
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1395 # HEADERS could be received with fin, followed by DATA
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1396
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1397 $sess = new_session();
764
5dcd998daace Tests: fixed HTTP/2 proxy cache tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 763
diff changeset
1398 $sid = new_stream($sess, { path => '/cache/t2.html?1', method => 'HEAD' });
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1399
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1400 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1401 push @$frames, $_ for @{h2_read($sess, all => [{ sid => $sid }])};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1402 ok(!grep ({ $_->{type} eq "DATA" } @$frames), 'proxy cache HEAD - no body');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1403
765
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1404 # proxy cache - expect no stray empty DATA frame
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1405
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1406 TODO: {
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1407 local $TODO = 'not yet';
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1408
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1409 $sess = new_session();
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1410 $sid = new_stream($sess, { path => '/cache/t2.html?2' });
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1411
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1412 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1413 @data = grep ({ $_->{type} eq "DATA" } @$frames);
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1414 is(@data, 1, 'proxy cache write - data frames');
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1415 is(join(' ', map { $_->{data} } @data), 'SEE-THIS', 'proxy cache write - data');
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1416 is(join(' ', map { $_->{flags} } @data), '1', 'proxy cache write - flags');
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1417
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1418 }
14d6f69b7d9d Tests: added HTTP/2 proxy cache tests for empty DATA frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 764
diff changeset
1419
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1420 # HEAD on empty cache with proxy_buffering off
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1421
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1422 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1423 $sid = new_stream($sess,
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1424 { path => '/proxy_buffering_off/t2.html?1', method => 'HEAD' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1425
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1426 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1427 push @$frames, $_ for @{h2_read($sess, all => [{ sid => $sid }])};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1428 ok(!grep ({ $_->{type} eq "DATA" } @$frames),
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1429 'proxy cache HEAD buffering off - no body');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1430
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1431 # request body (uses proxied response)
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1432
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1433 $sess = new_session();
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1434 $sid = new_stream($sess, { path => '/proxy2/t2.html', body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1435 h2_body($sess, 'TEST');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1436 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1437
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1438 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
845
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1439 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TEST', 'request body');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1440
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1441 # request body with padding (uses proxied response)
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1442
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1443 $sess = new_session();
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1444 $sid = new_stream($sess, { path => '/proxy2/t2.html', body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1445 h2_body($sess, 'TEST', { body_padding => 42 });
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1446 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1447
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1448 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
845
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1449 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TEST',
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1450 'request body with padding');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1451
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1452 $sid = new_stream($sess);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1453 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1454
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1455 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1456 is($frame->{headers}->{':status'}, '200', 'request body with padding - next');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1457
745
cdd3659d1144 Tests: simple HTTP/2 test for request body in multiple DATA frames.
Sergey Kandaurov <pluknet@nginx.com>
parents: 744
diff changeset
1458 # request body sent in multiple DATA frames (uses proxied response)
cdd3659d1144 Tests: simple HTTP/2 test for request body in multiple DATA frames.
Sergey Kandaurov <pluknet@nginx.com>
parents: 744
diff changeset
1459
cdd3659d1144 Tests: simple HTTP/2 test for request body in multiple DATA frames.
Sergey Kandaurov <pluknet@nginx.com>
parents: 744
diff changeset
1460 $sess = new_session();
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1461 $sid = new_stream($sess, { path => '/proxy2/t2.html', body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1462 h2_body($sess, 'TEST', { body_split => [2] });
745
cdd3659d1144 Tests: simple HTTP/2 test for request body in multiple DATA frames.
Sergey Kandaurov <pluknet@nginx.com>
parents: 744
diff changeset
1463 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
cdd3659d1144 Tests: simple HTTP/2 test for request body in multiple DATA frames.
Sergey Kandaurov <pluknet@nginx.com>
parents: 744
diff changeset
1464
cdd3659d1144 Tests: simple HTTP/2 test for request body in multiple DATA frames.
Sergey Kandaurov <pluknet@nginx.com>
parents: 744
diff changeset
1465 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
845
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1466 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TEST',
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1467 'request body in multiple frames');
745
cdd3659d1144 Tests: simple HTTP/2 test for request body in multiple DATA frames.
Sergey Kandaurov <pluknet@nginx.com>
parents: 744
diff changeset
1468
833
62315953d703 Tests: HTTP/2 test with empty request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 832
diff changeset
1469 # request body with an empty DATA frame
62315953d703 Tests: HTTP/2 test with empty request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 832
diff changeset
1470 # "zero size buf in output" alerts seen
62315953d703 Tests: HTTP/2 test with empty request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 832
diff changeset
1471
62315953d703 Tests: HTTP/2 test with empty request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 832
diff changeset
1472 $sess = new_session();
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1473 $sid = new_stream($sess, { path => '/proxy2/', body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1474 h2_body($sess, '');
833
62315953d703 Tests: HTTP/2 test with empty request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 832
diff changeset
1475 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
62315953d703 Tests: HTTP/2 test with empty request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 832
diff changeset
1476
62315953d703 Tests: HTTP/2 test with empty request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 832
diff changeset
1477 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
62315953d703 Tests: HTTP/2 test with empty request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 832
diff changeset
1478 is($frame->{headers}->{':status'}, 200, 'request body - empty');
62315953d703 Tests: HTTP/2 test with empty request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 832
diff changeset
1479
845
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1480 TODO: {
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1481 local $TODO = 'not yet';
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1482
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1483 ok($frame->{headers}{'x-body-file'}, 'request body - empty body file');
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1484
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1485 }
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1486
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1487 TODO: {
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1488 todo_skip 'empty body file', 1 unless $frame->{headers}{'x-body-file'};
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1489
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1490 is(read_body_file($frame->{headers}{'x-body-file'}), '',
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1491 'request body - empty content');
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1492
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1493 }
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1494
776
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1495 # request body delayed in limit_req
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1496
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1497 $sess = new_session();
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1498 $sid = new_stream($sess, { path => '/proxy_limit_req/', body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1499 h2_body($sess, 'TEST');
776
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1500 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1501
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1502 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
845
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1503 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TEST',
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1504 'request body - limit req');
776
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1505
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1506 # predict send windows
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1507
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1508 $sid = new_stream($sess);
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1509 my ($maxwin) = sort {$a <=> $b} $sess->{streams}{$sid}, $sess->{conn_window};
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1510
776
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1511 SKIP: {
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1512 skip 'leaves coredump', 1 unless $t->has_version('1.9.7');
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1513 skip 'not enough window', 1 if $maxwin < 5;
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1514
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1515 $sess = new_session();
776
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1516 $sid = new_stream($sess, { path => '/proxy_limit_req/', body => 'TEST2' });
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1517 select undef, undef, undef, 1.1;
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1518 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1519
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1520 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
845
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1521 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TEST2',
e31f1b5bb569 Tests: in HTTP/2 tests, read body with $request_body_file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 844
diff changeset
1522 'request body - limit req 2');
776
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1523
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1524 }
3fc382902cba Tests: added HTTP/2 test for request body delayed in limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 772
diff changeset
1525
822
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1526 # partial request body data frame received (to be discarded) within request
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1527 # delayed in limit_req, the rest of data frame is received after response
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1528
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1529 $sess = new_session();
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1530
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1531 SKIP: {
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1532 skip 'not enough window', 1 if $maxwin < 4;
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1533
822
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1534 TODO: {
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1535 todo_skip 'use-after-free', 1 unless $ENV{TEST_NGINX_UNSAFE};
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1536
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1537 $sid = new_stream($sess, { path => '/limit_req', body => 'TEST', split => [61],
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1538 split_delay => 1.1 });
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1539 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1540
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1541 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1542 is($frame->{headers}->{':status'}, '200', 'discard body - limit req - limited');
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1543
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1544 }
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1545
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1546 }
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1547
822
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1548 $sid = new_stream($sess, { path => '/' });
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1549 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1550
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1551 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1552 is($frame->{headers}->{':status'}, '200', 'discard body - limit req - next');
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1553
829
5c003c3b8e9e Tests: style.
Sergey Kandaurov <pluknet@nginx.com>
parents: 822
diff changeset
1554 # ditto, but instead of receiving the rest of data frame, connection is closed
822
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1555 # 'http request already closed while closing request' alert can be produced
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1556
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1557 SKIP: {
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1558 skip 'not enough window', 1 if $maxwin < 4;
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1559
822
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1560 TODO: {
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1561 todo_skip 'use-after-free', 1 unless $ENV{TEST_NGINX_UNSAFE};
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1562
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1563 $sess = new_session();
829
5c003c3b8e9e Tests: style.
Sergey Kandaurov <pluknet@nginx.com>
parents: 822
diff changeset
1564 $sid = new_stream($sess, { path => '/limit_req', body => 'TEST', split => [61],
5c003c3b8e9e Tests: style.
Sergey Kandaurov <pluknet@nginx.com>
parents: 822
diff changeset
1565 abort => 1 });
822
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1566 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1567
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1568 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1569 is($frame->{headers}->{':status'}, '200', 'discard body - limit req - eof');
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1570
832
04eb968b0987 Tests: corrected HTTP/2 test timeout for discard body with EOF.
Sergey Kandaurov <pluknet@nginx.com>
parents: 831
diff changeset
1571 select undef, undef, undef, 1.1;
822
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1572 undef $sess;
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1573
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1574 }
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
1575
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1576 }
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1577
830
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1578 # partial request header frame received (field split),
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1579 # the rest of frame is received after client header timeout
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1580
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1581 TODO: {
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1582 local $TODO = 'not yet';
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1583
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1584 $sess = new_session(8093);
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1585 $sid = new_stream($sess, { path => '/t2.html', split => [35],
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1586 split_delay => 2.1 });
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1587 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]);
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1588
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1589 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames;
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1590 ok($frame, 'client header timeout');
841
6a401b5fa812 Tests: check timed out HTTP/2 streams for proper RST_STREAM code.
Sergey Kandaurov <pluknet@nginx.com>
parents: 840
diff changeset
1591 is($frame->{code}, 1, 'client header timeout - protocol error');
830
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1592
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1593 }
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1594
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1595 h2_ping($sess, 'SEE-THIS');
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1596 $frames = h2_read($sess, all => [{ type => 'PING' }]);
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1597
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1598 ($frame) = grep { $_->{type} eq "PING" && $_->{flags} & 0x1 } @$frames;
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1599 ok($frame, 'client header timeout - PING');
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1600
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1601 # partial request body data frame received, the rest is after body timeout
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1602
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1603 TODO: {
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1604 local $TODO = 'not yet';
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1605
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1606 $sess = new_session(8093);
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1607 $sid = new_stream($sess, { path => '/proxy/t2.html', body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1608 h2_body($sess, 'TEST', { split => [10], split_delay => 2.1 });
830
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1609 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]);
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1610
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1611 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames;
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1612 ok($frame, 'client body timeout');
841
6a401b5fa812 Tests: check timed out HTTP/2 streams for proper RST_STREAM code.
Sergey Kandaurov <pluknet@nginx.com>
parents: 840
diff changeset
1613 is($frame->{code}, 1, 'client body timeout - protocol error');
830
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1614
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1615 }
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1616
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1617 h2_ping($sess, 'SEE-THIS');
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1618 $frames = h2_read($sess, all => [{ type => 'PING' }]);
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1619
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1620 ($frame) = grep { $_->{type} eq "PING" && $_->{flags} & 0x1 } @$frames;
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1621 ok($frame, 'client body timeout - PING');
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
1622
767
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1623 # malformed request body length not equal to content-length
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1624
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1625 $sess = new_session();
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1626 $sid = new_stream($sess,
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1627 { path => '/proxy2/t2.html', body_more => 1, headers => [
767
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1628 { name => ':method', value => 'GET', mode => 0 },
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1629 { name => ':scheme', value => 'http', mode => 0 },
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1630 { name => ':path', value => '/client_max_body_size', mode => 1 },
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1631 { name => ':authority', value => 'localhost', mode => 1 },
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1632 { name => 'content-length', value => '5', mode => 1 }]});
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1633 h2_body($sess, 'TEST');
767
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1634 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1635
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1636 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1637 is($frame->{headers}->{':status'}, 400, 'request body less than content-length');
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1638
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1639 $sid = new_stream($sess,
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1640 { path => '/proxy2/t2.html', body_more => 1, headers => [
767
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1641 { name => ':method', value => 'GET', mode => 0 },
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1642 { name => ':scheme', value => 'http', mode => 0 },
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1643 { name => ':path', value => '/client_max_body_size', mode => 1 },
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1644 { name => ':authority', value => 'localhost', mode => 1 },
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1645 { name => 'content-length', value => '3', mode => 1 }]});
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1646 h2_body($sess, 'TEST');
767
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1647 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1648
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1649 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1650 is($frame->{headers}->{':status'}, 400, 'request body more than content-length');
fc846cf75c34 Tests: added HTTP/2 tests for malformed request body length.
Sergey Kandaurov <pluknet@nginx.com>
parents: 766
diff changeset
1651
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1652 # client_max_body_size
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1653
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1654 $sess = new_session();
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1655 $sid = new_stream($sess, { path => '/client_max_body_size/t2.html',
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1656 body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1657 h2_body($sess, 'TESTTEST12');
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1658 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1659
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1660 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1661 is($frame->{headers}->{':status'}, 200, 'client_max_body_size - status');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1662 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST12',
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1663 'client_max_body_size - body');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1664
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1665 # client_max_body_size - limited
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1666
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1667 $sess = new_session();
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1668 $sid = new_stream($sess, { path => '/client_max_body_size/t2.html',
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1669 body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1670 h2_body($sess, 'TESTTEST123');
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1671 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1672
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1673 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1674 is($frame->{headers}->{':status'}, 413, 'client_max_body_size - limited');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1675
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1676 # client_max_body_size - many DATA frames
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1677
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1678 $sess = new_session();
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1679 $sid = new_stream($sess, { path => '/client_max_body_size/t2.html',
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1680 body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1681 h2_body($sess, 'TESTTEST12', { body_split => [2] });
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1682 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1683
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1684 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1685 is($frame->{headers}->{':status'}, 200, 'client_max_body_size many - status');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1686 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST12',
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1687 'client_max_body_size many - body');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1688
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1689 # client_max_body_size - many DATA frames - limited
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1690
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1691 $sess = new_session();
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1692 $sid = new_stream($sess, { path => '/client_max_body_size/t2.html',
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1693 body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1694 h2_body($sess, 'TESTTEST123', { body_split => [2] });
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1695 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1696
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1697 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1698 is($frame->{headers}->{':status'}, 413, 'client_max_body_size many - limited');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1699
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1700 # client_max_body_size - padded DATA
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1701
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1702 $sess = new_session();
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1703 $sid = new_stream($sess, { path => '/client_max_body_size/t2.html',
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1704 body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1705 h2_body($sess, 'TESTTEST12', { body_padding => 42 });
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1706 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1707
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1708 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1709 is($frame->{headers}->{':status'}, 200, 'client_max_body_size pad - status');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1710 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST12',
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1711 'client_max_body_size pad - body');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1712
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1713 # client_max_body_size - padded DATA - limited
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1714
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1715 $sess = new_session();
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1716 $sid = new_stream($sess, { path => '/client_max_body_size/t2.html',
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1717 body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1718 h2_body($sess, 'TESTTEST123', { body_padding => 42 });
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1719 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1720
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1721 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1722 is($frame->{headers}->{':status'}, 413, 'client_max_body_size pad - limited');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1723
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1724 # client_max_body_size - many padded DATA frames
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1725
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1726 $sess = new_session();
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1727 $sid = new_stream($sess, { path => '/client_max_body_size/t2.html',
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1728 body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1729 h2_body($sess, 'TESTTEST12', { body_padding => 42, body_split => [2] });
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1730 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1731
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1732 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1733 is($frame->{headers}->{':status'}, 200,
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1734 'client_max_body_size many pad - status');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1735 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST12',
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1736 'client_max_body_size many pad - body');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1737
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1738 # client_max_body_size - many padded DATA frames - limited
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1739
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1740 $sess = new_session();
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1741 $sid = new_stream($sess, { path => '/client_max_body_size/t2.html',
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1742 body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1743 h2_body($sess, 'TESTTEST123', { body_padding => 42, body_split => [2] });
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1744 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1745
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1746 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1747 is($frame->{headers}->{':status'}, 413,
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1748 'client_max_body_size many pad - limited');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1749
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1750 # request body without content-length
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1751
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1752 $sess = new_session();
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1753 $sid = new_stream($sess, { body_more => 1, headers => [
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1754 { name => ':method', value => 'GET', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1755 { name => ':scheme', value => 'http', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1756 { name => ':path', value => '/client_max_body_size', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1757 { name => ':authority', value => 'localhost', mode => 2 }]});
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1758 h2_body($sess, 'TESTTEST12');
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1759 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1760
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1761 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1762 is($frame->{headers}->{':status'}, 200,
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1763 'request body without content-length - status');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1764 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST12',
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1765 'request body without content-length - body');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1766
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1767 # request body without content-length - limited
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1768
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1769 $sess = new_session();
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1770 $sid = new_stream($sess, { body_more => 1, headers => [
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1771 { name => ':method', value => 'GET', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1772 { name => ':scheme', value => 'http', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1773 { name => ':path', value => '/client_max_body_size', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1774 { name => ':authority', value => 'localhost', mode => 2 }]});
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1775 h2_body($sess, 'TESTTEST123');
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1776 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1777
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1778 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1779 is($frame->{headers}->{':status'}, 413,
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1780 'request body without content-length - limited');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1781
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1782 # request body without content-length - many DATA frames
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1783
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1784 $sess = new_session();
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1785 $sid = new_stream($sess, { body_more => 1, headers => [
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1786 { name => ':method', value => 'GET', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1787 { name => ':scheme', value => 'http', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1788 { name => ':path', value => '/client_max_body_size', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1789 { name => ':authority', value => 'localhost', mode => 2 }]});
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1790 h2_body($sess, 'TESTTEST12', { body_split => [2] });
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1791 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1792
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1793 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1794 is($frame->{headers}->{':status'}, 200,
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1795 'request body without content-length many - status');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1796 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST12',
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1797 'request body without content-length many - body');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1798
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1799 # request body without content-length - many DATA frames - limited
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1800
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1801 $sess = new_session();
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1802 $sid = new_stream($sess, { body_more => 1, headers => [
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1803 { name => ':method', value => 'GET', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1804 { name => ':scheme', value => 'http', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1805 { name => ':path', value => '/client_max_body_size', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1806 { name => ':authority', value => 'localhost', mode => 2 }]});
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1807 h2_body($sess, 'TESTTEST123', { body_split => [2] });
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1808 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1809
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1810 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1811 is($frame->{headers}->{':status'}, 413,
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1812 'request body without content-length many - limited');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1813
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1814 # request body without content-length - padding
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1815
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1816 $sess = new_session();
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1817 $sid = new_stream($sess, { body_more => 1, headers => [
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1818 { name => ':method', value => 'GET', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1819 { name => ':scheme', value => 'http', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1820 { name => ':path', value => '/client_max_body_size', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1821 { name => ':authority', value => 'localhost', mode => 2 }]});
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1822 h2_body($sess, 'TESTTEST12', { body_padding => 42 });
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1823 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1824
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1825 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1826 is($frame->{headers}->{':status'}, 200,
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1827 'request body without content-length pad - status');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1828 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST12',
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1829 'request body without content-length pad - body');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1830
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1831 # request body without content-length - padding - limited
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1832
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1833 $sess = new_session();
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1834 $sid = new_stream($sess, { body_more => 1, headers => [
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1835 { name => ':method', value => 'GET', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1836 { name => ':scheme', value => 'http', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1837 { name => ':path', value => '/client_max_body_size', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1838 { name => ':authority', value => 'localhost', mode => 2 }]});
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1839 h2_body($sess, 'TESTTEST123', { body_padding => 42 });
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1840 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1841
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1842 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1843 is($frame->{headers}->{':status'}, 413,
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1844 'request body without content-length pad - limited');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1845
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1846 # request body without content-length - padding with many DATA frames
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1847
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1848 $sess = new_session();
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1849 $sid = new_stream($sess, { body_more => 1, headers => [
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1850 { name => ':method', value => 'GET', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1851 { name => ':scheme', value => 'http', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1852 { name => ':path', value => '/client_max_body_size', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1853 { name => ':authority', value => 'localhost', mode => 2 }]});
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1854 h2_body($sess, 'TESTTEST', { body_padding => 42, body_split => [2] });
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1855 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1856
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1857 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1858 is($frame->{headers}->{':status'}, 200,
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1859 'request body without content-length many pad - status');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1860 is(read_body_file($frame->{headers}->{'x-body-file'}), 'TESTTEST',
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1861 'request body without content-length many pad - body');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1862
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1863 # request body without content-length - padding with many DATA frames - limited
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1864
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1865 $sess = new_session();
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1866 $sid = new_stream($sess, { body_more => 1, headers => [
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1867 { name => ':method', value => 'GET', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1868 { name => ':scheme', value => 'http', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1869 { name => ':path', value => '/client_max_body_size', mode => 2 },
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1870 { name => ':authority', value => 'localhost', mode => 2 }]});
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
1871 h2_body($sess, 'TESTTEST123', { body_padding => 42, body_split => [2] });
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1872 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1873
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1874 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1875 is($frame->{headers}->{':status'}, 413,
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1876 'request body without content-length many pad - limited');
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
1877
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1878 # initial window size, client side
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1879
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1880 # 6.9.2. Initial Flow-Control Window Size
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1881 # When an HTTP/2 connection is first established, new streams are
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1882 # created with an initial flow-control window size of 65,535 octets.
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1883 # The connection flow-control window is also 65,535 octets.
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1884
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1885 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1886 $sid = new_stream($sess, { path => '/t1.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1887 $frames = h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1888
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1889 # with the default http2_chunk_size, data is divided into 8 data frames
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1890
651
9f66f0029dca Tests: HTTP/2 tests for http2_chunk_size directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 650
diff changeset
1891 @data = grep { $_->{type} eq "DATA" } @$frames;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1892 my $lengths = join ' ', map { $_->{length} } @data;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1893 is($lengths, '8192 8192 8192 8192 8192 8192 8192 8191',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1894 'iws - stream blocked on initial window size');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1895
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1896 h2_ping($sess, 'SEE-THIS');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1897 $frames = h2_read($sess, all => [{ type => 'PING' }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1898
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1899 ($frame) = grep { $_->{type} eq "PING" && $_->{flags} & 0x1 } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1900 ok($frame, 'iws - PING not blocked');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1901
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1902 h2_window($sess, 2**16, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1903 $frames = h2_read($sess);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1904 is(@$frames, 0, 'iws - updated stream window');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1905
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1906 h2_window($sess, 2**16);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1907 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1908
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1909 @data = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1910 my $sum = eval join '+', map { $_->{length} } @data;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1911 is($sum, 81, 'iws - updated connection window');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1912
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1913 # SETTINGS (initial window size, client side)
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1914
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1915 # 6.9.2. Initial Flow-Control Window Size
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1916 # Both endpoints can adjust the initial window size for new streams by
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1917 # including a value for SETTINGS_INITIAL_WINDOW_SIZE in the SETTINGS
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1918 # frame that forms part of the connection preface. The connection
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1919 # flow-control window can only be changed using WINDOW_UPDATE frames.
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1920
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1921 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1922 h2_settings($sess, 0, 0x4 => 2**17);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1923 h2_window($sess, 2**17);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1924
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1925 $sid = new_stream($sess, { path => '/t1.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1926 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1927
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1928 @data = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1929 $sum = eval join '+', map { $_->{length} } @data;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1930 is($sum, 2**16 + 80, 'iws - increased');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1931
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1932 # probe for negative available space in a flow control window
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1933
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1934 # 6.9.2. Initial Flow-Control Window Size
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1935 # A change to SETTINGS_INITIAL_WINDOW_SIZE can cause the available
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1936 # space in a flow-control window to become negative. A sender MUST
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1937 # track the negative flow-control window and MUST NOT send new flow-
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1938 # controlled frames until it receives WINDOW_UPDATE frames that cause
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1939 # the flow-control window to become positive.
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1940
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1941 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1942 $sid = new_stream($sess, { path => '/t1.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1943 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1944
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1945 h2_window($sess, 1);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1946 h2_settings($sess, 0, 0x4 => 42);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1947 h2_window($sess, 1024, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1948
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1949 $frames = h2_read($sess, all => [{ type => 'SETTINGS' }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1950
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1951 ($frame) = grep { $_->{type} eq 'SETTINGS' } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1952 ok($frame, 'negative window - SETTINGS frame ack');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1953 is($frame->{flags}, 1, 'negative window - SETTINGS flags ack');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1954
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1955 ($frame) = grep { $_->{type} ne 'SETTINGS' } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1956 is($frame, undef, 'negative window - no data');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1957
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1958 # predefined window size, minus new iws settings, minus window update
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1959
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1960 h2_window($sess, 2**16 - 1 - 42 - 1024, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1961
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1962 $frames = h2_read($sess);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1963 is(@$frames, 0, 'zero window - no data');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1964
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1965 h2_window($sess, 1, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1966
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1967 $frames = h2_read($sess, all => [{ sid => $sid, length => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1968 is(@$frames, 1, 'positive window');
712
649af6069976 Tests: skipped some HTTP/2 tests is case of a failed connection.
Sergey Kandaurov <pluknet@nginx.com>
parents: 707
diff changeset
1969
649af6069976 Tests: skipped some HTTP/2 tests is case of a failed connection.
Sergey Kandaurov <pluknet@nginx.com>
parents: 707
diff changeset
1970 SKIP: {
649af6069976 Tests: skipped some HTTP/2 tests is case of a failed connection.
Sergey Kandaurov <pluknet@nginx.com>
parents: 707
diff changeset
1971 skip 'failed connection', 2 unless @$frames;
649af6069976 Tests: skipped some HTTP/2 tests is case of a failed connection.
Sergey Kandaurov <pluknet@nginx.com>
parents: 707
diff changeset
1972
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1973 is(@$frames[0]->{type}, 'DATA', 'positive window - data');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1974 is(@$frames[0]->{length}, 1, 'positive window - data length');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1975
712
649af6069976 Tests: skipped some HTTP/2 tests is case of a failed connection.
Sergey Kandaurov <pluknet@nginx.com>
parents: 707
diff changeset
1976 }
649af6069976 Tests: skipped some HTTP/2 tests is case of a failed connection.
Sergey Kandaurov <pluknet@nginx.com>
parents: 707
diff changeset
1977
704
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1978 # ask write handler in sending large response
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1979
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1980 $sid = new_stream($sess, { path => '/tbig.html' });
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1981
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1982 h2_window($sess, 2**30, $sid);
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1983 h2_window($sess, 2**30);
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1984
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1985 sleep 1;
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1986 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1987
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1988 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1989 is($frame->{headers}->{':status'}, 200, 'large response - HEADERS');
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1990
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1991 @data = grep { $_->{type} eq "DATA" } @$frames;
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1992 $sum = eval join '+', map { $_->{length} } @data;
723
bc4d6e2bd031 Tests: adjusted HTTP/2 test to trigger write handler in v2 module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 722
diff changeset
1993 is($sum, 5000000, 'large response - DATA');
704
626bc3a0fdaa Tests: SPDY and HTTP/2 write handler tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 702
diff changeset
1994
794
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
1995 # Make sure http2 write handler doesn't break a connection.
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
1996 # Some buggy systems tolerate ill-use of writev() triggered by write handler,
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
1997 # while others, such as darwin and NetBSD, follow POSIX strictly, which causes
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
1998 # a connection to close in nginx. While this also breaks the 'no alerts' test,
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
1999 # it doesn't suit well, because error.log is currently polluted with much more
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2000 # alerts due to other various bugs in ngx_http_v2_module. We catch it here in
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2001 # a separate test as well to make it clear.
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2002
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2003 SKIP: {
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2004 skip 'tolerant operating system', 1 unless $^O eq 'darwin' or $^O eq 'netbsd';
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2005
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2006 TODO: {
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2007 local $TODO = 'not yet';
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2008
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2009 $sid = new_stream($sess);
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2010 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2011
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2012 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2013 is($frame->{headers}->{':status'}, 200, 'new stream after large response');
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2014
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2015 }
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2016
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2017 }
fed83003c45c Tests: one more HTTP/2 write handler test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 789
diff changeset
2018
763
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
2019 # write event send timeout
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
2020
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
2021 $sess = new_session(8091);
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
2022 $sid = new_stream($sess, { path => '/tbig.html' });
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
2023 h2_window($sess, 2**30, $sid);
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
2024 h2_window($sess, 2**30);
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
2025
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
2026 select undef, undef, undef, 2.1;
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
2027
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
2028 h2_ping($sess, 'SEE-THIS');
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
2029
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
2030 $frames = h2_read($sess, all => [{ type => 'PING' }]);
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
2031 ok(!grep ({ $_->{type} eq "PING" } @$frames), 'large response - send timeout');
2ba4058848d6 Tests: HTTP/2 test for write event timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents: 762
diff changeset
2032
740
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2033 # stream with large response queued on write - RST_STREAM handling
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2034
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2035 $sess = new_session();
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2036 $sid = new_stream($sess, { path => '/tbig.html' });
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2037
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2038 h2_window($sess, 2**30, $sid);
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2039 h2_window($sess, 2**30);
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2040
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2041 select undef, undef, undef, 0.4;
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2042
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2043 h2_rst($sess, $sid, 8);
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2044 h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2045
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2046 $sid = new_stream($sess);
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2047 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2048
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2049 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2050 is($frame->{sid}, 3, 'large response - queued with RST_STREAM');
3e2676108d69 Tests: added HTTP/2 test for queued stream cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 739
diff changeset
2051
680
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2052 # SETTINGS_MAX_FRAME_SIZE
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2053
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2054 $sess = new_session();
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2055 $sid = new_stream($sess, { path => '/frame_size' });
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2056 h2_window($sess, 2**18, 1);
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2057 h2_window($sess, 2**18);
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2058
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2059 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2060 @data = grep { $_->{type} eq "DATA" } @$frames;
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2061 is($data[0]->{length}, 2**14, 'max frame size - default');
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2062
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2063 $sess = new_session();
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2064 h2_settings($sess, 0, 0x5 => 2**15);
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2065 $sid = new_stream($sess, { path => '/frame_size' });
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2066 h2_window($sess, 2**18, 1);
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2067 h2_window($sess, 2**18);
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2068
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2069 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2070 @data = grep { $_->{type} eq "DATA" } @$frames;
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2071 is($data[0]->{length}, 2**15, 'max frame size - custom');
85e368105c8b Tests: added HTTP/2 tests for SETTINGS_MAX_FRAME_SIZE.
Sergey Kandaurov <pluknet@nginx.com>
parents: 679
diff changeset
2072
696
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2073 # CONTINUATION in response
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2074 # put three long header fields (not less than SETTINGS_MAX_FRAME_SIZE/2)
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2075 # to break header block into separate frames, one such field per frame
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2076
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2077 $sess = new_session();
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2078 $sid = new_stream($sess, { path => '/continuation?h=' . 'x' x 2**13 });
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2079
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2080 $frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]);
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2081 @data = grep { $_->{type} =~ "HEADERS|CONTINUATION" } @$frames;
718
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2082 is(@{$data[-1]->{headers}{'x-longheader'}}, 3,
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2083 'response CONTINUATION - headers');
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2084 is($data[-1]->{headers}{'x-longheader'}[0], 'x' x 2**13,
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2085 'response CONTINUATION - header 1');
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2086 is($data[-1]->{headers}{'x-longheader'}[1], 'x' x 2**13,
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2087 'response CONTINUATION - header 2');
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2088 is($data[-1]->{headers}{'x-longheader'}[2], 'x' x 2**13,
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2089 'response CONTINUATION - header 3');
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2090 @data = sort { $a <=> $b } map { $_->{length} } @data;
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2091 cmp_ok($data[-1], '<=', 2**14, 'response CONTINUATION - max frame size');
696
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2092
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2093 # same but without response DATA frames
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2094
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2095 $sess = new_session();
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2096 $sid = new_stream($sess, { path => '/continuation/204?h=' . 'x' x 2**13 });
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2097
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2098 $frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]);
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2099 @data = grep { $_->{type} =~ "HEADERS|CONTINUATION" } @$frames;
718
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2100 is(@{$data[-1]->{headers}{'x-longheader'}}, 3,
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2101 'no body CONTINUATION - headers');
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2102 is($data[-1]->{headers}{'x-longheader'}[0], 'x' x 2**13,
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2103 'no body CONTINUATION - header 1');
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2104 is($data[-1]->{headers}{'x-longheader'}[1], 'x' x 2**13,
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2105 'no body CONTINUATION - header 2');
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2106 is($data[-1]->{headers}{'x-longheader'}[2], 'x' x 2**13,
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2107 'no body CONTINUATION - header 3');
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2108 @data = sort { $a <=> $b } map { $_->{length} } @data;
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
2109 cmp_ok($data[-1], '<=', 2**14, 'no body CONTINUATION - max frame size');
696
beab9da9b731 Tests: added HTTP/2 tests for CONTINUATION frame in response.
Sergey Kandaurov <pluknet@nginx.com>
parents: 694
diff changeset
2110
698
f86c8314d205 Tests: one more HTTP/2 test for max frame size.
Sergey Kandaurov <pluknet@nginx.com>
parents: 697
diff changeset
2111 # response header block is always split by SETTINGS_MAX_FRAME_SIZE
f86c8314d205 Tests: one more HTTP/2 test for max frame size.
Sergey Kandaurov <pluknet@nginx.com>
parents: 697
diff changeset
2112
f86c8314d205 Tests: one more HTTP/2 test for max frame size.
Sergey Kandaurov <pluknet@nginx.com>
parents: 697
diff changeset
2113 $sess = new_session();
719
91bedf9d60a7 Tests: adjusted field length in HTTP/2 test for max frame size.
Sergey Kandaurov <pluknet@nginx.com>
parents: 718
diff changeset
2114 $sid = new_stream($sess, { path => '/continuation?h=' . 'x' x 2**15 });
698
f86c8314d205 Tests: one more HTTP/2 test for max frame size.
Sergey Kandaurov <pluknet@nginx.com>
parents: 697
diff changeset
2115
f86c8314d205 Tests: one more HTTP/2 test for max frame size.
Sergey Kandaurov <pluknet@nginx.com>
parents: 697
diff changeset
2116 $frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]);
f86c8314d205 Tests: one more HTTP/2 test for max frame size.
Sergey Kandaurov <pluknet@nginx.com>
parents: 697
diff changeset
2117 @data = grep { $_->{type} =~ "HEADERS|CONTINUATION" } @$frames;
f86c8314d205 Tests: one more HTTP/2 test for max frame size.
Sergey Kandaurov <pluknet@nginx.com>
parents: 697
diff changeset
2118 @data = sort { $a <=> $b } map { $_->{length} } @data;
f86c8314d205 Tests: one more HTTP/2 test for max frame size.
Sergey Kandaurov <pluknet@nginx.com>
parents: 697
diff changeset
2119 cmp_ok($data[-1], '<=', 2**14, 'response header frames limited');
f86c8314d205 Tests: one more HTTP/2 test for max frame size.
Sergey Kandaurov <pluknet@nginx.com>
parents: 697
diff changeset
2120
784
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2121 # response header frame sent in parts
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2122
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2123 TODO: {
785
91e23e0c923a Tests: h2.t TODOs adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents: 784
diff changeset
2124 local $TODO = 'not yet' unless $t->has_version('1.9.7');
784
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2125
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2126 $sess = new_session(8092);
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2127 h2_settings($sess, 0, 0x5 => 2**17);
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2128
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2129 $sid = new_stream($sess, { path => '/frame_size?h=' . 'x' x 2**15 });
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2130 $frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]);
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2131
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2132 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2133 ok($frame, 'response header - parts');
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2134
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2135 SKIP: {
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2136 skip 'response header failed', 1 unless $frame;
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2137
831
c384a2e53c1b Tests: respect HTTP/2 header compression, related improvements.
Sergey Kandaurov <pluknet@nginx.com>
parents: 830
diff changeset
2138 is(length join('', @{$frame->{headers}->{'x-longheader'}}), 98304,
784
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2139 'response header - headers');
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2140
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2141 }
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2142
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2143 # response header block split and sent in parts
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2144
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2145 $sess = new_session(8092);
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2146 $sid = new_stream($sess, { path => '/continuation?h=' . 'x' x 2**15 });
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2147 $frames = h2_read($sess, all => [{ sid => $sid, fin => 0x4 }]);
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2148
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2149 @data = grep { $_->{type} =~ "HEADERS|CONTINUATION" } @$frames;
831
c384a2e53c1b Tests: respect HTTP/2 header compression, related improvements.
Sergey Kandaurov <pluknet@nginx.com>
parents: 830
diff changeset
2150 ($lengths) = sort { $b <=> $a } map { $_->{length} } @data;
c384a2e53c1b Tests: respect HTTP/2 header compression, related improvements.
Sergey Kandaurov <pluknet@nginx.com>
parents: 830
diff changeset
2151 cmp_ok($lengths, '<=', 16384, 'response header split - max size');
c384a2e53c1b Tests: respect HTTP/2 header compression, related improvements.
Sergey Kandaurov <pluknet@nginx.com>
parents: 830
diff changeset
2152
c384a2e53c1b Tests: respect HTTP/2 header compression, related improvements.
Sergey Kandaurov <pluknet@nginx.com>
parents: 830
diff changeset
2153 is(length join('', @{@$frames[-1]->{headers}->{'x-longheader'}}), 98304,
c384a2e53c1b Tests: respect HTTP/2 header compression, related improvements.
Sergey Kandaurov <pluknet@nginx.com>
parents: 830
diff changeset
2154 'response header split - headers');
784
d51f7d5d8b4c Tests: added HTTP/2 tests for response header sent in parts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 783
diff changeset
2155
818
685fc620d721 Tests: skip test broken by header compression in h2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 813
diff changeset
2156 }
685fc620d721 Tests: skip test broken by header compression in h2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 813
diff changeset
2157
769
97442d620e3e Tests: removed h2.t TODOs for now changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 768
diff changeset
2158 # max_field_size - header field name
766
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2159
684
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2160 $sess = new_session(8087);
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2161 $sid = new_stream($sess, { headers => [
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2162 { name => ':method', value => 'GET', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2163 { name => ':scheme', value => 'http', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2164 { name => ':path', value => '/t2.html', mode => 1 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2165 { name => ':authority', value => 'localhost', mode => 1 },
766
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2166 { name => 'longname10' x 2 . 'x', value => 'value', mode => 2 }]});
684
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2167 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2168
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2169 ($frame) = grep { $_->{type} eq 'DATA' } @$frames;
766
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2170 ok($frame, 'field name size less');
684
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2171
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2172 $sid = new_stream($sess, { headers => [
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2173 { name => ':method', value => 'GET', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2174 { name => ':scheme', value => 'http', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2175 { name => ':path', value => '/t2.html', mode => 1 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2176 { name => ':authority', value => 'localhost', mode => 1 },
766
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2177 { name => 'longname10' x 2 . 'x', value => 'value', mode => 2 }]});
684
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2178 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2179
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2180 ($frame) = grep { $_->{type} eq 'DATA' } @$frames;
766
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2181 ok($frame, 'field name size second');
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2182
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2183 $sess = new_session(8087);
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2184 $sid = new_stream($sess, { headers => [
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2185 { name => ':method', value => 'GET', mode => 0 },
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2186 { name => ':scheme', value => 'http', mode => 0 },
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2187 { name => ':path', value => '/t2.html', mode => 1 },
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2188 { name => ':authority', value => 'localhost', mode => 1 },
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2189 { name => 'longname10' x 2 . 'xx', value => 'value', mode => 2 }]});
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2190 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2191
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2192 ($frame) = grep { $_->{type} eq 'DATA' } @$frames;
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2193 ok($frame, 'field name size equal');
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2194
684
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2195 $sess = new_session(8087);
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2196 $sid = new_stream($sess, { headers => [
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2197 { name => ':method', value => 'GET', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2198 { name => ':scheme', value => 'http', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2199 { name => ':path', value => '/t2.html', mode => 1 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2200 { name => ':authority', value => 'localhost', mode => 1 },
766
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2201 { name => 'longname10' x 2 . 'xxx', value => 'value', mode => 2 }]});
684
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2202 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2203
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2204 ($frame) = grep { $_->{type} eq 'DATA' } @$frames;
766
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2205 is($frame, undef, 'field name size greater');
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2206
769
97442d620e3e Tests: removed h2.t TODOs for now changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 768
diff changeset
2207 # max_field_size - header field value
684
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2208
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2209 $sess = new_session(8087);
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2210 $sid = new_stream($sess, { headers => [
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2211 { name => ':method', value => 'GET', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2212 { name => ':scheme', value => 'http', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2213 { name => ':path', value => '/t2.html', mode => 1 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2214 { name => ':authority', value => 'localhost', mode => 1 },
766
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2215 { name => 'name', value => 'valu5' x 4 . 'x', mode => 2 }]});
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2216 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2217
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2218 ($frame) = grep { $_->{type} eq 'DATA' } @$frames;
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2219 ok($frame, 'field value size less');
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2220
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2221 $sess = new_session(8087);
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2222 $sid = new_stream($sess, { headers => [
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2223 { name => ':method', value => 'GET', mode => 0 },
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2224 { name => ':scheme', value => 'http', mode => 0 },
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2225 { name => ':path', value => '/t2.html', mode => 1 },
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2226 { name => ':authority', value => 'localhost', mode => 1 },
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2227 { name => 'name', value => 'valu5' x 4 . 'xx', mode => 2 }]});
684
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2228 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2229
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2230 ($frame) = grep { $_->{type} eq 'DATA' } @$frames;
766
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2231 ok($frame, 'field value size equal');
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2232
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2233 $sess = new_session(8087);
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2234 $sid = new_stream($sess, { headers => [
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2235 { name => ':method', value => 'GET', mode => 0 },
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2236 { name => ':scheme', value => 'http', mode => 0 },
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2237 { name => ':path', value => '/t2.html', mode => 1 },
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2238 { name => ':authority', value => 'localhost', mode => 1 },
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2239 { name => 'name', value => 'valu5' x 4 . 'xxx', mode => 2 }]});
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2240 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2241
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2242 ($frame) = grep { $_->{type} eq 'DATA' } @$frames;
a764054d457f Tests: adopt h2.t to the changed max_field_size behaviour.
Sergey Kandaurov <pluknet@nginx.com>
parents: 765
diff changeset
2243 is($frame, undef, 'field value size greater');
684
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2244
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2245 # max_header_size
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2246
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2247 $sess = new_session(8088);
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2248 $sid = new_stream($sess, { headers => [
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2249 { name => ':method', value => 'GET', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2250 { name => ':scheme', value => 'http', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2251 { name => ':path', value => '/t2.html', mode => 1 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2252 { name => ':authority', value => 'localhost', mode => 1 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2253 { name => 'longname9', value => 'x', mode => 2 }]});
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2254 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2255
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2256 ($frame) = grep { $_->{type} eq 'DATA' } @$frames;
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2257 ok($frame, 'header size less');
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2258
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2259 $sid = new_stream($sess, { headers => [
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2260 { name => ':method', value => 'GET', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2261 { name => ':scheme', value => 'http', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2262 { name => ':path', value => '/t2.html', mode => 1 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2263 { name => ':authority', value => 'localhost', mode => 1 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2264 { name => 'longname9', value => 'x', mode => 2 }]});
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2265 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2266
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2267 ($frame) = grep { $_->{type} eq 'DATA' } @$frames;
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2268 ok($frame, 'header size second');
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2269
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2270 $sess = new_session(8088);
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2271 $sid = new_stream($sess, { headers => [
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2272 { name => ':method', value => 'GET', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2273 { name => ':scheme', value => 'http', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2274 { name => ':path', value => '/t2.html', mode => 1 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2275 { name => ':authority', value => 'localhost', mode => 1 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2276 { name => 'longname9', value => 'xx', mode => 2 }]});
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2277 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2278
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2279 ($frame) = grep { $_->{type} eq 'DATA' } @$frames;
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2280 ok($frame, 'header size equal');
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2281
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2282 $sess = new_session(8088);
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2283 $sid = new_stream($sess, { headers => [
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2284 { name => ':method', value => 'GET', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2285 { name => ':scheme', value => 'http', mode => 0 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2286 { name => ':path', value => '/t2.html', mode => 1 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2287 { name => ':authority', value => 'localhost', mode => 1 },
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2288 { name => 'longname9', value => 'xxx', mode => 2 }]});
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2289 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2290
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2291 ($frame) = grep { $_->{type} eq 'DATA' } @$frames;
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2292 is($frame, undef, 'header size greater');
96666f621dbc Tests: added http2_max_field_size and http2_max_header_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 680
diff changeset
2293
722
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2294 # header size is based on (decompressed) header list
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2295 # two extra 1-byte indices would otherwise fit in max_header_size
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2296
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2297 $sess = new_session(8088);
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2298 $sid = new_stream($sess, { headers => [
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2299 { name => ':method', value => 'GET', mode => 0 },
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2300 { name => ':scheme', value => 'http', mode => 0 },
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2301 { name => ':path', value => '/t2.html', mode => 1 },
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2302 { name => ':authority', value => 'localhost', mode => 1 },
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2303 { name => 'longname9', value => 'x', mode => 2 }]});
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2304 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2305
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2306 ($frame) = grep { $_->{type} eq 'DATA' } @$frames;
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2307 ok($frame, 'header size new index');
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2308
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2309 $sid = new_stream($sess, { headers => [
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2310 { name => ':method', value => 'GET', mode => 0 },
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2311 { name => ':scheme', value => 'http', mode => 0 },
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2312 { name => ':path', value => '/t2.html', mode => 1 },
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2313 { name => ':authority', value => 'localhost', mode => 1 },
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2314 { name => 'longname9', value => 'x', mode => 0 }]});
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2315 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2316
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2317 ($frame) = grep { $_->{type} eq 'DATA' } @$frames;
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2318 ok($frame, 'header size indexed');
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2319
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2320 $sid = new_stream($sess, { headers => [
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2321 { name => ':method', value => 'GET', mode => 0 },
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2322 { name => ':scheme', value => 'http', mode => 0 },
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2323 { name => ':path', value => '/t2.html', mode => 1 },
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2324 { name => ':authority', value => 'localhost', mode => 1 },
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2325 { name => 'longname9', value => 'x', mode => 0 },
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2326 { name => 'longname9', value => 'x', mode => 0 }]});
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2327 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2328
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2329 ($frame) = grep { $_->{type} eq 'GOAWAY' } @$frames;
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2330 is($frame->{code}, 0xb, 'header size indexed greater');
e09a6cda6764 Tests: added HTTP/2 max_header_size tests for indexed header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 721
diff changeset
2331
736
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2332 # HPACK table boundary
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2333
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2334 $sess = new_session();
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2335 h2_read($sess, all => [{ sid => new_stream($sess, { headers => [
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2336 { name => ':method', value => 'GET', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2337 { name => ':scheme', value => 'http', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2338 { name => ':path', value => '/', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2339 { name => ':authority', value => '', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2340 { name => 'x' x 2016, value => 'x' x 2048, mode => 2 }]}), fin => 1 }]);
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2341 $frames = h2_read($sess, all => [{ sid => new_stream($sess, { headers => [
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2342 { name => ':method', value => 'GET', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2343 { name => ':scheme', value => 'http', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2344 { name => ':path', value => '/', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2345 { name => ':authority', value => '', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2346 { name => 'x' x 2016, value => 'x' x 2048, mode => 0 }]}), fin => 1 }]);
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2347
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2348 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2349 ok($frame, 'HPACK table boundary');
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2350
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2351 h2_read($sess, all => [{ sid => new_stream($sess, { headers => [
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2352 { name => ':method', value => 'GET', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2353 { name => ':scheme', value => 'http', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2354 { name => ':path', value => '/', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2355 { name => ':authority', value => '', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2356 { name => 'x' x 33, value => 'x' x 4031, mode => 2 }]}), fin => 1 }]);
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2357 $frames = h2_read($sess, all => [{ sid => new_stream($sess, { headers => [
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2358 { name => ':method', value => 'GET', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2359 { name => ':scheme', value => 'http', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2360 { name => ':path', value => '/', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2361 { name => ':authority', value => '', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2362 { name => 'x' x 33, value => 'x' x 4031, mode => 0 }]}), fin => 1 }]);
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2363
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2364 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2365 ok($frame, 'HPACK table boundary - header field name');
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2366
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2367 h2_read($sess, all => [{ sid => new_stream($sess, { headers => [
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2368 { name => ':method', value => 'GET', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2369 { name => ':scheme', value => 'http', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2370 { name => ':path', value => '/', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2371 { name => ':authority', value => '', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2372 { name => 'x', value => 'x' x 64, mode => 2 }]}), fin => 1 }]);
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2373 $frames = h2_read($sess, all => [{ sid => new_stream($sess, { headers => [
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2374 { name => ':method', value => 'GET', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2375 { name => ':scheme', value => 'http', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2376 { name => ':path', value => '/', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2377 { name => ':authority', value => '', mode => 0 },
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2378 { name => 'x', value => 'x' x 64, mode => 0 }]}), fin => 1 }]);
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2379
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2380 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2381 ok($frame, 'HPACK table boundary - header field value');
dcbe4c3d6871 Tests: added HTTP/2 tests for HPACK table boundary.
Sergey Kandaurov <pluknet@nginx.com>
parents: 735
diff changeset
2382
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2383 # stream multiplexing + WINDOW_UPDATE
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2384
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2385 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2386 $sid = new_stream($sess, { path => '/t1.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2387 $frames = h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2388
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2389 @data = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2390 $sum = eval join '+', map { $_->{length} } @data;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2391 is($sum, 2**16 - 1, 'multiple - stream1 data');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2392
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2393 my $sid2 = new_stream($sess, { path => '/t1.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2394 $frames = h2_read($sess, all => [{ sid => $sid2, fin => 0x4 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2395
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2396 @data = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2397 is(@data, 0, 'multiple - stream2 no data');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2398
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2399 h2_window($sess, 2**17, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2400 h2_window($sess, 2**17, $sid2);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2401 h2_window($sess, 2**17);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2402
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2403 $frames = h2_read($sess, all => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2404 { sid => $sid, fin => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2405 { sid => $sid2, fin => 1 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2406 ]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2407
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2408 @data = grep { $_->{type} eq "DATA" && $_->{sid} == $sid } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2409 $sum = eval join '+', map { $_->{length} } @data;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2410 is($sum, 81, 'multiple - stream1 remain data');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2411
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2412 @data = grep { $_->{type} eq "DATA" && $_->{sid} == $sid2 } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2413 $sum = eval join '+', map { $_->{length} } @data;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2414 is($sum, 2**16 + 80, 'multiple - stream2 full data');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2415
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2416 # stream muliplexing + PRIORITY frames
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2417
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2418 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2419 $sid = new_stream($sess, { path => '/t1.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2420 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2421
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2422 $sid2 = new_stream($sess, { path => '/t2.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2423 h2_read($sess, all => [{ sid => $sid2, fin => 0x4 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2424
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2425 h2_priority($sess, 0, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2426 h2_priority($sess, 255, $sid2);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2427
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2428 h2_window($sess, 2**17, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2429 h2_window($sess, 2**17, $sid2);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2430 h2_window($sess, 2**17);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2431
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2432 $frames = h2_read($sess, all => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2433 { sid => $sid, fin => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2434 { sid => $sid2, fin => 1 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2435 ]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2436
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2437 @data = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2438 is(join(' ', map { $_->{sid} } @data), "$sid2 $sid", 'weight - PRIORITY 1');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2439
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2440 # and vice versa
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2441
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2442 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2443 $sid = new_stream($sess, { path => '/t1.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2444 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2445
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2446 $sid2 = new_stream($sess, { path => '/t2.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2447 h2_read($sess, all => [{ sid => $sid2, fin => 0x4 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2448
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2449 h2_priority($sess, 255, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2450 h2_priority($sess, 0, $sid2);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2451
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2452 h2_window($sess, 2**17, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2453 h2_window($sess, 2**17, $sid2);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2454 h2_window($sess, 2**17);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2455
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2456 $frames = h2_read($sess, all => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2457 { sid => $sid, fin => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2458 { sid => $sid2, fin => 1 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2459 ]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2460
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2461 @data = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2462 is(join(' ', map { $_->{sid} } @data), "$sid $sid2", 'weight - PRIORITY 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2463
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2464 # stream muliplexing + HEADERS PRIORITY flag
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2465
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2466 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2467 $sid = new_stream($sess, { path => '/t1.html', prio => 0 });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2468 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2469
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2470 $sid2 = new_stream($sess, { path => '/t2.html', prio => 255 });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2471 h2_read($sess, all => [{ sid => $sid2, fin => 0x4 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2472
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2473 h2_window($sess, 2**17, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2474 h2_window($sess, 2**17, $sid2);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2475 h2_window($sess, 2**17);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2476
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2477 $frames = h2_read($sess, all => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2478 { sid => $sid, fin => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2479 { sid => $sid2, fin => 1 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2480 ]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2481
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2482 @data = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2483 my $sids = join ' ', map { $_->{sid} } @data;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2484 is($sids, "$sid2 $sid", 'weight - HEADERS PRIORITY 1');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2485
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2486 # and vice versa
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2487
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2488 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2489 $sid = new_stream($sess, { path => '/t1.html', prio => 255 });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2490 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2491
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2492 $sid2 = new_stream($sess, { path => '/t2.html', prio => 0 });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2493 h2_read($sess, all => [{ sid => $sid2, fin => 0x4 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2494
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2495 h2_window($sess, 2**17, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2496 h2_window($sess, 2**17, $sid2);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2497 h2_window($sess, 2**17);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2498
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2499 $frames = h2_read($sess, all => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2500 { sid => $sid, fin => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2501 { sid => $sid2, fin => 1 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2502 ]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2503
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2504 @data = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2505 $sids = join ' ', map { $_->{sid} } @data;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2506 is($sids, "$sid $sid2", 'weight - HEADERS PRIORITY 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2507
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2508 # 5.3.1. Stream Dependencies
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2509
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2510 # PRIORITY frame
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2511
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2512 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2513
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2514 h2_priority($sess, 16, 3, 0);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2515 h2_priority($sess, 16, 1, 3);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2516
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2517 $sid = new_stream($sess, { path => '/t1.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2518 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2519
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2520 $sid2 = new_stream($sess, { path => '/t2.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2521 h2_read($sess, all => [{ sid => $sid2, fin => 0x4 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2522
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2523 h2_window($sess, 2**17, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2524 h2_window($sess, 2**17, $sid2);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2525 h2_window($sess, 2**17);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2526
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2527 $frames = h2_read($sess, all => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2528 { sid => $sid, fin => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2529 { sid => $sid2, fin => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2530 ]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2531
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2532 @data = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2533 $sids = join ' ', map { $_->{sid} } @data;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2534 is($sids, "$sid2 $sid", 'dependency - PRIORITY 1');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2535
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2536 # and vice versa
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2537
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2538 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2539
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2540 h2_priority($sess, 16, 1, 0);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2541 h2_priority($sess, 16, 3, 1);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2542
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2543 $sid = new_stream($sess, { path => '/t1.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2544 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2545
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2546 $sid2 = new_stream($sess, { path => '/t2.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2547 h2_read($sess, all => [{ sid => $sid2, fin => 0x4 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2548
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2549 h2_window($sess, 2**17, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2550 h2_window($sess, 2**17, $sid2);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2551 h2_window($sess, 2**17);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2552
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2553 $frames = h2_read($sess, all => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2554 { sid => $sid, fin => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2555 { sid => $sid2, fin => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2556 ]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2557
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2558 @data = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2559 $sids = join ' ', map { $_->{sid} } @data;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2560 is($sids, "$sid $sid2", 'dependency - PRIORITY 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2561
756
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2562 # PRIORITY - self dependency
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2563
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2564 # 5.3.1. Stream Dependencies
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2565 # A stream cannot depend on itself. An endpoint MUST treat this as a
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2566 # stream error of type PROTOCOL_ERROR.
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2567
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2568 $sess = new_session();
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2569 $sid = new_stream($sess);
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2570 h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2571
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2572 h2_priority($sess, 0, $sid, $sid);
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2573 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]);
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2574
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2575 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames;
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2576 is($frame->{sid}, $sid, 'dependency - PRIORITY self - RST_STREAM');
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2577 is($frame->{code}, 1, 'dependency - PRIORITY self - PROTOCOL_ERROR');
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2578
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2579 # HEADERS PRIORITY flag, reprioritize prior PRIORITY frame records
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2580
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2581 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2582
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2583 h2_priority($sess, 16, 1, 0);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2584 h2_priority($sess, 16, 3, 0);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2585
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2586 $sid = new_stream($sess, { path => '/t1.html', dep => 3 });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2587 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2588
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2589 $sid2 = new_stream($sess, { path => '/t2.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2590 h2_read($sess, all => [{ sid => $sid2, fin => 0x4 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2591
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2592 h2_window($sess, 2**17, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2593 h2_window($sess, 2**17, $sid2);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2594 h2_window($sess, 2**17);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2595
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2596 $frames = h2_read($sess, all => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2597 { sid => $sid, fin => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2598 { sid => $sid2, fin => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2599 ]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2600
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2601 @data = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2602 $sids = join ' ', map { $_->{sid} } @data;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2603 is($sids, "$sid2 $sid", 'dependency - HEADERS PRIORITY 1');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2604
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2605 # and vice versa
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2606
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2607 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2608
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2609 h2_priority($sess, 16, 1, 0);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2610 h2_priority($sess, 16, 3, 0);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2611
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2612 $sid = new_stream($sess, { path => '/t1.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2613 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2614
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2615 $sid2 = new_stream($sess, { path => '/t2.html', dep => 1 });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2616 h2_read($sess, all => [{ sid => $sid2, fin => 0x4 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2617
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2618 h2_window($sess, 2**17, $sid);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2619 h2_window($sess, 2**17, $sid2);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2620 h2_window($sess, 2**17);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2621
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2622 $frames = h2_read($sess, all => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2623 { sid => $sid, fin => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2624 { sid => $sid2, fin => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2625 ]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2626
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2627 @data = grep { $_->{type} eq "DATA" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2628 $sids = join ' ', map { $_->{sid} } @data;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2629 is($sids, "$sid $sid2", 'dependency - HEADERS PRIORITY 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2630
756
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2631 # HEADERS - self dependency
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2632
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2633 $sess = new_session();
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2634 $sid = new_stream($sess, { dep => 1 });
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2635 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]);
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2636
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2637 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames;
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2638 is($frame->{sid}, $sid, 'dependency - HEADERS self - RST_STREAM');
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2639 is($frame->{code}, 1, 'dependency - HEADERS self - PROTOCOL_ERROR');
bb4486e173ab Tests: HTTP/2 tests for streams depending on itself.
Sergey Kandaurov <pluknet@nginx.com>
parents: 755
diff changeset
2640
662
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2641 # PRIORITY frame, weighted dependencies
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2642
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2643 $sess = new_session();
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2644
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2645 h2_priority($sess, 16, 5, 0);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2646 h2_priority($sess, 255, 1, 5);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2647 h2_priority($sess, 0, 3, 5);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2648
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2649 $sid = new_stream($sess, { path => '/t1.html' });
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2650 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2651
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2652 $sid2 = new_stream($sess, { path => '/t2.html' });
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2653 h2_read($sess, all => [{ sid => $sid2, fin => 0x4 }]);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2654
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2655 my $sid3 = new_stream($sess, { path => '/t2.html' });
779
ca2db52ae97f Tests: fix and speed up h2.t tests by waiting for proper data.
Sergey Kandaurov <pluknet@nginx.com>
parents: 776
diff changeset
2656 h2_read($sess, all => [{ sid => $sid3, fin => 0x4 }]);
662
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2657
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2658 h2_window($sess, 2**16, 1);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2659 h2_window($sess, 2**16, 3);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2660 h2_window($sess, 2**16, 5);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2661 h2_window($sess, 2**16);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2662
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2663 $frames = h2_read($sess, all => [
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2664 { sid => $sid, fin => 1 },
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2665 { sid => $sid2, fin => 1 },
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2666 { sid => $sid3, fin => 1 },
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2667 ]);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2668
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2669 @data = grep { $_->{type} eq "DATA" } @$frames;
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2670 $sids = join ' ', map { $_->{sid} } @data;
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2671 is($sids, "$sid3 $sid $sid2", 'weighted dependency - PRIORITY 1');
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2672
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2673 # and vice versa
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2674
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2675 $sess = new_session();
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2676
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2677 h2_priority($sess, 16, 5, 0);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2678 h2_priority($sess, 0, 1, 5);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2679 h2_priority($sess, 255, 3, 5);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2680
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2681 $sid = new_stream($sess, { path => '/t1.html' });
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2682 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2683
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2684 $sid2 = new_stream($sess, { path => '/t2.html' });
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2685 h2_read($sess, all => [{ sid => $sid2, fin => 0x4 }]);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2686
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2687 $sid3 = new_stream($sess, { path => '/t2.html' });
779
ca2db52ae97f Tests: fix and speed up h2.t tests by waiting for proper data.
Sergey Kandaurov <pluknet@nginx.com>
parents: 776
diff changeset
2688 h2_read($sess, all => [{ sid => $sid3, fin => 0x4 }]);
662
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2689
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2690 h2_window($sess, 2**16, 1);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2691 h2_window($sess, 2**16, 3);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2692 h2_window($sess, 2**16, 5);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2693 h2_window($sess, 2**16);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2694
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2695 $frames = h2_read($sess, all => [
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2696 { sid => $sid, fin => 1 },
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2697 { sid => $sid2, fin => 1 },
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2698 { sid => $sid3, fin => 1 },
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2699 ]);
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2700
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2701 @data = grep { $_->{type} eq "DATA" } @$frames;
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2702 $sids = join ' ', map { $_->{sid} } @data;
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2703 is($sids, "$sid3 $sid2 $sid", 'weighted dependency - PRIORITY 2');
07de3d202eb7 Tests: more HTTP/2 tests for streams priority.
Sergey Kandaurov <pluknet@nginx.com>
parents: 661
diff changeset
2704
757
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2705 # PRIORITY - reprioritization with circular dependency - after [3] removed
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2706 # initial dependency tree:
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2707 # 1 <- [3] <- 5
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2708
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2709 $sess = new_session();
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2710
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2711 h2_window($sess, 2**18);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2712
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2713 h2_priority($sess, 16, 1, 0);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2714 h2_priority($sess, 16, 3, 1);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2715 h2_priority($sess, 16, 5, 3);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2716
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2717 $sid = new_stream($sess, { path => '/t1.html' });
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2718 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2719
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2720 $sid2 = new_stream($sess, { path => '/t1.html' });
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2721 h2_read($sess, all => [{ sid => $sid2, length => 2**16 - 1 }]);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2722
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2723 $sid3 = new_stream($sess, { path => '/t1.html' });
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2724 h2_read($sess, all => [{ sid => $sid3, length => 2**16 - 1 }]);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2725
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2726 h2_window($sess, 2**16, $sid2);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2727
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2728 $frames = h2_read($sess, all => [{ sid => $sid2, fin => 1 }]);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2729 $sids = join ' ', map { $_->{sid} } grep { $_->{type} eq "DATA" } @$frames;
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2730 is($sids, $sid2, 'removed dependency');
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2731
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2732 for (1 .. 40) {
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2733 h2_read($sess, all => [{ sid => new_stream($sess), fin => 1 }]);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2734 }
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2735
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2736 # make circular dependency
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2737 # 1 <- 5 -- current dependency tree before reprioritization
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2738 # 5 <- 1
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2739 # 1 <- 5
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2740
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2741 h2_priority($sess, 16, 1, 5);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2742 h2_priority($sess, 16, 5, 1);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2743
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2744 h2_window($sess, 2**16, $sid);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2745 h2_window($sess, 2**16, $sid3);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2746
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2747 $frames = h2_read($sess, all => [
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2748 { sid => $sid, fin => 1 },
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2749 { sid => $sid3, fin => 1 },
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2750 ]);
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2751
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2752 ($frame) = grep { $_->{type} eq "DATA" && $_->{sid} == $sid } @$frames;
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2753 is($frame->{length}, 81, 'removed dependency - first stream');
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2754
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2755 ($frame) = grep { $_->{type} eq "DATA" && $_->{sid} == $sid3 } @$frames;
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2756 is($frame->{length}, 81, 'removed dependency - last stream');
9187c6902b30 Tests: HTTP/2 circular stream dependency after removed dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 756
diff changeset
2757
758
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2758 # PRIORITY - reprioritization with circular dependency - exclusive [5]
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2759 # 1 <- [5] <- 3
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2760
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2761 $sess = new_session();
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2762
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2763 h2_window($sess, 2**18);
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2764
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2765 h2_priority($sess, 16, 1, 0);
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2766 h2_priority($sess, 16, 3, 1);
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2767 h2_priority($sess, 16, 5, 1, excl => 1);
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2768
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2769 $sid = new_stream($sess, { path => '/t1.html' });
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2770 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]);
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2771
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2772 $sid2 = new_stream($sess, { path => '/t1.html' });
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2773 h2_read($sess, all => [{ sid => $sid2, length => 2**16 - 1 }]);
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2774
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2775 $sid3 = new_stream($sess, { path => '/t1.html' });
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2776 h2_read($sess, all => [{ sid => $sid3, length => 2**16 - 1 }]);
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2777
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2778 h2_window($sess, 2**16, $sid);
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2779
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2780 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2781 $sids = join ' ', map { $_->{sid} } grep { $_->{type} eq "DATA" } @$frames;
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2782 is($sids, $sid, 'exclusive dependency - parent removed');
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2783
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2784 # make circular dependency
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2785 # 5 <- 3 -- current dependency tree before reprioritization
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2786 # 3 <- 5
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2787
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2788 h2_priority($sess, 16, 5, 3);
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2789
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2790 h2_window($sess, 2**16, $sid2);
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2791 h2_window($sess, 2**16, $sid3);
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2792
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2793 $frames = h2_read($sess, all => [
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2794 { sid => $sid2, fin => 1 },
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2795 { sid => $sid3, fin => 1 },
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2796 ]);
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2797
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2798 ($frame) = grep { $_->{type} eq "DATA" && $_->{sid} == $sid2 } @$frames;
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2799 is($frame->{length}, 81, 'exclusive dependency - first stream');
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2800
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2801 ($frame) = grep { $_->{type} eq "DATA" && $_->{sid} == $sid3 } @$frames;
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2802 is($frame->{length}, 81, 'exclusive dependency - last stream');
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
2803
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2804 # limit_conn
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2805
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2806 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2807 h2_settings($sess, 0, 0x4 => 1);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2808
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2809 $sid = new_stream($sess, { path => '/t3.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2810 $frames = h2_read($sess, all => [{ sid => $sid, length => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2811
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2812 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2813 is($frame->{headers}->{':status'}, 200, 'limit_conn first stream');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2814
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2815 $sid2 = new_stream($sess, { path => '/t3.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2816 $frames = h2_read($sess, all => [{ sid => $sid2, fin => 0 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2817
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2818 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid2 } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2819 is($frame->{headers}->{':status'}, 503, 'limit_conn rejected');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2820
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2821 h2_settings($sess, 0, 0x4 => 2**16);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2822
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2823 h2_read($sess, all => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2824 { sid => $sid, fin => 1 },
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2825 { sid => $sid2, fin => 1 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2826 ]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2827
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2828 # limit_conn + client's RST_STREAM
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2829
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2830 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2831 h2_settings($sess, 0, 0x4 => 1);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2832
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2833 $sid = new_stream($sess, { path => '/t3.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2834 $frames = h2_read($sess, all => [{ sid => $sid, length => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2835 h2_rst($sess, $sid, 5);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2836
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2837 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2838 is($frame->{headers}->{':status'}, 200, 'RST_STREAM 1');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2839
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2840 $sid2 = new_stream($sess, { path => '/t3.html' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2841 $frames = h2_read($sess, all => [{ sid => $sid2, fin => 0 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2842
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2843 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid2 } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2844 is($frame->{headers}->{':status'}, 200, 'RST_STREAM 2');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2845
654
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2846 # http2_max_concurrent_streams
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2847
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
2848 $sess = new_session(8086, pure => 1);
654
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2849 $frames = h2_read($sess, all => [{ type => 'SETTINGS' }]);
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2850
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2851 ($frame) = grep { $_->{type} eq 'SETTINGS' } @$frames;
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2852 is($frame->{3}, 1, 'http2_max_concurrent_streams SETTINGS');
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2853
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2854 h2_window($sess, 2**18);
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2855
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2856 $sid = new_stream($sess, { path => '/t1.html' });
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2857 $frames = h2_read($sess, all => [{ sid => $sid, length => 2 ** 16 - 1 }]);
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2858
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2859 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid } @$frames;
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2860 is($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams');
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2861
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2862 $sid2 = new_stream($sess, { path => '/t1.html' });
667
0247e314e991 Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 662
diff changeset
2863 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]);
654
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2864
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2865 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid2 } @$frames;
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2866 isnt($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams 2');
a64fe1054fb4 Tests: HTTP/2 tests for http2_max_concurrent_streams directive.
Sergey Kandaurov <pluknet@nginx.com>
parents: 653
diff changeset
2867
667
0247e314e991 Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 662
diff changeset
2868 ($frame) = grep { $_->{type} eq "RST_STREAM" && $_->{sid} == $sid2 } @$frames;
0247e314e991 Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 662
diff changeset
2869 is($frame->{sid}, $sid2, 'http2_max_concurrent_streams RST_STREAM sid');
0247e314e991 Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 662
diff changeset
2870 is($frame->{length}, 4, 'http2_max_concurrent_streams RST_STREAM length');
0247e314e991 Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 662
diff changeset
2871 is($frame->{flags}, 0, 'http2_max_concurrent_streams RST_STREAM flags');
0247e314e991 Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 662
diff changeset
2872 is($frame->{code}, 7, 'http2_max_concurrent_streams RST_STREAM code');
0247e314e991 Tests: more HTTP/2 error handling tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 662
diff changeset
2873
715
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2874 # properly skip header field that's not/never indexed from discarded streams
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2875
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2876 $sid2 = new_stream($sess, { headers => [
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2877 { name => ':method', value => 'GET' },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2878 { name => ':scheme', value => 'http' },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2879 { name => ':path', value => '/', mode => 6 },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2880 { name => ':authority', value => 'localhost' },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2881 { name => 'x-foo', value => 'Foo', mode => 2 }]});
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2882 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]);
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2883
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2884 # also if split across writes
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2885
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2886 $sid2 = new_stream($sess, { split => [ 22 ], headers => [
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2887 { name => ':method', value => 'GET' },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2888 { name => ':scheme', value => 'http' },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2889 { name => ':path', value => '/', mode => 6 },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2890 { name => ':authority', value => 'localhost' },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2891 { name => 'x-bar', value => 'Bar', mode => 2 }]});
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2892 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]);
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2893
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2894 # also if split across frames
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2895
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2896 $sid2 = new_stream($sess, { continuation => [ 17 ], headers => [
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2897 { name => ':method', value => 'GET' },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2898 { name => ':scheme', value => 'http' },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2899 { name => ':path', value => '/', mode => 6 },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2900 { name => ':authority', value => 'localhost' },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2901 { name => 'x-baz', value => 'Baz', mode => 2 }]});
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2902 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]);
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2903
661
c99c30afc1c9 Tests: one more test for http2_max_concurrent_streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 660
diff changeset
2904 h2_window($sess, 2**16, $sid);
c99c30afc1c9 Tests: one more test for http2_max_concurrent_streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 660
diff changeset
2905 h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
c99c30afc1c9 Tests: one more test for http2_max_concurrent_streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 660
diff changeset
2906
715
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2907 $sid = new_stream($sess, { headers => [
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2908 { name => ':method', value => 'GET' },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2909 { name => ':scheme', value => 'http' },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2910 { name => ':path', value => '/t2.html' },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2911 { name => ':authority', value => 'localhost' },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2912 # make sure that discarded streams updated dynamic table
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2913 { name => 'x-foo', value => 'Foo', mode => 0 },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2914 { name => 'x-bar', value => 'Bar', mode => 0 },
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
2915 { name => 'x-baz', value => 'Baz', mode => 0 }]});
661
c99c30afc1c9 Tests: one more test for http2_max_concurrent_streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 660
diff changeset
2916 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
c99c30afc1c9 Tests: one more test for http2_max_concurrent_streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 660
diff changeset
2917
c99c30afc1c9 Tests: one more test for http2_max_concurrent_streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 660
diff changeset
2918 ($frame) = grep { $_->{type} eq "HEADERS" && $_->{sid} == $sid } @$frames;
c99c30afc1c9 Tests: one more test for http2_max_concurrent_streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 660
diff changeset
2919 is($frame->{headers}->{':status'}, 200, 'http2_max_concurrent_streams 3');
c99c30afc1c9 Tests: one more test for http2_max_concurrent_streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 660
diff changeset
2920
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2921
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2922 # some invalid cases below
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2923
728
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
2924 # invalid connection preface
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
2925
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
2926 $sess = new_session(8080, preface => 'x' x 16, pure => 1);
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
2927 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]);
728
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
2928
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
2929 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
2930 ok($frame, 'invalid preface - GOAWAY frame');
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
2931 is($frame->{code}, 1, 'invalid preface - error code');
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
2932
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
2933 $sess = new_session(8080, preface => 'PRI * HTTP/2.0' . CRLF . CRLF . 'x' x 8,
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
2934 pure => 1);
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
2935 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]);
728
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
2936
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
2937 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
2938 ok($frame, 'invalid preface 2 - GOAWAY frame');
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
2939 is($frame->{code}, 1, 'invalid preface 2 - error code');
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
2940
727
3e034902ebe7 Tests: added HTTP/2 test with invalid PROXY protocol string.
Sergey Kandaurov <pluknet@nginx.com>
parents: 724
diff changeset
2941 # invalid PROXY protocol string
3e034902ebe7 Tests: added HTTP/2 test with invalid PROXY protocol string.
Sergey Kandaurov <pluknet@nginx.com>
parents: 724
diff changeset
2942
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
2943 $sess = new_session(8082, proxy => 'BOGUS TCP4 192.0.2.1 192.0.2.2 1234 5678',
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
2944 pure => 1);
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
2945 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]);
727
3e034902ebe7 Tests: added HTTP/2 test with invalid PROXY protocol string.
Sergey Kandaurov <pluknet@nginx.com>
parents: 724
diff changeset
2946
3e034902ebe7 Tests: added HTTP/2 test with invalid PROXY protocol string.
Sergey Kandaurov <pluknet@nginx.com>
parents: 724
diff changeset
2947 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
3e034902ebe7 Tests: added HTTP/2 test with invalid PROXY protocol string.
Sergey Kandaurov <pluknet@nginx.com>
parents: 724
diff changeset
2948 ok($frame, 'invalid PROXY - GOAWAY frame');
3e034902ebe7 Tests: added HTTP/2 test with invalid PROXY protocol string.
Sergey Kandaurov <pluknet@nginx.com>
parents: 724
diff changeset
2949 is($frame->{code}, 1, 'invalid PROXY - error code');
3e034902ebe7 Tests: added HTTP/2 test with invalid PROXY protocol string.
Sergey Kandaurov <pluknet@nginx.com>
parents: 724
diff changeset
2950
675
42de9efd11ee Tests: added HTTP/2 test for request header with newline.
Sergey Kandaurov <pluknet@nginx.com>
parents: 673
diff changeset
2951 # ensure that request header field value with newline doesn't get split
677
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2952 #
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2953 # 10.3. Intermediary Encapsulation Attacks
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2954 # Any request or response that contains a character not permitted
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2955 # in a header field value MUST be treated as malformed.
675
42de9efd11ee Tests: added HTTP/2 test for request header with newline.
Sergey Kandaurov <pluknet@nginx.com>
parents: 673
diff changeset
2956
42de9efd11ee Tests: added HTTP/2 test for request header with newline.
Sergey Kandaurov <pluknet@nginx.com>
parents: 673
diff changeset
2957 $sess = new_session();
42de9efd11ee Tests: added HTTP/2 test for request header with newline.
Sergey Kandaurov <pluknet@nginx.com>
parents: 673
diff changeset
2958 $sid = new_stream($sess, { headers => [
42de9efd11ee Tests: added HTTP/2 test for request header with newline.
Sergey Kandaurov <pluknet@nginx.com>
parents: 673
diff changeset
2959 { name => ':method', value => 'GET', mode => 0 },
42de9efd11ee Tests: added HTTP/2 test for request header with newline.
Sergey Kandaurov <pluknet@nginx.com>
parents: 673
diff changeset
2960 { name => ':scheme', value => 'http', mode => 0 },
42de9efd11ee Tests: added HTTP/2 test for request header with newline.
Sergey Kandaurov <pluknet@nginx.com>
parents: 673
diff changeset
2961 { name => ':path', value => '/proxy2/', mode => 1 },
42de9efd11ee Tests: added HTTP/2 test for request header with newline.
Sergey Kandaurov <pluknet@nginx.com>
parents: 673
diff changeset
2962 { name => ':authority', value => 'localhost', mode => 1 },
42de9efd11ee Tests: added HTTP/2 test for request header with newline.
Sergey Kandaurov <pluknet@nginx.com>
parents: 673
diff changeset
2963 { name => 'x-foo', value => "x-bar\r\nreferer:see-this", mode => 2 }]});
779
ca2db52ae97f Tests: fix and speed up h2.t tests by waiting for proper data.
Sergey Kandaurov <pluknet@nginx.com>
parents: 776
diff changeset
2964 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]);
675
42de9efd11ee Tests: added HTTP/2 test for request header with newline.
Sergey Kandaurov <pluknet@nginx.com>
parents: 673
diff changeset
2965
677
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2966 # 10.3. Intermediary Encapsulation Attacks
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2967 # An intermediary therefore cannot translate an HTTP/2 request or response
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2968 # containing an invalid field name into an HTTP/1.1 message.
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2969
675
42de9efd11ee Tests: added HTTP/2 test for request header with newline.
Sergey Kandaurov <pluknet@nginx.com>
parents: 673
diff changeset
2970 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
42de9efd11ee Tests: added HTTP/2 test for request header with newline.
Sergey Kandaurov <pluknet@nginx.com>
parents: 673
diff changeset
2971 isnt($frame->{headers}->{'x-referer'}, 'see-this', 'newline in request header');
42de9efd11ee Tests: added HTTP/2 test for request header with newline.
Sergey Kandaurov <pluknet@nginx.com>
parents: 673
diff changeset
2972
677
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2973 # 8.1.2.6. Malformed Requests and Responses
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2974 # Malformed requests or responses that are detected MUST be treated
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2975 # as a stream error (Section 5.4.2) of type PROTOCOL_ERROR.
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2976
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2977 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames;
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2978 is($frame->{sid}, $sid, 'newline in request header - RST_STREAM sid');
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2979 is($frame->{length}, 4, 'newline in request header - RST_STREAM length');
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2980 is($frame->{flags}, 0, 'newline in request header - RST_STREAM flags');
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2981 is($frame->{code}, 1, 'newline in request header - RST_STREAM code');
5d258aa5ebc5 Tests: more HTTP/2 tests for newline in request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 675
diff changeset
2982
781
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2983 # invalid header name as seen with underscore should not lead to ignoring rest
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2984
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2985 TODO: {
785
91e23e0c923a Tests: h2.t TODOs adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents: 784
diff changeset
2986 local $TODO = 'not yet' unless $t->has_version('1.9.7');
781
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2987
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2988 $sess = new_session();
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2989 $sid = new_stream($sess, { headers => [
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2990 { name => ':method', value => 'GET', mode => 0 },
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2991 { name => ':scheme', value => 'http', mode => 0 },
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2992 { name => ':path', value => '/', mode => 0 },
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2993 { name => ':authority', value => 'localhost', mode => 1 },
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2994 { name => 'x_foo', value => "x-bar", mode => 2 },
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2995 { name => 'referer', value => "see-this", mode => 1 }]});
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2996 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]);
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2997
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2998 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
2999 is($frame->{headers}->{'x-referer'}, 'see-this', 'after invalid header name');
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
3000
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
3001 }
d0a3444c21a6 Tests: added HTTP/2 test for invalid header name (ticket #831).
Sergey Kandaurov <pluknet@nginx.com>
parents: 779
diff changeset
3002
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3003 # GOAWAY on SYN_STREAM with even StreamID
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3004
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3005 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3006 new_stream($sess, { path => '/' }, 2);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3007 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3008
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3009 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3010 ok($frame, 'even stream - GOAWAY frame');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3011 is($frame->{code}, 1, 'even stream - error code');
669
0c442e551ba1 Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 668
diff changeset
3012 is($frame->{last_sid}, 0, 'even stream - last stream');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3013
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3014 # GOAWAY on SYN_STREAM with backward StreamID
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3015
669
0c442e551ba1 Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 668
diff changeset
3016 # 5.1.1. Stream Identifiers
0c442e551ba1 Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 668
diff changeset
3017 # The first use of a new stream identifier implicitly closes all
0c442e551ba1 Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 668
diff changeset
3018 # streams in the "idle" state <..> with a lower-valued stream identifier.
0c442e551ba1 Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 668
diff changeset
3019
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3020 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3021 $sid = new_stream($sess, { path => '/' }, 3);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3022 h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3023
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3024 $sid2 = new_stream($sess, { path => '/' }, 1);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3025 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3026
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3027 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3028 ok($frame, 'backward stream - GOAWAY frame');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3029 is($frame->{code}, 1, 'backward stream - error code');
669
0c442e551ba1 Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 668
diff changeset
3030 is($frame->{last_sid}, $sid, 'backward stream - last stream');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3031
669
0c442e551ba1 Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 668
diff changeset
3032 # GOAWAY on the second SYN_STREAM with same StreamID
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3033
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3034 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3035 $sid = new_stream($sess, { path => '/' });
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3036 h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3037
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3038 $sid2 = new_stream($sess, { path => '/' }, $sid);
669
0c442e551ba1 Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 668
diff changeset
3039 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]);
0c442e551ba1 Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 668
diff changeset
3040
0c442e551ba1 Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 668
diff changeset
3041 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
0c442e551ba1 Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 668
diff changeset
3042 ok($frame, 'dup stream - GOAWAY frame');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3043 is($frame->{code}, 1, 'dup stream - error code');
669
0c442e551ba1 Tests: corrected HTTP/2 tests for GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 668
diff changeset
3044 is($frame->{last_sid}, $sid, 'dup stream - last stream');
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3045
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3046 # missing mandatory request header ':scheme'
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3047
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3048 TODO: {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3049 local $TODO = 'not yet';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3050
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3051 $sess = new_session();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3052 $sid = new_stream($sess, { headers => [
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3053 { name => ':method', value => 'GET', mode => 0 },
653
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
3054 { name => ':path', value => '/', mode => 0 },
5ad620022234 Tests: HTTP/2 tests adapted to send ':authority' where needed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 652
diff changeset
3055 { name => ':authority', value => 'localhost', mode => 1 }]});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3056 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3057
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3058 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3059 is($frame->{headers}->{':status'}, 400, 'incomplete headers');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3060
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3061 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3062
673
9d6c865c2869 Tests: HTTP/2 regression test for empty authority request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 672
diff changeset
3063 # empty request header ':authority'
9d6c865c2869 Tests: HTTP/2 regression test for empty authority request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 672
diff changeset
3064
9d6c865c2869 Tests: HTTP/2 regression test for empty authority request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 672
diff changeset
3065 $sess = new_session();
9d6c865c2869 Tests: HTTP/2 regression test for empty authority request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 672
diff changeset
3066 $sid = new_stream($sess, { headers => [
9d6c865c2869 Tests: HTTP/2 regression test for empty authority request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 672
diff changeset
3067 { name => ':method', value => 'GET', mode => 0 },
9d6c865c2869 Tests: HTTP/2 regression test for empty authority request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 672
diff changeset
3068 { name => ':scheme', value => 'http', mode => 0 },
9d6c865c2869 Tests: HTTP/2 regression test for empty authority request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 672
diff changeset
3069 { name => ':path', value => '/', mode => 0 },
9d6c865c2869 Tests: HTTP/2 regression test for empty authority request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 672
diff changeset
3070 { name => ':authority', value => '', mode => 0 }]});
9d6c865c2869 Tests: HTTP/2 regression test for empty authority request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 672
diff changeset
3071 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
9d6c865c2869 Tests: HTTP/2 regression test for empty authority request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 672
diff changeset
3072
9d6c865c2869 Tests: HTTP/2 regression test for empty authority request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 672
diff changeset
3073 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
9d6c865c2869 Tests: HTTP/2 regression test for empty authority request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 672
diff changeset
3074 is($frame->{headers}->{':status'}, 400, 'empty authority');
9d6c865c2869 Tests: HTTP/2 regression test for empty authority request header.
Sergey Kandaurov <pluknet@nginx.com>
parents: 672
diff changeset
3075
754
84a52b6d6343 Tests: HTTP/2 regression test for incomplete HEADERS payload.
Sergey Kandaurov <pluknet@nginx.com>
parents: 748
diff changeset
3076 # aborted stream with zero HEADERS payload followed by client connection close
84a52b6d6343 Tests: HTTP/2 regression test for incomplete HEADERS payload.
Sergey Kandaurov <pluknet@nginx.com>
parents: 748
diff changeset
3077
770
c35b071d4b47 Tests: skip h2.t tests no longer that dumped core, fixes committed.
Sergey Kandaurov <pluknet@nginx.com>
parents: 769
diff changeset
3078 new_stream(new_session(), { split => [ 9 ], abort => 1 });
754
84a52b6d6343 Tests: HTTP/2 regression test for incomplete HEADERS payload.
Sergey Kandaurov <pluknet@nginx.com>
parents: 748
diff changeset
3079
697
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3080 # unknown frame type
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3081
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3082 $sess = new_session();
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3083 h2_unknown($sess, 'payload');
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3084 h2_ping($sess, 'SEE-THIS');
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3085 $frames = h2_read($sess, all => [{ type => 'PING' }]);
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3086
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3087 ($frame) = grep { $_->{type} eq "PING" } @$frames;
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3088 is($frame->{value}, 'SEE-THIS', 'unknown frame type');
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3089
789
eb257a102a9b Tests: turn typo into an actual RST_STREAM test with invalid path.
Sergey Kandaurov <pluknet@nginx.com>
parents: 785
diff changeset
3090 # client sent invalid :path header
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3091
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3092 $sid = new_stream($sess, { path => 't1.html' });
789
eb257a102a9b Tests: turn typo into an actual RST_STREAM test with invalid path.
Sergey Kandaurov <pluknet@nginx.com>
parents: 785
diff changeset
3093 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]);
eb257a102a9b Tests: turn typo into an actual RST_STREAM test with invalid path.
Sergey Kandaurov <pluknet@nginx.com>
parents: 785
diff changeset
3094
eb257a102a9b Tests: turn typo into an actual RST_STREAM test with invalid path.
Sergey Kandaurov <pluknet@nginx.com>
parents: 785
diff changeset
3095 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames;
eb257a102a9b Tests: turn typo into an actual RST_STREAM test with invalid path.
Sergey Kandaurov <pluknet@nginx.com>
parents: 785
diff changeset
3096 is($frame->{code}, 1, 'invalid path');
eb257a102a9b Tests: turn typo into an actual RST_STREAM test with invalid path.
Sergey Kandaurov <pluknet@nginx.com>
parents: 785
diff changeset
3097
eb257a102a9b Tests: turn typo into an actual RST_STREAM test with invalid path.
Sergey Kandaurov <pluknet@nginx.com>
parents: 785
diff changeset
3098 # GOAWAY - force closing a connection by server
eb257a102a9b Tests: turn typo into an actual RST_STREAM test with invalid path.
Sergey Kandaurov <pluknet@nginx.com>
parents: 785
diff changeset
3099
eb257a102a9b Tests: turn typo into an actual RST_STREAM test with invalid path.
Sergey Kandaurov <pluknet@nginx.com>
parents: 785
diff changeset
3100 $sid = new_stream($sess);
eb257a102a9b Tests: turn typo into an actual RST_STREAM test with invalid path.
Sergey Kandaurov <pluknet@nginx.com>
parents: 785
diff changeset
3101 h2_read($sess, all => [{ sid => $sid, fin => 1 }]);
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3102
755
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3103 # graceful shutdown with stream waiting on HEADERS payload
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3104
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3105 my $grace = new_session(8089);
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3106 new_stream($grace, { split => [ 9 ], abort => 1 });
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3107
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3108 # graceful shutdown with stream waiting on WINDOW_UPDATE
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3109
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3110 my $grace2 = new_session(8089);
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3111 $sid = new_stream($grace2, { path => '/t1.html' });
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3112 h2_read($grace2, all => [{ sid => $sid, length => 2**16 - 1 }]);
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3113
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3114 # graceful shutdown waiting on incomplete request body DATA frames
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3115
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3116 my $grace3 = new_session(8090);
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3117 $sid = new_stream($grace3, { path => '/proxy2/t2.html', body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3118 h2_body($grace3, 'TEST', { body_more => 1 });
755
f95aa716624e Tests: HTTP/2 tests for alerts on graceful shutdown.
Sergey Kandaurov <pluknet@nginx.com>
parents: 754
diff changeset
3119
830
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
3120 # partial request body data frame with connection close after body timeout
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
3121
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
3122 my $grace4 = new_session(8093);
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3123 $sid = new_stream($grace4, { path => '/proxy/t2.html', body_more => 1 });
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3124 h2_body($grace4, 'TEST', { split => [ 12 ], abort => 1 });
830
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
3125
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
3126 select undef, undef, undef, 1.1;
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
3127 undef $grace4;
3d12316e6f41 Tests: added HTTP/2 tests for client header and body timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 829
diff changeset
3128
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3129 $t->stop();
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3130
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3131 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3132
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3133 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3134 ok($frame, 'GOAWAY on connection close');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3135
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3136 ###############################################################################
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3137
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3138 sub h2_ping {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3139 my ($sess, $payload) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3140
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3141 raw_write($sess->{socket}, pack("x2C2x5a8", 8, 0x6, $payload));
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3142 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3143
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3144 sub h2_rst {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3145 my ($sess, $stream, $error) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3146
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3147 raw_write($sess->{socket}, pack("x2C2xNN", 4, 0x3, $stream, $error));
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3148 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3149
759
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
3150 sub h2_goaway {
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
3151 my ($sess, $stream, $lstream, $err, $debug, %extra) = @_;
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
3152 $debug = '' unless defined $debug;
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
3153 my $len = defined $extra{len} ? $extra{len} : 8 + length($debug);
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
3154 my $buf = pack("x2C2xN3A*", $len, 0x7, $stream, $lstream, $err, $debug);
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
3155
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
3156 my @bufs = map {
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
3157 raw_write($sess->{socket}, substr $buf, 0, $_, "");
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
3158 select undef, undef, undef, 0.4;
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
3159 } @{$extra{split}};
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
3160
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
3161 raw_write($sess->{socket}, $buf);
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
3162 }
6406eee6366c Tests: added simple HTTP/2 tests for client GOAWAY.
Sergey Kandaurov <pluknet@nginx.com>
parents: 758
diff changeset
3163
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3164 sub h2_priority {
758
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
3165 my ($sess, $w, $stream, $dep, %extra) = @_;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3166
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3167 $stream = 0 unless defined $stream;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3168 $dep = 0 unless defined $dep;
758
70c486d09663 Tests: HTTP/2 circular stream dependency with exclusive dependency.
Sergey Kandaurov <pluknet@nginx.com>
parents: 757
diff changeset
3169 $dep |= $extra{excl} << 31 if exists $extra{excl};
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3170 raw_write($sess->{socket}, pack("x2C2xNNC", 5, 0x2, $stream, $dep, $w));
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3171 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3172
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3173 sub h2_window {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3174 my ($sess, $win, $stream) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3175
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3176 $stream = 0 unless defined $stream;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3177 raw_write($sess->{socket}, pack("x2C2xNN", 4, 0x8, $stream, $win));
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3178 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3179
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3180 sub h2_settings {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3181 my ($sess, $ack, %extra) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3182
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3183 my $len = 6 * keys %extra;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3184 my $buf = pack_length($len) . pack "CCx4", 0x4, $ack ? 0x1 : 0x0;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3185 $buf .= join '', map { pack "nN", $_, $extra{$_} } keys %extra;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3186 raw_write($sess->{socket}, $buf);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3187 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3188
697
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3189 sub h2_unknown {
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3190 my ($sess, $payload) = @_;
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3191
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3192 my $buf = pack_length(length($payload)) . pack("Cx5a*", 0xa, $payload);
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3193 raw_write($sess->{socket}, $buf);
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3194 }
46f698a7e59c Tests: added HTTP/2 test for unknown frame type.
Sergey Kandaurov <pluknet@nginx.com>
parents: 696
diff changeset
3195
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3196 sub h2_continue {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3197 my ($ctx, $stream, $uri) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3198
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3199 $uri->{h2_continue} = 1;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3200 return new_stream($ctx, $uri, $stream);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3201 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3202
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3203 sub h2_body {
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3204 my ($sess, $body, $extra) = @_;
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3205 $extra = {} unless defined $extra;
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3206
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3207 my $len = length $body;
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3208 my $sid = $sess->{last_stream};
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3209
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3210 if ($len > $sess->{conn_window} || $len > $sess->{streams}{$sid}) {
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3211 h2_read($sess, all => [{ type => 'WINDOW_UPDATE' }]);
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3212 }
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3213
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3214 if ($len > $sess->{conn_window} || $len > $sess->{streams}{$sid}) {
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3215 return;
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3216 }
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3217
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3218 $sess->{conn_window} -= $len;
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3219 $sess->{streams}{$sid} -= $len;
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3220
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3221 my $buf;
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3222
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3223 my $split = ref $extra->{body_split} && $extra->{body_split} || [];
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3224 for (@$split) {
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3225 $buf .= pack_body($sess, substr($body, 0, $_, ""), 0x0, $extra);
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3226 }
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3227
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3228 $buf .= pack_body($sess, $body, 0x1, $extra) if defined $body;
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3229
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3230 $split = ref $extra->{split} && $extra->{split} || [];
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3231 for (@$split) {
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3232 raw_write($sess->{socket}, substr($buf, 0, $_, ""));
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3233 return if $extra->{abort};
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3234 select undef, undef, undef, ($extra->{split_delay} || 0.2);
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3235 }
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3236
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3237 raw_write($sess->{socket}, $buf);
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3238 }
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3239
843
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3240 sub pack_body {
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3241 my ($ctx, $body, $flags, $extra) = @_;
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3242
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3243 my $pad = defined $extra->{body_padding} ? $extra->{body_padding} : 0;
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3244 my $padlen = defined $extra->{body_padding} ? 1 : 0;
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3245
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3246 my $buf = pack_length(length($body) + $pad + $padlen);
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3247 $flags |= 0x8 if $padlen;
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3248 vec($flags, 0, 1) = 0 if $extra->{body_more};
843
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3249 $buf .= pack 'CC', 0x0, $flags; # DATA, END_STREAM
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3250 $buf .= pack 'N', $ctx->{last_stream};
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3251 $buf .= pack 'C', $pad if $padlen; # DATA Pad Length?
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3252 $buf .= $body;
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3253 $buf .= pack "x$pad" if $padlen; # DATA Padding
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3254 return $buf;
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3255 }
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3256
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3257 sub new_stream {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3258 my ($ctx, $uri, $stream) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3259 my ($input, $buf);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3260 my ($d, $status);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3261
718
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
3262 $ctx->{headers} = '';
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
3263
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3264 my $host = $uri->{host} || '127.0.0.1:8080';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3265 my $method = $uri->{method} || 'GET';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3266 my $scheme = $uri->{scheme} || 'http';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3267 my $path = $uri->{path} || '/';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3268 my $headers = $uri->{headers};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3269 my $body = $uri->{body};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3270 my $prio = $uri->{prio};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3271 my $dep = $uri->{dep};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3272
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3273 my $pad = defined $uri->{padding} ? $uri->{padding} : 0;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3274 my $padlen = defined $uri->{padding} ? 1 : 0;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3275
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3276 my $type = defined $uri->{h2_continue} ? 0x9 : 0x1;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3277 my $flags = defined $uri->{continuation} ? 0x0 : 0x4;
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3278 $flags |= 0x1 unless defined $body || defined $uri->{body_more};
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3279 $flags |= 0x8 if $padlen;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3280 $flags |= 0x20 if defined $dep || defined $prio;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3281
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3282 if ($stream) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3283 $ctx->{last_stream} = $stream;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3284 } else {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3285 $ctx->{last_stream} += 2;
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3286 $ctx->{streams}{$ctx->{last_stream}} = $ctx->{iws};
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3287 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3288
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3289 $buf = pack("xxx"); # Length stub
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3290 $buf .= pack("CC", $type, $flags); # END_HEADERS
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3291 $buf .= pack("N", $ctx->{last_stream}); # Stream-ID
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3292
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3293 $dep = 0 if defined $prio and not defined $dep;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3294 $prio = 16 if defined $dep and not defined $prio;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3295
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3296 unless ($headers) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3297 $input = hpack($ctx, ":method", $method);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3298 $input .= hpack($ctx, ":scheme", $scheme);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3299 $input .= hpack($ctx, ":path", $path);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3300 $input .= hpack($ctx, ":authority", $host);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3301 $input .= hpack($ctx, "content-length", length($body)) if $body;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3302
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3303 } else {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3304 $input = join '', map {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3305 hpack($ctx, $_->{name}, $_->{value},
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3306 mode => $_->{mode}, huff => $_->{huff})
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3307 } @$headers if $headers;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3308 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3309
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3310 $input = pack("B*", '001' . ipack(5, $uri->{table_size})) . $input
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3311 if defined $uri->{table_size};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3312
843
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3313 my $split = ref $uri->{continuation} && $uri->{continuation} || [];
702
cc2b98d028c8 Tests: fixed HTTP/2 test for CONTINUATION while in header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 700
diff changeset
3314 my @input = map { substr $input, 0, $_, "" } @$split;
699
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3315 push @input, $input;
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3316
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3317 # set length, attach headers, padding, priority
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3318
699
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3319 my $hlen = length($input[0]) + $pad + $padlen;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3320 $hlen += 5 if $flags & 0x20;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3321 $buf |= pack_length($hlen);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3322
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3323 $buf .= pack 'C', $pad if $padlen; # Pad Length?
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3324 $buf .= pack 'NC', $dep, $prio if $flags & 0x20;
699
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3325 $buf .= $input[0];
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3326 $buf .= (pack 'C', 0) x $pad if $padlen; # Padding
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3327
699
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3328 shift @input;
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3329
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3330 while (@input) {
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3331 $input = shift @input;
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3332 $flags = @input ? 0x0 : 0x4;
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3333 $buf .= pack_length(length($input));
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3334 $buf .= pack("CC", 0x9, $flags);
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3335 $buf .= pack("N", $ctx->{last_stream});
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3336 $buf .= $input;
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3337 }
5768830f01c4 Tests: HTTP/2 test for CONTINUATION in the middle of header field.
Sergey Kandaurov <pluknet@nginx.com>
parents: 698
diff changeset
3338
843
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3339 $split = ref $uri->{body_split} && $uri->{body_split} || [];
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3340 for (@$split) {
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3341 $buf .= pack_body($ctx, substr($body, 0, $_, ""), 0x0, $uri);
745
cdd3659d1144 Tests: simple HTTP/2 test for request body in multiple DATA frames.
Sergey Kandaurov <pluknet@nginx.com>
parents: 744
diff changeset
3342 }
cdd3659d1144 Tests: simple HTTP/2 test for request body in multiple DATA frames.
Sergey Kandaurov <pluknet@nginx.com>
parents: 744
diff changeset
3343
843
5e7845d36e54 Tests: simplified constructing HTTP/2 request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 842
diff changeset
3344 $buf .= pack_body($ctx, $body, 0x1, $uri) if defined $body;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3345
715
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
3346 $split = ref $uri->{split} && $uri->{split} || [];
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
3347 for (@$split) {
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
3348 raw_write($ctx->{socket}, substr($buf, 0, $_, ""));
754
84a52b6d6343 Tests: HTTP/2 regression test for incomplete HEADERS payload.
Sergey Kandaurov <pluknet@nginx.com>
parents: 748
diff changeset
3349 goto done if $uri->{abort};
822
92e20c77c916 Tests: added HTTP/2 discarded request body tests with limit_req.
Sergey Kandaurov <pluknet@nginx.com>
parents: 821
diff changeset
3350 select undef, undef, undef, ($uri->{split_delay} || 0.2);
715
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
3351 }
9ee52e137f3d Tests: more HTTP/2 HPACK decoding tests with discarded streams.
Sergey Kandaurov <pluknet@nginx.com>
parents: 714
diff changeset
3352
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3353 raw_write($ctx->{socket}, $buf);
754
84a52b6d6343 Tests: HTTP/2 regression test for incomplete HEADERS payload.
Sergey Kandaurov <pluknet@nginx.com>
parents: 748
diff changeset
3354 done:
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3355 return $ctx->{last_stream};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3356 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3357
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3358 sub h2_read {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3359 my ($sess, %extra) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3360 my (@got);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3361 my $s = $sess->{socket};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3362 my $buf = '';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3363
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3364 while (1) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3365 $buf = raw_read($s, $buf, 9);
782
37396c3bc097 Tests: do not break h2.t on incomplete frame header received.
Sergey Kandaurov <pluknet@nginx.com>
parents: 781
diff changeset
3366 last if length $buf < 9;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3367
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3368 my $length = unpack_length($buf);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3369 my $type = unpack('x3C', $buf);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3370 my $flags = unpack('x4C', $buf);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3371
655
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3372 my $stream = unpack "x5 B32", $buf;
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3373 substr($stream, 0, 1) = 0;
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3374 $stream = unpack("N", pack("B32", $stream));
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3375
679
b60c1a207675 Tests: fixed HTTP/2 tests with large frames.
Sergey Kandaurov <pluknet@nginx.com>
parents: 677
diff changeset
3376 $buf = raw_read($s, $buf, $length + 9);
724
4322541b80ed Tests: avoid uninitialized warnings in h2.t with partial frame.
Sergey Kandaurov <pluknet@nginx.com>
parents: 723
diff changeset
3377 last if length($buf) < $length + 9;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3378
655
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3379 $buf = substr($buf, 9);
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3380
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3381 my $frame = $cframe{$type}{value}($sess, $buf, $length, $flags,
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3382 $stream);
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3383 $frame->{length} = $length;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3384 $frame->{type} = $cframe{$type}{name};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3385 $frame->{flags} = $flags;
655
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3386 $frame->{sid} = $stream;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3387 push @got, $frame;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3388
655
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3389 $buf = substr($buf, $length);
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3390
813
43716ff7f8f5 Tests: unbreak h2.t when data read with empty markers.
Sergey Kandaurov <pluknet@nginx.com>
parents: 794
diff changeset
3391 last unless $extra{all} && test_fin($got[-1], $extra{all});
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3392 };
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3393 return \@got;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3394 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3395
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3396 sub test_fin {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3397 my ($frame, $all) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3398 my @test = @{$all};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3399
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3400 # wait for the specified DATA length
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3401
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3402 for (@test) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3403 if ($_->{length} && $frame->{type} eq 'DATA') {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3404 # check also for StreamID if needed
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3405
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3406 if (!$_->{sid} || $_->{sid} == $frame->{sid}) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3407 $_->{length} -= $frame->{length};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3408 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3409 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3410 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3411 @test = grep { !(defined $_->{length} && $_->{length} == 0) } @test;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3412
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3413 # wait for the fin flag
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3414
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3415 @test = grep { !(defined $_->{fin}
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3416 && $_->{sid} == $frame->{sid} && $_->{fin} & $frame->{flags})
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3417 } @test if defined $frame->{flags};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3418
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3419 # wait for the specified frame
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3420
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3421 @test = grep { !($_->{type} && $_->{type} eq $frame->{type}) } @test;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3422
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3423 @{$all} = @test;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3424 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3425
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3426 sub headers {
718
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
3427 my ($ctx, $buf, $len, $flags) = @_;
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
3428 $ctx->{headers} .= substr($buf, 0, $len);
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
3429 return unless $flags & 0x4;
ba822b2e899c Tests: rewrote HTTP/2 response CONTINUATION tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 717
diff changeset
3430 { headers => hunpack($ctx, $ctx->{headers}, length($ctx->{headers})) };
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3431 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3432
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3433 sub data {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3434 my ($ctx, $buf, $len) = @_;
655
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3435 return { data => substr($buf, 0, $len) };
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3436 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3437
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3438 sub settings {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3439 my ($ctx, $buf, $len) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3440 my %payload;
655
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3441 my $skip = 0;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3442
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3443 for (1 .. $len / 6) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3444 my $id = hex unpack "\@$skip n", $buf; $skip += 2;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3445 $payload{$id} = unpack "\@$skip N", $buf; $skip += 4;
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3446
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3447 $ctx->{iws} = $payload{$id} if $id == 4;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3448 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3449 return \%payload;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3450 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3451
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3452 sub ping {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3453 my ($ctx, $buf, $len) = @_;
670
944b87756cab Tests: fixed GOAWAY and PING frames parsing in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 669
diff changeset
3454 return { value => unpack "A$len", $buf };
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3455 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3456
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3457 sub rst_stream {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3458 my ($ctx, $buf, $len) = @_;
655
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3459 return { code => unpack "N", $buf };
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3460 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3461
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3462 sub goaway {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3463 my ($ctx, $buf, $len) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3464 my %payload;
655
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3465
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3466 my $stream = unpack "B32", $buf;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3467 substr($stream, 0, 1) = 0;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3468 $stream = unpack("N", pack("B32", $stream));
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3469 $payload{last_sid} = $stream;
655
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3470
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3471 $len -= 4;
670
944b87756cab Tests: fixed GOAWAY and PING frames parsing in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 669
diff changeset
3472 $payload{code} = unpack "x4 N", $buf;
944b87756cab Tests: fixed GOAWAY and PING frames parsing in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 669
diff changeset
3473 $payload{debug} = unpack "x8 A$len", $buf;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3474 return \%payload;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3475 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3476
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3477 sub window_update {
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3478 my ($ctx, $buf, $len, $flags, $sid) = @_;
655
75ecd26b8831 Tests: HTTP/2 tests cleanup.
Sergey Kandaurov <pluknet@nginx.com>
parents: 654
diff changeset
3479 my $value = unpack "B32", $buf;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3480 substr($value, 0, 1) = 0;
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3481 $value = unpack("N", pack("B32", $value));
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3482
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3483 unless ($sid) {
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3484 $ctx->{conn_window} += $value;
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3485
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3486 } else {
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3487 $ctx->{streams}{$sid} = $ctx->{iws}
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3488 unless defined $ctx->{streams}{$sid};
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3489 $ctx->{streams}{$sid} += $value;
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3490 }
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3491
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3492 return { wdelta => $value };
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3493 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3494
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3495 sub pack_length {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3496 pack 'c3', unpack 'xc3', pack 'N', $_[0];
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3497 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3498
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3499 sub unpack_length {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3500 unpack 'N', pack 'xc3', unpack 'c3', $_[0];
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3501 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3502
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3503 sub raw_read {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3504 my ($s, $buf, $len) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3505 my $got = '';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3506
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3507 while (length($buf) < $len && IO::Select->new($s)->can_read(1)) {
650
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
3508 $s->sysread($got, 16384) or last;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3509 log_in($got);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3510 $buf .= $got;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3511 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3512 return $buf;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3513 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3514
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3515 sub raw_write {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3516 my ($s, $message) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3517
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3518 local $SIG{PIPE} = 'IGNORE';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3519
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3520 while (IO::Select->new($s)->can_write(0.4)) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3521 log_out($message);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3522 my $n = $s->syswrite($message);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3523 last unless $n;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3524 $message = substr($message, $n);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3525 last unless length $message;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3526 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3527 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3528
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3529 sub new_session {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3530 my ($port, %extra) = @_;
728
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
3531
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
3532 my $s = new_socket($port, %extra);
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
3533 my $preface = $extra{preface}
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
3534 || 'PRI * HTTP/2.0' . CRLF . CRLF . 'SM' . CRLF . CRLF;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3535
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3536 if ($extra{proxy}) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3537 raw_write($s, $extra{proxy});
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3538 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3539
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3540 # preface
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3541
728
61800918f647 Tests: added HTTP/2 tests with invalid connection preface.
Sergey Kandaurov <pluknet@nginx.com>
parents: 727
diff changeset
3542 raw_write($s, $preface);
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3543
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3544 my $ctx = { socket => $s, last_stream => -1,
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3545 dynamic_encode => [ static_table() ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3546 dynamic_decode => [ static_table() ],
844
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3547 static_table_size => scalar @{[static_table()]},
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3548 iws => 65535, conn_window => 65535, streams => {}};
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3549
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3550 return $ctx if $extra{pure};
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3551
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3552 # update windows, if any
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3553
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3554 h2_read($ctx, all => [
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3555 { type => 'WINDOW_UPDATE' },
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3556 { type => 'SETTINGS'}
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3557 ]);
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3558
3a334b20208e Tests: made HTTP/2 tests respect request body flow-control windows.
Sergey Kandaurov <pluknet@nginx.com>
parents: 843
diff changeset
3559 return $ctx;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3560 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3561
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3562 sub new_socket {
650
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
3563 my ($port, %extra) = @_;
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
3564 my $npn = $extra{'npn'};
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
3565 my $alpn = $extra{'alpn'};
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3566 my $s;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3567
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3568 $port = 8080 unless defined $port;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3569
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3570 eval {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3571 local $SIG{ALRM} = sub { die "timeout\n" };
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3572 local $SIG{PIPE} = sub { die "sigpipe\n" };
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3573 alarm(2);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3574 $s = IO::Socket::INET->new(
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3575 Proto => 'tcp',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3576 PeerAddr => "127.0.0.1:$port",
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3577 );
650
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
3578 IO::Socket::SSL->start_SSL($s,
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
3579 SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(),
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
3580 SSL_npn_protocols => $npn ? [ $npn ] : undef,
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
3581 SSL_alpn_protocols => $alpn ? [ $alpn ] : undef,
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
3582 SSL_error_trap => sub { die $_[1] }
8a2cf558b8ae Tests: HTTP/2 tests for $http2 variable.
Sergey Kandaurov <pluknet@nginx.com>
parents: 647
diff changeset
3583 ) if $extra{'SSL'};
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3584 alarm(0);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3585 };
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3586 alarm(0);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3587
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3588 if ($@) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3589 log_in("died: $@");
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3590 return undef;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3591 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3592
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3593 return $s;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3594 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3595
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3596 sub static_table {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3597 [ '', '' ], # unused
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3598 [ ':authority', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3599 [ ':method', 'GET' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3600 [ ':method', 'POST' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3601 [ ':path', '/' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3602 [ ':path', '/index.html' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3603 [ ':scheme', 'http' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3604 [ ':scheme', 'https' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3605 [ ':status', '200' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3606 [ ':status', '204' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3607 [ ':status', '206' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3608 [ ':status', '304' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3609 [ ':status', '400' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3610 [ ':status', '404' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3611 [ ':status', '500' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3612 [ 'accept-charset', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3613 [ 'accept-encoding', 'gzip, deflate' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3614 [ 'accept-language', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3615 [ 'accept-ranges', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3616 [ 'accept', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3617 [ 'access-control-allow-origin',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3618 '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3619 [ 'age', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3620 [ 'allow', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3621 [ 'authorization', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3622 [ 'cache-control', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3623 [ 'content-disposition',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3624 '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3625 [ 'content-encoding', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3626 [ 'content-language', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3627 [ 'content-length', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3628 [ 'content-location', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3629 [ 'content-range', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3630 [ 'content-type', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3631 [ 'cookie', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3632 [ 'date', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3633 [ 'etag', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3634 [ 'expect', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3635 [ 'expires', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3636 [ 'from', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3637 [ 'host', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3638 [ 'if-match', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3639 [ 'if-modified-since', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3640 [ 'if-none-match', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3641 [ 'if-range', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3642 [ 'if-unmodified-since',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3643 '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3644 [ 'last-modified', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3645 [ 'link', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3646 [ 'location', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3647 [ 'max-forwards', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3648 [ 'proxy-authenticate', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3649 [ 'proxy-authorization',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3650 '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3651 [ 'range', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3652 [ 'referer', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3653 [ 'refresh', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3654 [ 'retry-after', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3655 [ 'server', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3656 [ 'set-cookie', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3657 [ 'strict-transport-security',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3658 '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3659 [ 'transfer-encoding', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3660 [ 'user-agent', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3661 [ 'vary', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3662 [ 'via', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3663 [ 'www-authenticate', '' ],
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3664 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3665
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3666 # RFC 7541, 5.1. Integer Representation
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3667
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3668 sub ipack {
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3669 my ($base, $d) = @_;
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3670 return sprintf("%.*b", $base, $d) if $d < 2**$base - 1;
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3671
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3672 my $o = sprintf("%${base}b", 2**$base - 1);
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3673 $d -= 2**$base - 1;
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3674 while ($d >= 128) {
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3675 $o .= sprintf("%8b", $d % 128 + 128);
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3676 $d /= 128;
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3677 }
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3678 $o .= sprintf("%08b", $d);
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3679 return $o;
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3680 }
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3681
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3682 sub iunpack {
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3683 my ($base, $b, $s) = @_;
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3684
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3685 my $len = unpack("\@$s B8", $b); $s++;
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3686 my $prefix = substr($len, 0, 8 - $base);
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3687 $len = '0' x (8 - $base) . substr($len, 8 - $base);
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3688 $len = unpack("C", pack("B8", $len));
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3689
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3690 return ($len, $s, $prefix) if $len < 2**$base - 1;
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3691
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3692 my $m = 0;
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3693 my $d;
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3695 do {
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3696 $d = unpack("\@$s C", $b); $s++;
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3697 $len += ($d & 127) * 2**$m;
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3698 $m += $base;
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3699 } while (($d & 128) == 128);
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3700
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3701 return ($len, $s, $prefix);
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3702 }
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3703
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3704 sub hpack {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3705 my ($ctx, $name, $value, %extra) = @_;
671
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3706 my $table = $ctx->{dynamic_encode};
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3707 my $mode = defined $extra{mode} ? $extra{mode} : 1;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3708 my $huff = $extra{huff};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3709
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3710 my ($index, $buf) = 0;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3711
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3712 # 6.1. Indexed Header Field Representation
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3713
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3714 if ($mode == 0) {
671
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3715 ++$index until $index > $#$table
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3716 or $table->[$index][0] eq $name
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3717 and $table->[$index][1] eq $value;
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3718 $buf = pack('B*', '1' . ipack(7, $index));
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3719 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3720
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3721 # 6.2.1. Literal Header Field with Incremental Indexing
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3722
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3723 if ($mode == 1) {
671
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3724 splice @$table, $ctx->{static_table_size}, 0, [ $name, $value ];
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3725
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3726 ++$index until $index > $#$table
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3727 or $table->[$index][0] eq $name;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3728 my $value = $huff ? huff($value) : $value;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3729
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3730 $buf = pack('B*', '01' . ipack(6, $index)
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3731 . ($huff ? '1' : '0') . ipack(7, length($value)));
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3732 $buf .= $value;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3733 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3734
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3735 # 6.2.1. Literal Header Field with Incremental Indexing -- New Name
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3736
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3737 if ($mode == 2) {
671
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3738 splice @$table, $ctx->{static_table_size}, 0, [ $name, $value ];
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3739
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3740 my $name = $huff ? huff($name) : $name;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3741 my $value = $huff ? huff($value) : $value;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3742 my $hbit = ($huff ? '1' : '0');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3743
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3744 $buf = pack('B*', '01000000');
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3745 $buf .= pack('B*', $hbit . ipack(7, length($name)));
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3746 $buf .= $name;
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3747 $buf .= pack('B*', $hbit . ipack(7, length($value)));
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3748 $buf .= $value;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3749 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3750
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3751 # 6.2.2. Literal Header Field without Indexing
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3752
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3753 if ($mode == 3) {
671
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3754 ++$index until $index > $#$table
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3755 or $table->[$index][0] eq $name;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3756 my $value = $huff ? huff($value) : $value;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3757
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3758 $buf = pack('B*', '0000' . ipack(4, $index)
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3759 . ($huff ? '1' : '0') . ipack(7, length($value)));
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3760 $buf .= $value;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3761 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3762
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3763 # 6.2.2. Literal Header Field without Indexing -- New Name
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3764
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3765 if ($mode == 4) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3766 my $name = $huff ? huff($name) : $name;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3767 my $value = $huff ? huff($value) : $value;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3768 my $hbit = ($huff ? '1' : '0');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3769
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3770 $buf = pack('B*', '00000000');
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3771 $buf .= pack('B*', $hbit . ipack(7, length($name)));
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3772 $buf .= $name;
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3773 $buf .= pack('B*', $hbit . ipack(7, length($value)));
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3774 $buf .= $value;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3775 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3776
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3777 # 6.2.3. Literal Header Field Never Indexed
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3778
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3779 if ($mode == 5) {
671
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3780 ++$index until $index > $#$table
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3781 or $table->[$index][0] eq $name;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3782 my $value = $huff ? huff($value) : $value;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3783
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3784 $buf = pack('B*', '0001' . ipack(4, $index)
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3785 . ($huff ? '1' : '0') . ipack(7, length($value)));
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3786 $buf .= $value;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3787 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3788
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3789 # 6.2.3. Literal Header Field Never Indexed -- New Name
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3790
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3791 if ($mode == 6) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3792 my $name = $huff ? huff($name) : $name;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3793 my $value = $huff ? huff($value) : $value;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3794 my $hbit = ($huff ? '1' : '0');
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3795
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3796 $buf = pack('B*', '00010000');
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3797 $buf .= pack('B*', $hbit . ipack(7, length($name)));
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3798 $buf .= $name;
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3799 $buf .= pack('B*', $hbit . ipack(7, length($value)));
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3800 $buf .= $value;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3801 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3802
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3803 return $buf;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3804 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3805
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3806 sub hunpack {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3807 my ($ctx, $data, $length) = @_;
671
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3808 my $table = $ctx->{dynamic_decode};
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3809 my %headers;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3810 my $skip = 0;
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3811 my ($index, $name, $value);
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3812
735
832cd7cc8f53 Tests: made h2.t inner functions anonymous.
Sergey Kandaurov <pluknet@nginx.com>
parents: 730
diff changeset
3813 my $field = sub {
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3814 my ($b) = @_;
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3815 my ($len, $s, $huff) = iunpack(7, @_);
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3816
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3817 my $field = substr($b, $s, $len);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3818 $field = $huff ? dehuff($field) : $field;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3819 $s += $len;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3820 return ($field, $s);
735
832cd7cc8f53 Tests: made h2.t inner functions anonymous.
Sergey Kandaurov <pluknet@nginx.com>
parents: 730
diff changeset
3821 };
832cd7cc8f53 Tests: made h2.t inner functions anonymous.
Sergey Kandaurov <pluknet@nginx.com>
parents: 730
diff changeset
3822
832cd7cc8f53 Tests: made h2.t inner functions anonymous.
Sergey Kandaurov <pluknet@nginx.com>
parents: 730
diff changeset
3823 my $add = sub {
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3824 my ($h, $n, $v) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3825 return $h->{$n} = $v unless exists $h->{$n};
717
3b6ff3b7367d Tests: fixed multiple header field values representation in h2.t.
Sergey Kandaurov <pluknet@nginx.com>
parents: 716
diff changeset
3826 $h->{$n} = [ $h->{$n} ] unless ref $h->{$n};
647
4e36550410b3 Tests: h2.t fixes for older perl versions, and gzip test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 646
diff changeset
3827 push @{$h->{$n}}, $v;
735
832cd7cc8f53 Tests: made h2.t inner functions anonymous.
Sergey Kandaurov <pluknet@nginx.com>
parents: 730
diff changeset
3828 };
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3829
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3830 while ($skip < $length) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3831 my $ib = unpack("\@$skip B8", $data);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3832
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3833 if (substr($ib, 0, 1) eq '1') {
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3834 ($index, $skip) = iunpack(7, $data, $skip);
735
832cd7cc8f53 Tests: made h2.t inner functions anonymous.
Sergey Kandaurov <pluknet@nginx.com>
parents: 730
diff changeset
3835 $add->(\%headers,
671
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3836 $table->[$index][0], $table->[$index][1]);
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3837 next;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3838 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3839
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3840 if (substr($ib, 0, 2) eq '01') {
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3841 ($index, $skip) = iunpack(6, $data, $skip);
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3842 $name = $table->[$index][0];
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3843
735
832cd7cc8f53 Tests: made h2.t inner functions anonymous.
Sergey Kandaurov <pluknet@nginx.com>
parents: 730
diff changeset
3844 ($name, $skip) = $field->($data, $skip) unless $name;
832cd7cc8f53 Tests: made h2.t inner functions anonymous.
Sergey Kandaurov <pluknet@nginx.com>
parents: 730
diff changeset
3845 ($value, $skip) = $field->($data, $skip);
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3846
671
0c70eb166a3a Tests: in HTTP/2 tests, always access a dynamic table by reference.
Sergey Kandaurov <pluknet@nginx.com>
parents: 670
diff changeset
3847 splice @$table,
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3848 $ctx->{static_table_size}, 0, [ $name, $value ];
735
832cd7cc8f53 Tests: made h2.t inner functions anonymous.
Sergey Kandaurov <pluknet@nginx.com>
parents: 730
diff changeset
3849 $add->(\%headers, $name, $value);
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3850 next;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3851 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3852
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3853 if (substr($ib, 0, 4) eq '0000') {
694
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3854 ($index, $skip) = iunpack(4, $data, $skip);
3eba6e1b8313 Tests: finished HPACK coding in HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 692
diff changeset
3855 $name = $table->[$index][0];
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3856
735
832cd7cc8f53 Tests: made h2.t inner functions anonymous.
Sergey Kandaurov <pluknet@nginx.com>
parents: 730
diff changeset
3857 ($name, $skip) = $field->($data, $skip) unless $name;
832cd7cc8f53 Tests: made h2.t inner functions anonymous.
Sergey Kandaurov <pluknet@nginx.com>
parents: 730
diff changeset
3858 ($value, $skip) = $field->($data, $skip);
832cd7cc8f53 Tests: made h2.t inner functions anonymous.
Sergey Kandaurov <pluknet@nginx.com>
parents: 730
diff changeset
3859
832cd7cc8f53 Tests: made h2.t inner functions anonymous.
Sergey Kandaurov <pluknet@nginx.com>
parents: 730
diff changeset
3860 $add->(\%headers, $name, $value);
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3861 next;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3862 }
783
dba6660b31db Tests: stop decoding HTTP/2 headers on unknown format.
Sergey Kandaurov <pluknet@nginx.com>
parents: 782
diff changeset
3863 last;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3864 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3865
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3866 return \%headers;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3867 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3868
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3869 sub huff_code { scalar {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3870 pack('C', 0) => '1111111111000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3871 pack('C', 1) => '11111111111111111011000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3872 pack('C', 2) => '1111111111111111111111100010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3873 pack('C', 3) => '1111111111111111111111100011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3874 pack('C', 4) => '1111111111111111111111100100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3875 pack('C', 5) => '1111111111111111111111100101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3876 pack('C', 6) => '1111111111111111111111100110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3877 pack('C', 7) => '1111111111111111111111100111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3878 pack('C', 8) => '1111111111111111111111101000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3879 pack('C', 9) => '111111111111111111101010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3880 pack('C', 10) => '111111111111111111111111111100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3881 pack('C', 11) => '1111111111111111111111101001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3882 pack('C', 12) => '1111111111111111111111101010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3883 pack('C', 13) => '111111111111111111111111111101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3884 pack('C', 14) => '1111111111111111111111101011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3885 pack('C', 15) => '1111111111111111111111101100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3886 pack('C', 16) => '1111111111111111111111101101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3887 pack('C', 17) => '1111111111111111111111101110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3888 pack('C', 18) => '1111111111111111111111101111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3889 pack('C', 19) => '1111111111111111111111110000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3890 pack('C', 20) => '1111111111111111111111110001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3891 pack('C', 21) => '1111111111111111111111110010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3892 pack('C', 22) => '111111111111111111111111111110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3893 pack('C', 23) => '1111111111111111111111110011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3894 pack('C', 24) => '1111111111111111111111110100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3895 pack('C', 25) => '1111111111111111111111110101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3896 pack('C', 26) => '1111111111111111111111110110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3897 pack('C', 27) => '1111111111111111111111110111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3898 pack('C', 28) => '1111111111111111111111111000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3899 pack('C', 29) => '1111111111111111111111111001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3900 pack('C', 30) => '1111111111111111111111111010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3901 pack('C', 31) => '1111111111111111111111111011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3902 pack('C', 32) => '010100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3903 pack('C', 33) => '1111111000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3904 pack('C', 34) => '1111111001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3905 pack('C', 35) => '111111111010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3906 pack('C', 36) => '1111111111001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3907 pack('C', 37) => '010101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3908 pack('C', 38) => '11111000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3909 pack('C', 39) => '11111111010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3910 pack('C', 40) => '1111111010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3911 pack('C', 41) => '1111111011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3912 pack('C', 42) => '11111001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3913 pack('C', 43) => '11111111011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3914 pack('C', 44) => '11111010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3915 pack('C', 45) => '010110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3916 pack('C', 46) => '010111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3917 pack('C', 47) => '011000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3918 pack('C', 48) => '00000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3919 pack('C', 49) => '00001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3920 pack('C', 50) => '00010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3921 pack('C', 51) => '011001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3922 pack('C', 52) => '011010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3923 pack('C', 53) => '011011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3924 pack('C', 54) => '011100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3925 pack('C', 55) => '011101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3926 pack('C', 56) => '011110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3927 pack('C', 57) => '011111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3928 pack('C', 58) => '1011100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3929 pack('C', 59) => '11111011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3930 pack('C', 60) => '111111111111100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3931 pack('C', 61) => '100000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3932 pack('C', 62) => '111111111011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3933 pack('C', 63) => '1111111100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3934 pack('C', 64) => '1111111111010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3935 pack('C', 65) => '100001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3936 pack('C', 66) => '1011101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3937 pack('C', 67) => '1011110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3938 pack('C', 68) => '1011111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3939 pack('C', 69) => '1100000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3940 pack('C', 70) => '1100001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3941 pack('C', 71) => '1100010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3942 pack('C', 72) => '1100011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3943 pack('C', 73) => '1100100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3944 pack('C', 74) => '1100101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3945 pack('C', 75) => '1100110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3946 pack('C', 76) => '1100111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3947 pack('C', 77) => '1101000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3948 pack('C', 78) => '1101001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3949 pack('C', 79) => '1101010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3950 pack('C', 80) => '1101011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3951 pack('C', 81) => '1101100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3952 pack('C', 82) => '1101101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3953 pack('C', 83) => '1101110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3954 pack('C', 84) => '1101111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3955 pack('C', 85) => '1110000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3956 pack('C', 86) => '1110001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3957 pack('C', 87) => '1110010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3958 pack('C', 88) => '11111100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3959 pack('C', 89) => '1110011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3960 pack('C', 90) => '11111101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3961 pack('C', 91) => '1111111111011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3962 pack('C', 92) => '1111111111111110000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3963 pack('C', 93) => '1111111111100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3964 pack('C', 94) => '11111111111100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3965 pack('C', 95) => '100010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3966 pack('C', 96) => '111111111111101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3967 pack('C', 97) => '00011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3968 pack('C', 98) => '100011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3969 pack('C', 99) => '00100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3970 pack('C', 100) => '100100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3971 pack('C', 101) => '00101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3972 pack('C', 102) => '100101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3973 pack('C', 103) => '100110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3974 pack('C', 104) => '100111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3975 pack('C', 105) => '00110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3976 pack('C', 106) => '1110100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3977 pack('C', 107) => '1110101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3978 pack('C', 108) => '101000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3979 pack('C', 109) => '101001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3980 pack('C', 110) => '101010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3981 pack('C', 111) => '00111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3982 pack('C', 112) => '101011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3983 pack('C', 113) => '1110110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3984 pack('C', 114) => '101100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3985 pack('C', 115) => '01000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3986 pack('C', 116) => '01001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3987 pack('C', 117) => '101101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3988 pack('C', 118) => '1110111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3989 pack('C', 119) => '1111000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3990 pack('C', 120) => '1111001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3991 pack('C', 121) => '1111010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3992 pack('C', 122) => '1111011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3993 pack('C', 123) => '111111111111110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3994 pack('C', 124) => '11111111100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3995 pack('C', 125) => '11111111111101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3996 pack('C', 126) => '1111111111101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3997 pack('C', 127) => '1111111111111111111111111100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3998 pack('C', 128) => '11111111111111100110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3999 pack('C', 129) => '1111111111111111010010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4000 pack('C', 130) => '11111111111111100111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4001 pack('C', 131) => '11111111111111101000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4002 pack('C', 132) => '1111111111111111010011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4003 pack('C', 133) => '1111111111111111010100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4004 pack('C', 134) => '1111111111111111010101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4005 pack('C', 135) => '11111111111111111011001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4006 pack('C', 136) => '1111111111111111010110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4007 pack('C', 137) => '11111111111111111011010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4008 pack('C', 138) => '11111111111111111011011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4009 pack('C', 139) => '11111111111111111011100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4010 pack('C', 140) => '11111111111111111011101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4011 pack('C', 141) => '11111111111111111011110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4012 pack('C', 142) => '111111111111111111101011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4013 pack('C', 143) => '11111111111111111011111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4014 pack('C', 144) => '111111111111111111101100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4015 pack('C', 145) => '111111111111111111101101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4016 pack('C', 146) => '1111111111111111010111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4017 pack('C', 147) => '11111111111111111100000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4018 pack('C', 148) => '111111111111111111101110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4019 pack('C', 149) => '11111111111111111100001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4020 pack('C', 150) => '11111111111111111100010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4021 pack('C', 151) => '11111111111111111100011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4022 pack('C', 152) => '11111111111111111100100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4023 pack('C', 153) => '111111111111111011100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4024 pack('C', 154) => '1111111111111111011000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4025 pack('C', 155) => '11111111111111111100101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4026 pack('C', 156) => '1111111111111111011001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4027 pack('C', 157) => '11111111111111111100110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4028 pack('C', 158) => '11111111111111111100111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4029 pack('C', 159) => '111111111111111111101111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4030 pack('C', 160) => '1111111111111111011010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4031 pack('C', 161) => '111111111111111011101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4032 pack('C', 162) => '11111111111111101001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4033 pack('C', 163) => '1111111111111111011011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4034 pack('C', 164) => '1111111111111111011100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4035 pack('C', 165) => '11111111111111111101000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4036 pack('C', 166) => '11111111111111111101001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4037 pack('C', 167) => '111111111111111011110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4038 pack('C', 168) => '11111111111111111101010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4039 pack('C', 169) => '1111111111111111011101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4040 pack('C', 170) => '1111111111111111011110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4041 pack('C', 171) => '111111111111111111110000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4042 pack('C', 172) => '111111111111111011111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4043 pack('C', 173) => '1111111111111111011111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4044 pack('C', 174) => '11111111111111111101011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4045 pack('C', 175) => '11111111111111111101100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4046 pack('C', 176) => '111111111111111100000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4047 pack('C', 177) => '111111111111111100001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4048 pack('C', 178) => '1111111111111111100000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4049 pack('C', 179) => '111111111111111100010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4050 pack('C', 180) => '11111111111111111101101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4051 pack('C', 181) => '1111111111111111100001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4052 pack('C', 182) => '11111111111111111101110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4053 pack('C', 183) => '11111111111111111101111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4054 pack('C', 184) => '11111111111111101010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4055 pack('C', 185) => '1111111111111111100010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4056 pack('C', 186) => '1111111111111111100011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4057 pack('C', 187) => '1111111111111111100100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4058 pack('C', 188) => '11111111111111111110000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4059 pack('C', 189) => '1111111111111111100101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4060 pack('C', 190) => '1111111111111111100110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4061 pack('C', 191) => '11111111111111111110001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4062 pack('C', 192) => '11111111111111111111100000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4063 pack('C', 193) => '11111111111111111111100001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4064 pack('C', 194) => '11111111111111101011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4065 pack('C', 195) => '1111111111111110001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4066 pack('C', 196) => '1111111111111111100111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4067 pack('C', 197) => '11111111111111111110010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4068 pack('C', 198) => '1111111111111111101000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4069 pack('C', 199) => '1111111111111111111101100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4070 pack('C', 200) => '11111111111111111111100010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4071 pack('C', 201) => '11111111111111111111100011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4072 pack('C', 202) => '11111111111111111111100100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4073 pack('C', 203) => '111111111111111111111011110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4074 pack('C', 204) => '111111111111111111111011111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4075 pack('C', 205) => '11111111111111111111100101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4076 pack('C', 206) => '111111111111111111110001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4077 pack('C', 207) => '1111111111111111111101101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4078 pack('C', 208) => '1111111111111110010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4079 pack('C', 209) => '111111111111111100011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4080 pack('C', 210) => '11111111111111111111100110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4081 pack('C', 211) => '111111111111111111111100000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4082 pack('C', 212) => '111111111111111111111100001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4083 pack('C', 213) => '11111111111111111111100111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4084 pack('C', 214) => '111111111111111111111100010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4085 pack('C', 215) => '111111111111111111110010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4086 pack('C', 216) => '111111111111111100100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4087 pack('C', 217) => '111111111111111100101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4088 pack('C', 218) => '11111111111111111111101000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4089 pack('C', 219) => '11111111111111111111101001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4090 pack('C', 220) => '1111111111111111111111111101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4091 pack('C', 221) => '111111111111111111111100011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4092 pack('C', 222) => '111111111111111111111100100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4093 pack('C', 223) => '111111111111111111111100101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4094 pack('C', 224) => '11111111111111101100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4095 pack('C', 225) => '111111111111111111110011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4096 pack('C', 226) => '11111111111111101101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4097 pack('C', 227) => '111111111111111100110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4098 pack('C', 228) => '1111111111111111101001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4099 pack('C', 229) => '111111111111111100111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4100 pack('C', 230) => '111111111111111101000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4101 pack('C', 231) => '11111111111111111110011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4102 pack('C', 232) => '1111111111111111101010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4103 pack('C', 233) => '1111111111111111101011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4104 pack('C', 234) => '1111111111111111111101110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4105 pack('C', 235) => '1111111111111111111101111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4106 pack('C', 236) => '111111111111111111110100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4107 pack('C', 237) => '111111111111111111110101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4108 pack('C', 238) => '11111111111111111111101010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4109 pack('C', 239) => '11111111111111111110100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4110 pack('C', 240) => '11111111111111111111101011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4111 pack('C', 241) => '111111111111111111111100110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4112 pack('C', 242) => '11111111111111111111101100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4113 pack('C', 243) => '11111111111111111111101101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4114 pack('C', 244) => '111111111111111111111100111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4115 pack('C', 245) => '111111111111111111111101000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4116 pack('C', 246) => '111111111111111111111101001',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4117 pack('C', 247) => '111111111111111111111101010',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4118 pack('C', 248) => '111111111111111111111101011',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4119 pack('C', 249) => '1111111111111111111111111110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4120 pack('C', 250) => '111111111111111111111101100',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4121 pack('C', 251) => '111111111111111111111101101',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4122 pack('C', 252) => '111111111111111111111101110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4123 pack('C', 253) => '111111111111111111111101111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4124 pack('C', 254) => '111111111111111111111110000',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4125 pack('C', 255) => '11111111111111111111101110',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4126 '_eos' => '111111111111111111111111111111',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4127 }};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4128
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4129 sub huff {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4130 my ($string) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4131 my $code = &huff_code;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4132
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4133 my $ret = join '', map { $code->{$_} } (split //, $string);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4134 my $len = length($ret) + (8 - length($ret) % 8);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4135 $ret .= $code->{_eos};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4136
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4137 return pack("B$len", $ret);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4138 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4139
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4140 sub dehuff {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4141 my ($string) = @_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4142 my $code = &huff_code;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4143 my %decode = reverse %$code;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4144
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4145 my $ret = ''; my $c = '';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4146 for (split //, unpack('B*', $string)) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4147 $c .= $_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4148 next unless exists $decode{$c};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4149 last if $decode{$c} eq '_eos';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4150
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4151 $ret .= $decode{$c};
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4152 $c = '';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4153 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4154
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4155 return $ret;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4156 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4157
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4158 ###############################################################################
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4159
762
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
4160 sub read_body_file {
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
4161 my ($path) = @_;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
4162 open FILE, $path or return "$!";
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
4163 local $/;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
4164 my $content = <FILE>;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
4165 close FILE;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
4166 return $content;
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
4167 }
f28debc81182 Tests: added HTTP/2 client_max_body_size tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 761
diff changeset
4168
647
4e36550410b3 Tests: h2.t fixes for older perl versions, and gzip test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 646
diff changeset
4169 sub gunzip_like {
4e36550410b3 Tests: h2.t fixes for older perl versions, and gzip test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 646
diff changeset
4170 my ($in, $re, $name) = @_;
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4171
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4172 SKIP: {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4173 eval { require IO::Uncompress::Gunzip; };
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4174 Test::More::skip(
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4175 "IO::Uncompress::Gunzip not installed", 1) if $@;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4176
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4177 my $out;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4178
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4179 IO::Uncompress::Gunzip::gunzip(\$in => \$out);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4180
647
4e36550410b3 Tests: h2.t fixes for older perl versions, and gzip test.
Sergey Kandaurov <pluknet@nginx.com>
parents: 646
diff changeset
4181 like($out, $re, $name);
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4182 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4183 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4184
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4185 ###############################################################################
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4186
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4187 # for tests with multiple header fields
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4188
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4189 sub http_daemon {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4190 my $server = IO::Socket::INET->new(
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4191 Proto => 'tcp',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4192 LocalHost => '127.0.0.1',
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4193 LocalPort => 8083,
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4194 Listen => 5,
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4195 Reuse => 1
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4196 )
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4197 or die "Can't create listening socket: $!\n";
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4198
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4199 local $SIG{PIPE} = 'IGNORE';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4200
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4201 while (my $client = $server->accept()) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4202 $client->autoflush(1);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4203
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4204 my $headers = '';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4205 my $uri = '';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4206
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4207 while (<$client>) {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4208 $headers .= $_;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4209 last if (/^\x0d?\x0a?$/);
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4210 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4211
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4212 next if $headers eq '';
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4213 $uri = $1 if $headers =~ /^\S+\s+([^ ]+)\s+HTTP/i;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4214
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4215 if ($uri eq '/cookie') {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4216
652
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
4217 my ($cookie, $cookie2) = $headers =~ /Cookie: (.+)/ig;
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
4218 $cookie2 = '' unless defined $cookie2;
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
4219
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
4220 my ($cookie_a, $cookie_c) = ('', '');
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
4221 $cookie_a = $1 if $headers =~ /X-Cookie-a: (.+)/i;
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
4222 $cookie_c = $1 if $headers =~ /X-Cookie-c: (.+)/i;
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
4223
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4224 print $client <<EOF;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4225 HTTP/1.1 200 OK
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4226 Connection: close
652
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
4227 X-Sent-Cookie: $cookie
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
4228 X-Sent-Cookie2: $cookie2
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
4229 X-Sent-Cookie-a: $cookie_a
5a85ad9382a3 Tests: more Cookie tests for HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents: 651
diff changeset
4230 X-Sent-Cookie-c: $cookie_c
646
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4231
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4232 EOF
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4233
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4234 } elsif ($uri eq '/set-cookie') {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4235
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4236 print $client <<EOF;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4237 HTTP/1.1 200 OK
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4238 Connection: close
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4239 Set-Cookie: a=b
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4240 Set-Cookie: c=d
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4241
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4242 EOF
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4243
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4244 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4245
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4246 } continue {
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4247 close $client;
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4248 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4249 }
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4250
843a74ff43bc Tests: HTTP/2 tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4251 ###############################################################################