Mercurial > hg > nginx-tests
comparison http_absolute_redirect.t @ 1150:ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 21 Mar 2017 15:42:21 +0300 |
parents | 71bba21ea3ed |
children | 818fbc9d1c29 |
comparison
equal
deleted
inserted
replaced
1149:b1c2857d2e97 | 1150:ccf134a800ae |
---|---|
50 } | 50 } |
51 | 51 |
52 location /return301 { | 52 location /return301 { |
53 return 301 /redirect; | 53 return 301 /redirect; |
54 } | 54 } |
55 | |
56 location /i/ { | |
57 alias %%TESTDIR%%/; | |
58 } | |
55 } | 59 } |
56 | 60 |
57 server { | 61 server { |
58 listen 127.0.0.1:8080; | 62 listen 127.0.0.1:8080; |
59 server_name off; | 63 server_name off; |
65 } | 69 } |
66 | 70 |
67 location /return301 { | 71 location /return301 { |
68 return 301 /redirect; | 72 return 301 /redirect; |
69 } | 73 } |
74 | |
75 location /i/ { | |
76 alias %%TESTDIR%%/; | |
77 } | |
70 } | 78 } |
71 } | 79 } |
72 | 80 |
73 EOF | 81 EOF |
74 | 82 |
75 mkdir($t->testdir() . '/dir'); | 83 mkdir($t->testdir() . '/dir'); |
76 | 84 |
77 $t->try_run('no absolute_redirect')->plan(6); | 85 $t->try_run('no absolute_redirect')->plan(8); |
78 | 86 |
79 ############################################################################### | 87 ############################################################################### |
80 | 88 |
81 my $p = port(8080); | 89 my $p = port(8080); |
82 | 90 |
83 like(get('on', '/dir'), qr!Location: http://on:$p/dir/!, 'directory'); | 91 like(get('on', '/dir'), qr!Location: http://on:$p/dir/!, 'directory'); |
92 like(get('on', '/i/dir'), qr!Location: http://on:$p/i/dir/!, 'directory alias'); | |
84 like(get('on', '/auto'), qr!Location: http://on:$p/auto/!, 'auto'); | 93 like(get('on', '/auto'), qr!Location: http://on:$p/auto/!, 'auto'); |
85 like(get('on', '/return301'), qr!Location: http://on:$p/redirect!, 'return'); | 94 like(get('on', '/return301'), qr!Location: http://on:$p/redirect!, 'return'); |
86 | 95 |
87 like(get('off', '/dir'), qr!Location: /dir/!, 'off directory'); | 96 like(get('off', '/dir'), qr!Location: /dir/!, 'off directory'); |
97 like(get('off', '/i/dir'), qr!Location: /i/dir/!, 'off directory alias'); | |
88 like(get('off', '/auto'), qr!Location: /auto/!, 'off auto'); | 98 like(get('off', '/auto'), qr!Location: /auto/!, 'off auto'); |
89 like(get('off', '/return301'), qr!Location: /redirect!, 'off return'); | 99 like(get('off', '/return301'), qr!Location: /redirect!, 'off return'); |
90 | 100 |
91 ############################################################################### | 101 ############################################################################### |
92 | 102 |