Mercurial > hg > nginx-tests
comparison http_host.t @ 1716:c48b2b0b8c2a
Tests: added Host header test with control character.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 29 Jun 2021 12:00:41 +0300 |
parents | 5ac6efbe5552 |
children | 2a0a6035a1af |
comparison
equal
deleted
inserted
replaced
1715:3604ef83c1aa | 1716:c48b2b0b8c2a |
---|---|
20 ############################################################################### | 20 ############################################################################### |
21 | 21 |
22 select STDERR; $| = 1; | 22 select STDERR; $| = 1; |
23 select STDOUT; $| = 1; | 23 select STDOUT; $| = 1; |
24 | 24 |
25 my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(36); | 25 my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(37); |
26 | 26 |
27 $t->write_file_expand('nginx.conf', <<'EOF'); | 27 $t->write_file_expand('nginx.conf', <<'EOF'); |
28 | 28 |
29 %%TEST_GLOBALS%% | 29 %%TEST_GLOBALS%% |
30 | 30 |
169 is(http_host_header('123.40.56.78:9000:80'), '123.40.56.78', | 169 is(http_host_header('123.40.56.78:9000:80'), '123.40.56.78', |
170 'double port hack'); | 170 'double port hack'); |
171 | 171 |
172 like(http_host_header("localhost\nHost: again", 1), qr/ 400 /, 'host repeat'); | 172 like(http_host_header("localhost\nHost: again", 1), qr/ 400 /, 'host repeat'); |
173 | 173 |
174 TODO: { | |
175 local $TODO = 'not yet' unless $t->has_version('1.21.1'); | |
176 | |
177 like(http_host_header("localhost\x02", 1), qr/ 400 /, 'control'); | |
178 | |
179 } | |
180 | |
174 ############################################################################### | 181 ############################################################################### |
175 | 182 |
176 sub http_host_header { | 183 sub http_host_header { |
177 my ($host, $all) = @_; | 184 my ($host, $all) = @_; |
178 my ($r) = http(<<EOF); | 185 my ($r) = http(<<EOF); |