comparison http_absolute_redirect.t @ 1937:2a0a6035a1af

Tests: removed TODO and try_run() checks for legacy versions.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 25 Aug 2023 18:12:08 +0400
parents c9b4c0ef5059
children
comparison
equal deleted inserted replaced
1936:716d7500317d 1937:2a0a6035a1af
114 114
115 like(get('on', '/dir'), qr!Location: http://on:$p/dir/\x0d?$!m, 'directory'); 115 like(get('on', '/dir'), qr!Location: http://on:$p/dir/\x0d?$!m, 'directory');
116 like(get('on', '/i/dir'), qr!Location: http://on:$p/i/dir/\x0d?$!m, 116 like(get('on', '/i/dir'), qr!Location: http://on:$p/i/dir/\x0d?$!m,
117 'directory alias'); 117 'directory alias');
118 118
119 TODO: {
120 local $TODO = 'not yet' unless $t->has_version('1.21.0');
121
122 like(get('on', '/dir%20sp'), qr!Location: http://on:$p/dir%20sp/\x0d?$!m, 119 like(get('on', '/dir%20sp'), qr!Location: http://on:$p/dir%20sp/\x0d?$!m,
123 'directory escaped'); 120 'directory escaped');
124 like(get('on', '/dir%20sp?a=b'), 121 like(get('on', '/dir%20sp?a=b'),
125 qr!Location: http://on:$p/dir%20sp/\?a=b\x0d?$!m, 122 qr!Location: http://on:$p/dir%20sp/\?a=b\x0d?$!m,
126 'directory escaped args'); 123 'directory escaped args');
127 124
128 }
129
130 like(get('on', '/auto'), qr!Location: http://on:$p/auto/\x0d?$!m, 'auto'); 125 like(get('on', '/auto'), qr!Location: http://on:$p/auto/\x0d?$!m, 'auto');
131 like(get('on', '/auto?a=b'), qr!Location: http://on:$p/auto/\?a=b\x0d?$!m, 126 like(get('on', '/auto?a=b'), qr!Location: http://on:$p/auto/\?a=b\x0d?$!m,
132 'auto args'); 127 'auto args');
133
134 TODO: {
135 local $TODO = 'not yet' unless $t->has_version('1.21.0');
136 128
137 like(get('on', '/auto%20sp'), qr!Location: http://on:$p/auto%20sp/\x0d?$!m, 129 like(get('on', '/auto%20sp'), qr!Location: http://on:$p/auto%20sp/\x0d?$!m,
138 'auto escaped'); 130 'auto escaped');
139 like(get('on', '/auto%20sp?a=b'), 131 like(get('on', '/auto%20sp?a=b'),
140 qr!Location: http://on:$p/auto%20sp/\?a=b\x0d?$!m, 132 qr!Location: http://on:$p/auto%20sp/\?a=b\x0d?$!m,
141 'auto escaped args'); 133 'auto escaped args');
142
143 }
144 134
145 like(get('on', '/return301'), qr!Location: http://on:$p/redirect\x0d?$!m, 135 like(get('on', '/return301'), qr!Location: http://on:$p/redirect\x0d?$!m,
146 'return'); 136 'return');
147 137
148 like(get('host', '/return301/name'), qr!Location: http://on:$p/redirect\x0d?!m, 138 like(get('host', '/return301/name'), qr!Location: http://on:$p/redirect\x0d?!m,
156 'port_in_redirect off'); 146 'port_in_redirect off');
157 147
158 like(get('off', '/dir'), qr!Location: /dir/\x0d?$!m, 'off directory'); 148 like(get('off', '/dir'), qr!Location: /dir/\x0d?$!m, 'off directory');
159 like(get('off', '/i/dir'), qr!Location: /i/dir/\x0d?$!m, 'off directory alias'); 149 like(get('off', '/i/dir'), qr!Location: /i/dir/\x0d?$!m, 'off directory alias');
160 150
161 TODO: {
162 local $TODO = 'not yet' unless $t->has_version('1.21.0');
163
164 like(get('off', '/dir%20sp'), qr!Location: /dir%20sp/\x0d?$!m, 151 like(get('off', '/dir%20sp'), qr!Location: /dir%20sp/\x0d?$!m,
165 'off directory escaped'); 152 'off directory escaped');
166 like(get('off', '/dir%20sp?a=b'), qr!Location: /dir%20sp/\?a=b\x0d?$!m, 153 like(get('off', '/dir%20sp?a=b'), qr!Location: /dir%20sp/\?a=b\x0d?$!m,
167 'off directory escaped args'); 154 'off directory escaped args');
168 155
169 }
170
171 like(get('off', '/auto'), qr!Location: /auto/\x0d?$!m, 'off auto'); 156 like(get('off', '/auto'), qr!Location: /auto/\x0d?$!m, 'off auto');
172 like(get('off', '/auto?a=b'), qr!Location: /auto/\?a=b\x0d?$!m, 157 like(get('off', '/auto?a=b'), qr!Location: /auto/\?a=b\x0d?$!m,
173 'off auto args'); 158 'off auto args');
174
175 TODO: {
176 local $TODO = 'not yet' unless $t->has_version('1.21.0');
177 159
178 like(get('off', '/auto%20sp'), qr!Location: /auto%20sp/\x0d?$!m, 160 like(get('off', '/auto%20sp'), qr!Location: /auto%20sp/\x0d?$!m,
179 'auto escaped'); 161 'auto escaped');
180 like(get('off', '/auto%20sp?a=b'), qr!Location: /auto%20sp/\?a=b\x0d?$!m, 162 like(get('off', '/auto%20sp?a=b'), qr!Location: /auto%20sp/\?a=b\x0d?$!m,
181 'auto escaped args'); 163 'auto escaped args');
182
183 }
184 164
185 like(get('off', '/return301'), qr!Location: /redirect\x0d?$!m, 'off return'); 165 like(get('off', '/return301'), qr!Location: /redirect\x0d?$!m, 'off return');
186 166
187 # per RFC 3986, these characters are not allowed unescaped: 167 # per RFC 3986, these characters are not allowed unescaped:
188 # %00-%1F, %7F-%FF, " ", """, "<", ">", "\", "^", "`", "{", "|", "}" 168 # %00-%1F, %7F-%FF, " ", """, "<", ">", "\", "^", "`", "{", "|", "}"
189 # additionally, all characters in ESCAPE_URI: "?", "%", "#" 169 # additionally, all characters in ESCAPE_URI: "?", "%", "#"
190 170
191 SKIP: { 171 SKIP: {
192 skip 'win32', 1 if $^O eq 'MSWin32'; 172 skip 'win32', 1 if $^O eq 'MSWin32';
193 173
194 TODO: {
195 local $TODO = 'not yet' unless $t->has_version('1.21.1');
196
197 like(get('off', '/auto%20%22%23%25%3C%3E%3F%5C%5E%60%7B%7C%7D'), 174 like(get('off', '/auto%20%22%23%25%3C%3E%3F%5C%5E%60%7B%7C%7D'),
198 qr!Location: /auto%20%22%23%25%3C%3E%3F%5C%5E%60%7B%7C%7D/\x0d?$!m, 175 qr!Location: /auto%20%22%23%25%3C%3E%3F%5C%5E%60%7B%7C%7D/\x0d?$!m,
199 'auto escaped strict'); 176 'auto escaped strict');
200
201 }
202 177
203 } 178 }
204 179
205 ############################################################################### 180 ###############################################################################
206 181