Mercurial > hg > nginx-tests
comparison auth_request_set.t @ 323:d48de852157c
Tests: auth_request assorted fixes.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 21 Aug 2013 19:56:00 +0400 |
parents | 67c348ba1768 |
children | e9064d691790 |
comparison
equal
deleted
inserted
replaced
322:67c348ba1768 | 323:d48de852157c |
---|---|
6 | 6 |
7 ############################################################################### | 7 ############################################################################### |
8 | 8 |
9 use warnings; | 9 use warnings; |
10 use strict; | 10 use strict; |
11 | |
12 use Socket qw/ CRLF /; | |
13 | 11 |
14 use Test::More; | 12 use Test::More; |
15 | 13 |
16 BEGIN { use FindBin; chdir($FindBin::Bin); } | 14 BEGIN { use FindBin; chdir($FindBin::Bin); } |
17 | 15 |
21 ############################################################################### | 19 ############################################################################### |
22 | 20 |
23 select STDERR; $| = 1; | 21 select STDERR; $| = 1; |
24 select STDOUT; $| = 1; | 22 select STDOUT; $| = 1; |
25 | 23 |
26 my $t = Test::Nginx->new()->has(qw/http rewrite auth_request/) | 24 my $t = Test::Nginx->new()->has(qw/http rewrite proxy auth_request/) |
27 ->plan(6); | 25 ->plan(6); |
28 | 26 |
29 $t->write_file_expand('nginx.conf', <<'EOF'); | 27 $t->write_file_expand('nginx.conf', <<'EOF'); |
30 | 28 |
31 %%TEST_GLOBALS%% | 29 %%TEST_GLOBALS%% |
32 | 30 |
33 master_process off; | 31 daemon off; |
34 daemon off; | |
35 | 32 |
36 events { | 33 events { |
37 } | 34 } |
38 | 35 |
39 http { | 36 http { |
131 like(http_get('/t1.html'), qr/X-Set-Username: username/, 'set normal'); | 128 like(http_get('/t1.html'), qr/X-Set-Username: username/, 'set normal'); |
132 like(http_get('/t2.html'), qr/X-Set-Username: username/, 'set after redirect'); | 129 like(http_get('/t2.html'), qr/X-Set-Username: username/, 'set after redirect'); |
133 like(http_get('/t3.html'), qr/X-Set-Username: username/, | 130 like(http_get('/t3.html'), qr/X-Set-Username: username/, |
134 'set after named location'); | 131 'set after named location'); |
135 like(http_get('/t4.html'), qr/X-Set-Username: username2/, | 132 like(http_get('/t4.html'), qr/X-Set-Username: username2/, |
136 'set on second auth'); | 133 'set on second auth'); |
137 | 134 |
138 # there are two variables with set_handler: $args and $limit_rate | 135 # there are two variables with set_handler: $args and $limit_rate |
139 # we do test $args as it's a bit more simple thing to do | 136 # we do test $args as it's a bit more simple thing to do |
140 | 137 |
141 like(http_get('/t5.html'), qr/X-Args: setargs/, 'variable with set_handler'); | 138 like(http_get('/t5.html'), qr/X-Args: setargs/, 'variable with set_handler'); |