33# (C) Sergey Kandaurov
44# (C) Nginx, Inc.
55
6- # Test for msie_refresh in subrequests .
6+ # Test for msie_refresh.
77
88# ##############################################################################
99
@@ -22,7 +22,7 @@ use Test::Nginx;
2222select STDERR ; $| = 1;
2323select STDOUT ; $| = 1;
2424
25- my $t = Test::Nginx-> new()-> has(qw/ http rewrite ssi/ )-> plan(1 )
25+ my $t = Test::Nginx-> new()-> has(qw/ http rewrite ssi/ )-> plan(5 )
2626 -> write_file_expand(' nginx.conf' , <<'EOF' );
2727
2828%%TEST_GLOBALS%%
@@ -39,25 +39,46 @@ http {
3939 listen 127.0.0.1:8080;
4040 server_name localhost;
4141
42+ msie_refresh on;
43+
4244 location / {
43- ssi on ;
45+ return 301 text ;
4446 }
45- location /ssi {
46- msie_refresh on;
47+
48+ location /space {
49+ return 301 "space ";
50+ }
51+
52+ location /error_page {
4753 return 301;
54+ error_page 301 text;
55+ }
56+
57+ location /off {
58+ msie_refresh off;
59+ return 301 text;
60+ }
61+
62+ location /ssi {
63+ ssi on;
4864 }
4965 }
5066}
5167
5268EOF
5369
54- $t -> write_file(' index .html' , ' X<!--#include virtual="/ssi.html " -->X' );
70+ $t -> write_file(' ssi .html' , ' X<!--#include virtual="/" -->X' );
5571$t -> run();
5672
5773# ##############################################################################
5874
59- my $r = get(' /' , ' User-Agent: MSIE foo' );
60- unlike($r , qr /\x0d\x0a ?0\x0d\x0a ?\x0d\x0a ?\w / , ' only final chunk' );
75+ like(get(' /' ), qr / Refresh.*URL=text"/ , ' msie refresh' );
76+ like(get(' /space' ), qr / URL=space%20"/ , ' msie refresh escaped url' );
77+ like(get(' /error_page' ), qr / URL=text"/ , ' msie refresh error page' );
78+
79+ unlike(get(' /off' ), qr / Refresh/ , ' msie refresh disabled' );
80+
81+ unlike(get(' /ssi.html' ), qr / ^0\x0d\x0a ?\x0d\x0a ?\w / m , ' only final chunk' );
6182
6283# ##############################################################################
6384
@@ -67,7 +88,7 @@ sub get {
6788GET $url HTTP/1.1
6889Host: localhost
6990Connection: close
70- $extra
91+ User-Agent: MSIE foo
7192
7293EOF
7394}
0 commit comments