Mercurial > hg > nginx-tests
comparison perl.t @ 1767:d7e019157cd7
Tests: perl $r->header_in("Connection") test.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 30 May 2022 21:33:05 +0300 |
parents | 5ac6efbe5552 |
children | fb88778d4580 |
comparison
equal
deleted
inserted
replaced
1766:a2572de6e840 | 1767:d7e019157cd7 |
---|---|
21 ############################################################################### | 21 ############################################################################### |
22 | 22 |
23 select STDERR; $| = 1; | 23 select STDERR; $| = 1; |
24 select STDOUT; $| = 1; | 24 select STDOUT; $| = 1; |
25 | 25 |
26 my $t = Test::Nginx->new()->has(qw/http perl rewrite/)->plan(24) | 26 my $t = Test::Nginx->new()->has(qw/http perl rewrite/)->plan(25) |
27 ->write_file_expand('nginx.conf', <<'EOF'); | 27 ->write_file_expand('nginx.conf', <<'EOF'); |
28 | 28 |
29 %%TEST_GLOBALS%% | 29 %%TEST_GLOBALS%% |
30 | 30 |
31 daemon off; | 31 daemon off; |
60 | 60 |
61 $r->print("host: ", $r->header_in("Host"), "\n"); | 61 $r->print("host: ", $r->header_in("Host"), "\n"); |
62 $r->print("xfoo: ", $r->header_in("X-Foo"), "\n"); | 62 $r->print("xfoo: ", $r->header_in("X-Foo"), "\n"); |
63 $r->print("cookie: ", $r->header_in("Cookie"), "\n"); | 63 $r->print("cookie: ", $r->header_in("Cookie"), "\n"); |
64 $r->print("xff: ", $r->header_in("X-Forwarded-For"), "\n"); | 64 $r->print("xff: ", $r->header_in("X-Forwarded-For"), "\n"); |
65 $r->print("connection: ", $r->header_in("Connection"), "\n"); | |
65 | 66 |
66 return OK; | 67 return OK; |
67 }'; | 68 }'; |
68 } | 69 } |
69 | 70 |
176 . 'X-Forwarded-For: foo1' . CRLF | 177 . 'X-Forwarded-For: foo1' . CRLF |
177 . 'X-Forwarded-For: foo2' . CRLF | 178 . 'X-Forwarded-For: foo2' . CRLF |
178 . 'Host: localhost' . CRLF . CRLF | 179 . 'Host: localhost' . CRLF . CRLF |
179 ), qr/xff: foo1, foo2/, 'perl header_in xff2'); | 180 ), qr/xff: foo1, foo2/, 'perl header_in xff2'); |
180 | 181 |
182 TODO: { | |
183 local $TODO = 'not yet' unless $t->has_version('1.23.0'); | |
184 | |
185 like(http( | |
186 'GET / HTTP/1.0' . CRLF | |
187 . 'Connection: close' . CRLF | |
188 . 'Host: localhost' . CRLF . CRLF | |
189 ), qr/connection: close/, 'perl header_in connection'); | |
190 | |
191 } | |
192 | |
181 # headers_out content-length tests with range filter | 193 # headers_out content-length tests with range filter |
182 | 194 |
183 like(http_get('/range'), qr/Content-Length: 42.*^x{42}$/ms, | 195 like(http_get('/range'), qr/Content-Length: 42.*^x{42}$/ms, |
184 'perl header_out content-length'); | 196 'perl header_out content-length'); |
185 | 197 |