comparison http_variables.t @ 1569:cd6abbe0f989

Tests: added generic tests for $arg_ variables.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 08 May 2020 19:45:18 +0300
parents 4bc1490cedbc
children 5ac6efbe5552
comparison
equal deleted inserted replaced
1568:4cc012205ac5 1569:cd6abbe0f989
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 proxy/)->plan(6); 25 my $t = Test::Nginx->new()->has(qw/http rewrite proxy/)->plan(7);
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
44 44
45 access_log %%TESTDIR%%/cc.log cc; 45 access_log %%TESTDIR%%/cc.log cc;
46 46
47 location / { 47 location / {
48 return 200 OK; 48 return 200 OK;
49 }
50
51 location /arg {
52 return 200 $arg_l:$arg_;
49 } 53 }
50 54
51 location /set { 55 location /set {
52 add_header Cache-Control max-age=3600; 56 add_header Cache-Control max-age=3600;
53 add_header Cache-Control private; 57 add_header Cache-Control private;
76 80
77 http_get('/'); 81 http_get('/');
78 http_get('/../bad_uri'); 82 http_get('/../bad_uri');
79 http_get('/redefine'); 83 http_get('/redefine');
80 84
85 TODO: {
86 todo_skip 'overflow', 1 unless $ENV{TEST_NGINX_UNSAFE}
87 or $t->has_version('1.19.0');
88
89 like(http_get('/arg?l=42'), qr/42:$/, 'arg');
90
91 }
92
81 # $limit_rate is a special variable that has its own set_handler / get_handler 93 # $limit_rate is a special variable that has its own set_handler / get_handler
82 94
83 like(http_get('/limit_rate?l=40k'), qr/X-Rate: 40960/, 'limit_rate handlers'); 95 like(http_get('/limit_rate?l=40k'), qr/X-Rate: 40960/, 'limit_rate handlers');
84 like(http_get('/limit_rate'), qr/X-Rate: 0/, 'limit_rate invalid'); 96 like(http_get('/limit_rate'), qr/X-Rate: 0/, 'limit_rate invalid');
85 97