@@ -50,6 +50,13 @@ http {
50
50
sendfile_max_chunk 4k;
51
51
}
52
52
53
+ location /escape {
54
+ proxy_pass http://127.0.0.1:8081;
55
+ proxy_cache NAME;
56
+ proxy_cache_background_update on;
57
+ add_header X-Cache-Status $upstream_cache_status;
58
+ }
59
+
53
60
location / {
54
61
proxy_pass http://127.0.0.1:8081;
55
62
@@ -134,8 +141,10 @@ $t->write_file('t6.html', 'SEE-THIS');
134
141
$t -> write_file(' t7.html' , ' SEE-THIS' x 1024 );
135
142
$t -> write_file(' t9.html' , ' SEE-THIS' x 1024 );
136
143
$t -> write_file(' ssi.html' , ' xxx <!--#include virtual="/t9.html" --> xxx' );
144
+ $t -> write_file(' escape.html' , ' SEE-THIS' );
145
+ $t -> write_file(' escape html' , ' SEE-THIS' );
137
146
138
- $t -> run()-> plan(29 );
147
+ $t -> run()-> plan(33 );
139
148
140
149
# ##############################################################################
141
150
@@ -156,6 +165,8 @@ http_get('/ssi.html');
156
165
get(' /updating/t.html' , ' max-age=1' );
157
166
get(' /updating/t2.html' , ' max-age=1, stale-while-revalidate=2' );
158
167
get(' /t8.html' , ' stale-while-revalidate=10' );
168
+ get(' /escape.htm%6C' , ' max-age=1, stale-while-revalidate=10' );
169
+ get(' /escape html' , ' max-age=1, stale-while-revalidate=10' );
159
170
160
171
sleep 2;
161
172
@@ -236,6 +247,25 @@ $t->todo_alerts() if $t->read_file('nginx.conf') =~ /aio_write on/
236
247
like(http_get(' /t2.html?if=1' ), qr / STALE/ , ' background update in if' );
237
248
like(http_get(' /t2.html?if=1' ), qr / HIT/ , ' background update in if - updated' );
238
249
250
+ # ticket #1430, uri escaping in cloned subrequests
251
+
252
+ $t -> write_file(' escape.html' , ' SEE-THAT' );
253
+ $t -> write_file(' escape html' , ' SEE-THAT' );
254
+
255
+ get(' /escape.htm%6C' , ' max-age=1' );
256
+ get(' /escape html' , ' max-age=1' );
257
+
258
+ TODO: {
259
+ local $TODO = ' not yet' unless $t -> has_version(' 1.13.8' );
260
+
261
+ like(http_get(' /escape.htm%6C' ), qr / HIT/ , ' escaped after escaped' );
262
+ like(http_get(' /escape.html' ), qr / MISS/ , ' unescaped after escaped' );
263
+ like(http_get(' /escape html' ), qr / HIT/ , ' space after escaped space' );
264
+
265
+ }
266
+
267
+ like(http_get(' /escape%20html' ), qr / HIT/ , ' escaped space after escaped space' );
268
+
239
269
# ##############################################################################
240
270
241
271
sub get {
0 commit comments