comparison proxy_redirect.t @ 196:3f59e6a843bd

Tests: proxy_redirect off inheritance.
author Valentin Bartenev <ne@vbart.ru>
date Fri, 27 Jan 2012 20:30:22 +0400
parents 50063559d85a
children ba992cfdc606
comparison
equal deleted inserted replaced
195:d73ab4b6ef4a 196:3f59e6a843bd
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 proxy rewrite/)->plan(12); 25 my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(15);
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
59 } 59 }
60 60
61 location /impl_default/ { 61 location /impl_default/ {
62 proxy_pass http://127.0.0.1:8081/replace_this/; 62 proxy_pass http://127.0.0.1:8081/replace_this/;
63 } 63 }
64
65 location /off/ {
66 proxy_pass http://127.0.0.1:8081/;
67 proxy_redirect off;
68
69 location /off/on/ {
70 proxy_pass http://127.0.0.1:8081;
71 proxy_redirect http://127.0.0.1:8081/off/ /;
72
73 location /off/on/on/ {
74 proxy_pass http://127.0.0.1:8081;
75 }
76 }
77 }
64 } 78 }
65 79
66 server { 80 server {
67 listen 127.0.0.1:8081; 81 listen 127.0.0.1:8081;
68 server_name localhost; 82 server_name localhost;
93 107
94 is(http_get_location('http://127.0.0.1:8080/var_in_second/test.html'), 108 is(http_get_location('http://127.0.0.1:8080/var_in_second/test.html'),
95 'http://127.0.0.1:8080/var_here/test.html', 'variable in second arg'); 109 'http://127.0.0.1:8080/var_here/test.html', 'variable in second arg');
96 is(http_get_refresh('http://127.0.0.1:8080/var_in_second/test.html'), 110 is(http_get_refresh('http://127.0.0.1:8080/var_in_second/test.html'),
97 '7; url=/var_here/test.html', 'variable in second arg (refresh)'); 111 '7; url=/var_here/test.html', 'variable in second arg (refresh)');
112
113 is(http_get_location('http://127.0.0.1:8080/off/test.html'),
114 'http://127.0.0.1:8081/test.html', 'rewrite off');
115 is(http_get_location('http://127.0.0.1:8080/off/on/test.html'),
116 'http://127.0.0.1:8080/on/test.html', 'rewrite off overwrite');
117
118 TODO: {
119 local $TODO = 'rewrite off inheritance bug';
120
121 is(http_get_location('http://127.0.0.1:8080/off/on/on/test.html'),
122 'http://127.0.0.1:8080/on/on/test.html', 'rewrite inheritance');
123
124 }
98 125
99 TODO: { 126 TODO: {
100 local $TODO = 'support variables in first argument'; 127 local $TODO = 'support variables in first argument';
101 128
102 is(http_get_location('http://127.0.0.1:8080/var_here/test.html'), 129 is(http_get_location('http://127.0.0.1:8080/var_here/test.html'),