Mercurial > hg > nginx-tests
comparison ignore_invalid_headers.t @ 1715:3604ef83c1aa
Tests: added header name tests with forbidden characters.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 29 Jun 2021 12:00:07 +0300 |
parents | 5ac6efbe5552 |
children | 2a0a6035a1af |
comparison
equal
deleted
inserted
replaced
1714:e4e711d07e6c | 1715:3604ef83c1aa |
---|---|
23 ############################################################################### | 23 ############################################################################### |
24 | 24 |
25 select STDERR; $| = 1; | 25 select STDERR; $| = 1; |
26 select STDOUT; $| = 1; | 26 select STDOUT; $| = 1; |
27 | 27 |
28 my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(9) | 28 my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(12) |
29 ->write_file_expand('nginx.conf', <<'EOF'); | 29 ->write_file_expand('nginx.conf', <<'EOF'); |
30 | 30 |
31 %%TEST_GLOBALS%% | 31 %%TEST_GLOBALS%% |
32 | 32 |
33 daemon off; | 33 daemon off; |
114 # ignore_invalid_headers on; underscores_in_headers on; | 114 # ignore_invalid_headers on; underscores_in_headers on; |
115 | 115 |
116 like(get($us, 8082), qr/x-bar/, 'underscores_in_headers'); | 116 like(get($us, 8082), qr/x-bar/, 'underscores_in_headers'); |
117 like(get($us2, 8082), qr/x-bar/, 'underscores_in_headers - first'); | 117 like(get($us2, 8082), qr/x-bar/, 'underscores_in_headers - first'); |
118 | 118 |
119 # always invalid header characters | |
120 | |
121 my $bad3 = 'GET / HTTP/1.0' . CRLF | |
122 . ':foo: x-bar' . CRLF . CRLF; | |
123 my $bad4 = 'GET / HTTP/1.0' . CRLF | |
124 . ' foo: x-bar' . CRLF . CRLF; | |
125 my $bad5 = 'GET / HTTP/1.0' . CRLF | |
126 . "foo\x02: x-bar" . CRLF . CRLF; | |
127 | |
128 TODO: { | |
129 local $TODO = 'not yet' unless $t->has_version('1.21.1'); | |
130 | |
131 like(http($bad3), qr/400 Bad/, 'colon first'); | |
132 like(http($bad4), qr/400 Bad/, 'space'); | |
133 like(http($bad5), qr/400 Bad/, 'control'); | |
134 | |
135 } | |
136 | |
119 ############################################################################### | 137 ############################################################################### |
120 | 138 |
121 sub get { | 139 sub get { |
122 my ($msg, $port) = @_; | 140 my ($msg, $port) = @_; |
123 | 141 |