Mercurial > hg > nginx-tests
annotate h2_server_tokens.t @ 1990:85d88cd5091c
Tests: SSI include stub tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:42:55 +0300 |
parents | 11463d379570 |
children |
rev | line source |
---|---|
880
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
2 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
3 # (C) Andrey Zelenkov |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
5 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
6 # Tests for HTTP/2 protocol with server_tokens directive. |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
7 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
9 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
11 use strict; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
12 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
14 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
16 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
19 use Test::Nginx::HTTP2; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
20 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
21 ############################################################################### |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
22 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
23 select STDERR; $| = 1; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
24 select STDOUT; $| = 1; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
25 |
1900
236d038dc04a
Tests: suppress "listen .. http2;" deprecation warnings.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1859
diff
changeset
|
26 my $t = Test::Nginx->new()->has(qw/http http_v2 rewrite/)->plan(12) |
880
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
27 ->write_file_expand('nginx.conf', <<'EOF'); |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
28 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
29 %%TEST_GLOBALS%% |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
30 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
31 daemon off; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
32 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
33 events { |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
34 } |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
35 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
36 http { |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
37 %%TEST_GLOBALS_HTTP%% |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
38 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
39 server { |
1986
11463d379570
Tests: reworked HTTP/2 tests to use "http2 on".
Maxim Dounin <mdounin@mdounin.ru>
parents:
1948
diff
changeset
|
40 listen 127.0.0.1:8080; |
880
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
41 server_name localhost; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
42 |
1986
11463d379570
Tests: reworked HTTP/2 tests to use "http2 on".
Maxim Dounin <mdounin@mdounin.ru>
parents:
1948
diff
changeset
|
43 http2 on; |
11463d379570
Tests: reworked HTTP/2 tests to use "http2 on".
Maxim Dounin <mdounin@mdounin.ru>
parents:
1948
diff
changeset
|
44 |
880
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
45 location /200 { |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
46 return 200; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
47 } |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
48 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
49 location /404 { |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
50 return 404; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
51 } |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
52 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
53 location /off { |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
54 server_tokens off; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
55 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
56 location /off/200 { |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
57 return 200; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
58 } |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
59 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
60 location /off/404 { |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
61 return 404; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
62 } |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
63 } |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
64 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
65 location /on { |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
66 server_tokens on; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
67 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
68 location /on/200 { |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
69 return 200; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
70 } |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
71 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
72 location /on/404 { |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
73 return 404; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
74 } |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
75 } |
1121
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
76 |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
77 location /b { |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
78 server_tokens build; |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
79 |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
80 location /b/200 { |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
81 return 200; |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
82 } |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
83 |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
84 location /b/404 { |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
85 return 404; |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
86 } |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
87 } |
880
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
88 } |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
89 } |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
90 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
91 EOF |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
92 |
1900
236d038dc04a
Tests: suppress "listen .. http2;" deprecation warnings.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1859
diff
changeset
|
93 $t->run(); |
880
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
94 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
95 ############################################################################### |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
96 |
1948
78452573505c
Tests: improved server tokens tests to accept alternative names.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
97 my $re = qr/\w+\/\d+\.\d+\.\d+/; |
1120
a6ffc722dfcb
Tests: refactored server_tokens tests, no functional changes.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
98 |
a6ffc722dfcb
Tests: refactored server_tokens tests, no functional changes.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
99 like(header_server('/200'), qr/^$re$/, 'http2 tokens default 200'); |
a6ffc722dfcb
Tests: refactored server_tokens tests, no functional changes.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
100 like(header_server('/404'), qr/^$re$/, 'http2 tokens default 404'); |
a6ffc722dfcb
Tests: refactored server_tokens tests, no functional changes.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
101 like(body('/404'), qr/$re/, 'http2 tokens default 404 body'); |
880
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
102 |
1948
78452573505c
Tests: improved server tokens tests to accept alternative names.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
103 like(header_server('/off/200'), qr/^\w+$/, 'http2 tokens off 200'); |
78452573505c
Tests: improved server tokens tests to accept alternative names.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
104 like(header_server('/off/404'), qr/^\w+$/, 'http2 tokens off 404'); |
78452573505c
Tests: improved server tokens tests to accept alternative names.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
105 unlike(body('/off/404'), $re, 'http2 tokens off 404 body'); |
880
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
106 |
1120
a6ffc722dfcb
Tests: refactored server_tokens tests, no functional changes.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
107 like(header_server('/on/200'), qr/^$re$/, 'http2 tokens on 200'); |
a6ffc722dfcb
Tests: refactored server_tokens tests, no functional changes.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
108 like(header_server('/on/404'), qr/^$re$/, 'http2 tokens on 404'); |
a6ffc722dfcb
Tests: refactored server_tokens tests, no functional changes.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
109 like(body('/on/404'), $re, 'http2 tokens on 404 body'); |
880
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
110 |
1859
5f46af4707e7
Tests: fixed server_tokens tests for build names with spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1251
diff
changeset
|
111 $re = qr/$re \(.*\)/ if $t->has_module('--build='); |
1121
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
112 |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
113 like(header_server('/b/200'), qr/^$re$/, 'http2 tokens build 200'); |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
114 like(header_server('/b/404'), qr/^$re$/, 'http2 tokens build 404'); |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
115 like(body('/b/404'), qr/$re/, 'http2 tokens build 404 body'); |
c883d3d3a3ab
Tests: server_tokens build tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1120
diff
changeset
|
116 |
880
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
117 ############################################################################### |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
118 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
119 sub header_server { |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
120 my ($path) = shift; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
121 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
880
diff
changeset
|
122 my $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
880
diff
changeset
|
123 my $sid = $s->new_stream({ path => $path }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
880
diff
changeset
|
124 my $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
880
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
125 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
126 my ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
127 return $frame->{headers}->{'server'}; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
128 } |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
129 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
130 sub body { |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
131 my ($path) = shift; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
132 |
948
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
880
diff
changeset
|
133 my $s = Test::Nginx::HTTP2->new(); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
880
diff
changeset
|
134 my $sid = $s->new_stream({ path => $path }); |
4dc302d8e04f
Tests: changed HTTP2 package to act as a class.
Sergey Kandaurov <pluknet@nginx.com>
parents:
880
diff
changeset
|
135 my $frames = $s->read(all => [{ sid => $sid, fin => 1 }]); |
880
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
136 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
137 my ($frame) = grep { $_->{type} eq "DATA" } @$frames; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
138 return $frame->{'data'}; |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
139 } |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
140 |
697fc80b8606
Tests: added HTTP/2 tests for server_tokens directive.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
141 ############################################################################### |