changeset 230:9d7805b05f0f

Tests: geo ranges minimal testing.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 16 Aug 2012 16:59:47 +0400
parents 9969fcf1f27e
children bc1861122d0c
files geo.t
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/geo.t
+++ b/geo.t
@@ -55,6 +55,13 @@ http {
         192.0.2.0/24 test;
     }
 
+    geo $geo_ranges {
+        ranges;
+        default      default;
+        127.0.0.0-127.255.255.255  loopback;
+        192.0.2.0-192.0.2.255      test;
+    }
+
     server {
         listen       127.0.0.1:8080;
         server_name  localhost;
@@ -64,6 +71,7 @@ http {
             add_header X-Geo $geo;
             add_header X-Arg $geo_from_arg;
             add_header X-XFF $geo_proxy;
+            add_header X-Ran $geo_ranges;
         }
     }
 }
@@ -76,7 +84,7 @@ EOF
 plan(skip_all => 'no 127.0.0.1 on host')
 	if http_get('/1') !~ /X-IP: 127.0.0.1/m;
 
-$t->plan(6);
+$t->plan(7);
 
 ###############################################################################
 
@@ -89,6 +97,8 @@ like(http_xff('192.0.2.1'), qr/^X-XFF: t
 like(http_xff('10.0.0.1'), qr/^X-XFF: default/m, 'geo proxy default');
 like(http_xff('10.0.0.1, 192.0.2.1'), qr/^X-XFF: test/m, 'geo proxy long');
 
+like(http_get('/1'), qr/^X-Ran: loopback/m, 'geo ranges');
+
 ###############################################################################
 
 sub http_xff {