Mercurial > hg > nginx-tests
comparison proxy_xar.t @ 366:77c301be6c2d
Tests: preparations for escaped and unsafe URI tests.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 25 Dec 2013 12:03:39 +0400 |
parents | 6a0d934950bc |
children | 0726521e42f3 |
comparison
equal
deleted
inserted
replaced
365:81fed52bfca5 | 366:77c301be6c2d |
---|---|
37 | 37 |
38 server { | 38 server { |
39 listen 127.0.0.1:8080; | 39 listen 127.0.0.1:8080; |
40 server_name localhost; | 40 server_name localhost; |
41 | 41 |
42 # catch safe and unhandled unsafe URIs | |
43 if ($upstream_http_x_accel_redirect) { | |
44 return 200 "xar: $upstream_http_x_accel_redirect uri: $uri"; | |
45 } | |
46 | |
42 location /proxy { | 47 location /proxy { |
43 proxy_pass http://127.0.0.1:8080/return-xar; | 48 proxy_pass http://127.0.0.1:8080/return-xar; |
44 } | 49 } |
45 location /return-xar { | 50 location /return-xar { |
46 add_header X-Accel-Redirect /index.html; | 51 add_header X-Accel-Redirect $arg_xar; |
47 | 52 |
48 # this headers will be preserved on | 53 # this headers will be preserved on |
49 # X-Accel-Redirect | 54 # X-Accel-Redirect |
50 | 55 |
51 add_header Content-Type text/blah; | 56 add_header Content-Type text/blah; |
63 } | 68 } |
64 } | 69 } |
65 | 70 |
66 EOF | 71 EOF |
67 | 72 |
68 $t->write_file('index.html', 'SEE-THIS'); | |
69 $t->run(); | 73 $t->run(); |
70 | 74 |
71 ############################################################################### | 75 ############################################################################### |
72 | 76 |
73 my $r = http_get('/proxy'); | 77 my $r = http_get('/proxy?xar=/index.html'); |
74 like($r, qr/SEE-THIS/, 'X-Accel-Redirect works'); | 78 like($r, qr/xar: \/index.html uri: \/index.html/, 'X-Accel-Redirect works'); |
75 like($r, qr/^Content-Type: text\/blah/m, 'Content-Type preserved'); | 79 like($r, qr/^Content-Type: text\/blah/m, 'Content-Type preserved'); |
76 like($r, qr/^Set-Cookie: blah=blah/m, 'Set-Cookie preserved'); | 80 like($r, qr/^Set-Cookie: blah=blah/m, 'Set-Cookie preserved'); |
77 like($r, qr/^Content-Disposition: attachment/m, 'Content-Disposition preserved'); | 81 like($r, qr/^Content-Disposition: attachment/m, 'Content-Disposition preserved'); |
78 like($r, qr/^Cache-Control: no-cache/m, 'Cache-Control preserved'); | 82 like($r, qr/^Cache-Control: no-cache/m, 'Cache-Control preserved'); |
79 like($r, qr/^Expires: fake/m, 'Expires preserved'); | 83 like($r, qr/^Expires: fake/m, 'Expires preserved'); |