Mercurial > hg > nginx-tests
comparison referer.t @ 397:847ea345becb
Tests: removed TODO and try_run() checks for legacy versions.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 05 May 2014 11:46:01 +0400 |
parents | 290d539efcb4 |
children | e9064d691790 |
comparison
equal
deleted
inserted
replaced
396:5eb0df61f371 | 397:847ea345becb |
---|---|
135 ok(valid('/simple', 'http://www.example.org/' . 'a' x 256), 'long uri'); | 135 ok(valid('/simple', 'http://www.example.org/' . 'a' x 256), 'long uri'); |
136 ok(!valid('/simple', 'http://www.example.' . 'a' x 256), 'long hostname'); | 136 ok(!valid('/simple', 'http://www.example.' . 'a' x 256), 'long hostname'); |
137 ok(!valid('/wc', 'http://example.' . 'a' x 256), 'long hostname wildcard'); | 137 ok(!valid('/wc', 'http://example.' . 'a' x 256), 'long hostname wildcard'); |
138 | 138 |
139 ok(valid('/long', 'http://' . 'a' x 255), 'long hostname 255'); | 139 ok(valid('/long', 'http://' . 'a' x 255), 'long hostname 255'); |
140 | |
141 TODO: { | |
142 local $TODO = 'not yet' unless $t->has_version('1.5.5'); | |
143 | |
144 ok(valid('/long', 'http://' . 'a' x 256), 'long hostname 256'); | 140 ok(valid('/long', 'http://' . 'a' x 256), 'long hostname 256'); |
145 | |
146 } | |
147 | |
148 ok(!valid('/long', 'http://' . 'a' x 257), 'long hostname 257'); | 141 ok(!valid('/long', 'http://' . 'a' x 257), 'long hostname 257'); |
149 | 142 |
150 ok(valid('/uri', 'http://www.example.org/uri'), 'uri'); | 143 ok(valid('/uri', 'http://www.example.org/uri'), 'uri'); |
151 ok(valid('/uri', 'http://www.example.org/urii'), 'uri prefix'); | 144 ok(valid('/uri', 'http://www.example.org/urii'), 'uri prefix'); |
152 ok(!valid('/uri', 'http://www.example.org/uRi'), 'uri case'); | 145 ok(!valid('/uri', 'http://www.example.org/uRi'), 'uri case'); |
161 ok(!valid('/regex', 'http://www.eXample.net'), 'regex case mismatch'); | 154 ok(!valid('/regex', 'http://www.eXample.net'), 'regex case mismatch'); |
162 | 155 |
163 ok(valid('/regex2', 'http://www.example.org/uri'), 'regex 2 uri'); | 156 ok(valid('/regex2', 'http://www.example.org/uri'), 'regex 2 uri'); |
164 ok(!valid('/regex2', 'http://www.example.org'), 'regex 2 no uri'); | 157 ok(!valid('/regex2', 'http://www.example.org'), 'regex 2 no uri'); |
165 ok(valid('/regex2', 'http://www.example.org/uRI'), 'regex 2 uri caseless'); | 158 ok(valid('/regex2', 'http://www.example.org/uRI'), 'regex 2 uri caseless'); |
166 | |
167 TODO: { | |
168 local $TODO = 'not yet' unless $t->has_version('1.5.4'); | |
169 | |
170 ok(valid('/regex3', 'https://www.eXample.org'), 'regex https'); | 159 ok(valid('/regex3', 'https://www.eXample.org'), 'regex https'); |
171 | |
172 } | |
173 | 160 |
174 ok(valid('/sn', 'http://localhost'), 'server_names'); | 161 ok(valid('/sn', 'http://localhost'), 'server_names'); |
175 ok(valid('/sn', 'http://localHost'), 'server_names caseless'); | 162 ok(valid('/sn', 'http://localHost'), 'server_names caseless'); |
176 ok(valid('/sn', 'http://localhost/uri'), 'server_names uri'); | 163 ok(valid('/sn', 'http://localhost/uri'), 'server_names uri'); |
177 ok(valid('/sn', 'http://foobar'), 'server_names regex'); | 164 ok(valid('/sn', 'http://foobar'), 'server_names regex'); |
178 | |
179 TODO: { | |
180 local $TODO = 'not yet' unless $t->has_version('1.5.5'); | |
181 | |
182 ok(valid('/sn', 'http://foobAr'), 'server_names regex caseless'); | 165 ok(valid('/sn', 'http://foobAr'), 'server_names regex caseless'); |
183 ok(valid('/sn', 'http://foobAr/uri'), 'server_names regex caseless uri'); | 166 ok(valid('/sn', 'http://foobAr/uri'), 'server_names regex caseless uri'); |
184 ok(valid('/sn', 'http://anchoredre/uri'), 'server_names regex anchored'); | 167 ok(valid('/sn', 'http://anchoredre/uri'), 'server_names regex anchored'); |
185 | |
186 } | |
187 | |
188 ok(valid('/sn', 'http://foobar/uri'), 'server_names regex uri'); | 168 ok(valid('/sn', 'http://foobar/uri'), 'server_names regex uri'); |
189 ok(!valid('/sn', 'localhost'), 'server_names no scheme'); | 169 ok(!valid('/sn', 'localhost'), 'server_names no scheme'); |
190 ok(!valid('/sn', 'foobar'), 'server_names regex no scheme'); | 170 ok(!valid('/sn', 'foobar'), 'server_names regex no scheme'); |
191 ok(valid('/sn_blocked', 'localhost'), 'server_names no scheme blocked'); | 171 ok(valid('/sn_blocked', 'localhost'), 'server_names no scheme blocked'); |
192 | 172 |
198 | 178 |
199 ok(valid('/', 'http://another', 'another'), 'server context'); | 179 ok(valid('/', 'http://another', 'another'), 'server context'); |
200 | 180 |
201 # server_name below valid_referers | 181 # server_name below valid_referers |
202 | 182 |
203 TODO: { | |
204 local $TODO = 'not yet' unless $t->has_version('1.5.5'); | |
205 | |
206 ok(valid('/', 'http://below', 'below'), 'server below'); | 183 ok(valid('/', 'http://below', 'below'), 'server below'); |
207 | |
208 } | |
209 | 184 |
210 ############################################################################### | 185 ############################################################################### |
211 | 186 |
212 sub valid { | 187 sub valid { |
213 my ($uri, $referer, $host) = @_; | 188 my ($uri, $referer, $host) = @_; |