Mercurial > hg > nginx-tests
comparison referer.t @ 974:882267679006
Tests: simplified parallel modifications in tests.
Mail tests were simplified in c227348453db.
author | Andrey Zelenkov <zelenkov@nginx.com> |
---|---|
date | Tue, 12 Jul 2016 17:39:03 +0300 |
parents | e9064d691790 |
children |
comparison
equal
deleted
inserted
replaced
973:7d7aef8b9f3a | 974:882267679006 |
---|---|
34 | 34 |
35 http { | 35 http { |
36 %%TEST_GLOBALS_HTTP%% | 36 %%TEST_GLOBALS_HTTP%% |
37 | 37 |
38 server { | 38 server { |
39 listen 127.0.0.1:%%PORT_0%%; | 39 listen 127.0.0.1:8080; |
40 server_name another; | 40 server_name another; |
41 | 41 |
42 valid_referers server_names; | 42 valid_referers server_names; |
43 return 200 "$host value $invalid_referer"; | 43 return 200 "$host value $invalid_referer"; |
44 } | 44 } |
45 | 45 |
46 server { | 46 server { |
47 listen 127.0.0.1:%%PORT_0%%; | 47 listen 127.0.0.1:8080; |
48 server_name _; | 48 server_name _; |
49 | 49 |
50 location / { | 50 location / { |
51 valid_referers server_names; | 51 valid_referers server_names; |
52 return 200 "$host value $invalid_referer"; | 52 return 200 "$host value $invalid_referer"; |
53 } | 53 } |
54 server_name below; | 54 server_name below; |
55 } | 55 } |
56 | 56 |
57 server { | 57 server { |
58 listen 127.0.0.1:%%PORT_0%%; | 58 listen 127.0.0.1:8080; |
59 server_name localhost ~bar ~^anchoredre$; | 59 server_name localhost ~bar ~^anchoredre$; |
60 | 60 |
61 location /blocked { | 61 location /blocked { |
62 valid_referers blocked www.example.org; | 62 valid_referers blocked www.example.org; |
63 return 200 "value $invalid_referer"; | 63 return 200 "value $invalid_referer"; |
115 | 115 |
116 ############################################################################### | 116 ############################################################################### |
117 | 117 |
118 ok(valid('/simple', 'http://www.example.org'), 'simple'); | 118 ok(valid('/simple', 'http://www.example.org'), 'simple'); |
119 ok(valid('/simple', 'http://www.example.org/uri'), 'simple uri'); | 119 ok(valid('/simple', 'http://www.example.org/uri'), 'simple uri'); |
120 ok(valid('/simple', 'http://www.example.org:' . port(0) . '/uri'), | 120 ok(valid('/simple', 'http://www.example.org:' . port(8080) . '/uri'), |
121 'simple port uri'); | 121 'simple port uri'); |
122 ok(!valid('/simple', 'localhost'), 'simple invalid'); | 122 ok(!valid('/simple', 'localhost'), 'simple invalid'); |
123 ok(valid('/simple', 'https://www.example.org'), 'https'); | 123 ok(valid('/simple', 'https://www.example.org'), 'https'); |
124 ok(!valid('/simple', 'example.com'), 'no scheme'); | 124 ok(!valid('/simple', 'example.com'), 'no scheme'); |
125 ok(!valid('/simple'), 'no none'); | 125 ok(!valid('/simple'), 'no none'); |
142 ok(!valid('/long', 'http://' . 'a' x 257), 'long hostname 257'); | 142 ok(!valid('/long', 'http://' . 'a' x 257), 'long hostname 257'); |
143 | 143 |
144 ok(valid('/uri', 'http://www.example.org/uri'), 'uri'); | 144 ok(valid('/uri', 'http://www.example.org/uri'), 'uri'); |
145 ok(valid('/uri', 'http://www.example.org/urii'), 'uri prefix'); | 145 ok(valid('/uri', 'http://www.example.org/urii'), 'uri prefix'); |
146 ok(!valid('/uri', 'http://www.example.org/uRi'), 'uri case'); | 146 ok(!valid('/uri', 'http://www.example.org/uRi'), 'uri case'); |
147 ok(valid('/uri', 'http://www.example.org:' . port(0) . '/urii'), 'uri port'); | 147 ok(valid('/uri', 'http://www.example.org:' . port(8080) . '/urii'), 'uri port'); |
148 ok(!valid('/uri', 'http://www.example.org/ur'), 'uri invalid len'); | 148 ok(!valid('/uri', 'http://www.example.org/ur'), 'uri invalid len'); |
149 ok(!valid('/uri', 'http://www.example.org/urd'), 'uri invalid cmp'); | 149 ok(!valid('/uri', 'http://www.example.org/urd'), 'uri invalid cmp'); |
150 | 150 |
151 ok(valid('/regex', 'http://www.example.org'), 'regex'); | 151 ok(valid('/regex', 'http://www.example.org'), 'regex'); |
152 ok(valid('/regex', 'http://www.eXample.org'), 'regex caseless'); | 152 ok(valid('/regex', 'http://www.eXample.org'), 'regex caseless'); |