3
3
# (C) Sergey Kandaurov
4
4
# (C) Nginx, Inc.
5
5
6
- # Test for msie_refresh in subrequests .
6
+ # Test for msie_refresh.
7
7
8
8
# ##############################################################################
9
9
@@ -22,7 +22,7 @@ use Test::Nginx;
22
22
select STDERR ; $| = 1;
23
23
select STDOUT ; $| = 1;
24
24
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 )
26
26
-> write_file_expand(' nginx.conf' , <<'EOF' );
27
27
28
28
%%TEST_GLOBALS%%
@@ -39,25 +39,46 @@ http {
39
39
listen 127.0.0.1:8080;
40
40
server_name localhost;
41
41
42
+ msie_refresh on;
43
+
42
44
location / {
43
- ssi on ;
45
+ return 301 text ;
44
46
}
45
- location /ssi {
46
- msie_refresh on;
47
+
48
+ location /space {
49
+ return 301 "space ";
50
+ }
51
+
52
+ location /error_page {
47
53
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;
48
64
}
49
65
}
50
66
}
51
67
52
68
EOF
53
69
54
- $t -> write_file(' index .html' , ' X<!--#include virtual="/ssi.html " -->X' );
70
+ $t -> write_file(' ssi .html' , ' X<!--#include virtual="/" -->X' );
55
71
$t -> run();
56
72
57
73
# ##############################################################################
58
74
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' );
61
82
62
83
# ##############################################################################
63
84
@@ -67,7 +88,7 @@ sub get {
67
88
GET $url HTTP/1.1
68
89
Host: localhost
69
90
Connection: close
70
- $extra
91
+ User-Agent: MSIE foo
71
92
72
93
EOF
73
94
}
0 commit comments