[interchange-cvs] interchange - kwalsh modified 9 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Sun Sep 2 15:21:05 EDT 2007


User:      kwalsh
Date:      2007-09-02 19:21:05 GMT
Modified:  dist     interchange.cfg.dist
Modified:  .        MANIFEST UPGRADE WHATSNEW-5.5
Modified:  lib/Vend Config.pm Dispatch.pm
Modified:  debian   interchange.cfg rules
Added:     dist     subdomains.cfg
Log:
    * Created a new CountrySubdomains directive.  A predefined block
      of country subdomains is listed in a new subdomains.cfg file, which
      should be "included" into the interchange.cfg file.

      This method is faster and easier to maintain than my previous effort.

      Note: The subdomains.cfg file is incomplete; Several countries either
      have an incomplete subdomain list, or are not represented at all.
      This situation will correct itself over time.

Revision  Changes    Path
2.12      +3 -0      interchange/dist/interchange.cfg.dist


rev 2.12, prev_rev 2.11
Index: interchange.cfg.dist
===================================================================
RCS file: /var/cvs/interchange/dist/interchange.cfg.dist,v
retrieving revision 2.11
retrieving revision 2.12
diff -u -r2.11 -r2.12
--- interchange.cfg.dist	20 Aug 2007 21:43:32 -0000	2.11
+++ interchange.cfg.dist	2 Sep 2007 19:21:04 -0000	2.12
@@ -115,3 +115,6 @@
 
 # Include the robot recognition lists
 include robots.cfg
+
+# Include the list of country-specific standardised subdomains
+include subdomains.cfg



2.1                  interchange/dist/subdomains.cfg


rev 2.1, prev_rev 2.0



2.213     +1 -0      interchange/MANIFEST


rev 2.213, prev_rev 2.212
Index: MANIFEST
===================================================================
RCS file: /var/cvs/interchange/MANIFEST,v
retrieving revision 2.212
retrieving revision 2.213
diff -u -r2.212 -r2.213
--- MANIFEST	21 Aug 2007 09:00:23 -0000	2.212
+++ MANIFEST	2 Sep 2007 19:21:04 -0000	2.213
@@ -608,6 +608,7 @@
 dist/lib/UI/vars/UI_STD_HEAD
 dist/locale.error
 dist/robots.cfg
+dist/subdomains.cfg
 dist/src/compile.pl
 dist/src/config.h.in
 dist/src/configure



2.23      +5 -0      interchange/UPGRADE


rev 2.23, prev_rev 2.22
Index: UPGRADE
===================================================================
RCS file: /var/cvs/interchange/UPGRADE,v
retrieving revision 2.22
retrieving revision 2.23
diff -u -r2.22 -r2.23
--- UPGRADE	1 Aug 2007 10:52:45 -0000	2.22
+++ UPGRADE	2 Sep 2007 19:21:04 -0000	2.23
@@ -116,6 +116,11 @@
 need to remove any existing *Robot* directives from your interchange.cfg
 file and add "include robots.cfg" in their place.
 
+A new subdomains.cfg file has been created, and should be included into
+your interchange.cfg file with "include subdomains.cfg".  This file defines
+a list of country-specific standardised subdomains that should be taken
+into account when the DomainTail directive is in effect.
+
 The session per IP counters have been changed to the new "timecard" round-robin
 style counters.  You will need to delete the old counter files from the
 tmp/addr_ctr directory with a command similar to the following:



1.63      +4 -0      interchange/WHATSNEW-5.5


rev 1.63, prev_rev 1.62
Index: WHATSNEW-5.5
===================================================================
RCS file: /var/cvs/interchange/WHATSNEW-5.5,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- WHATSNEW-5.5	30 Aug 2007 19:07:05 -0000	1.62
+++ WHATSNEW-5.5	2 Sep 2007 19:21:04 -0000	1.63
@@ -16,6 +16,10 @@
   into account.  For example, if "foo.example.co.uk" pays a visit then
   "example.co.uk" as the domain tail will be used instead of just "co.uk".
 
+  This is done with a new CountrySubdomains directive.  A predefined block
+  of country subdomains is listed in a new subdomains.cfg file, which
+  should be "included" into the interchange.cfg file.
+
 
 Interchange 5.5.1 released on 2007-08-21.
 



2.222     +18 -2     interchange/lib/Vend/Config.pm


rev 2.222, prev_rev 2.221
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.221
retrieving revision 2.222
diff -u -r2.221 -r2.222
--- Config.pm	10 Aug 2007 08:42:09 -0000	2.221
+++ Config.pm	2 Sep 2007 19:21:04 -0000	2.222
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.221 2007/08/10 08:42:09 pajamian Exp $
+# $Id: Config.pm,v 2.222 2007/09/02 19:21:04 kwalsh Exp $
 #
 # Copyright (C) 2002-2007 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -54,7 +54,7 @@
 use Vend::Data;
 use Vend::Cron;
 
-$VERSION = substr(q$Revision: 2.221 $, 10);
+$VERSION = substr(q$Revision: 2.222 $, 10);
 
 my %CDname;
 my %CPname;
@@ -470,6 +470,7 @@
 	['TemplateDir',      'root_dir_array', 	 ''],
 	['DebugTemplate',    undef, 	         ''],
 	['DomainTail',		 'yesno',            'Yes'],
+	['CountrySubdomains','hash',             ''],
 	['TrustProxy',		 'list_wildcard_full', ''],
 	['AcrossLocks',		 'yesno',            'No'],
     ['DNSBL',            'array',            ''],
@@ -1915,6 +1916,9 @@
 	# with no effect if that has been done already.
 	get_system_code() unless defined $SystemCodeDone;
 
+	# Directive post-processing
+	global_directive_postprocess();
+
 	# Do some cleanup
 	set_global_defaults();
 
@@ -3562,6 +3566,18 @@
 			chmod 0644, $Global::ExternalFile;
 		},
 );
+
+sub global_directive_postprocess {
+	$Global::CountrySubdomains ||= {};
+
+	while (my ($key,$val) = each(%$Global::CountrySubdomains)) {
+		$val =~ s/[\s,]+$//;
+		next unless $val;
+
+		$val = '(?:' . join('|',split('[\s,]+',$val)) . ")\\.$key";
+		$Global::CountrySubdomains->{$key} = qr/$val/i;
+	}
+}
 
 sub set_global_defaults {
 	## Nothing here currently



1.91      +6 -47     interchange/lib/Vend/Dispatch.pm


rev 1.91, prev_rev 1.90
Index: Dispatch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Dispatch.pm,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -r1.90 -r1.91
--- Dispatch.pm	30 Aug 2007 23:57:53 -0000	1.90
+++ Dispatch.pm	2 Sep 2007 19:21:04 -0000	1.91
@@ -1,6 +1,6 @@
 # Vend::Dispatch - Handle Interchange page requests
 #
-# $Id: Dispatch.pm,v 1.90 2007/08/30 23:57:53 kwalsh Exp $
+# $Id: Dispatch.pm,v 1.91 2007/09/02 19:21:04 kwalsh Exp $
 #
 # Copyright (C) 2002-2007 Interchange Development Group
 # Copyright (C) 2002 Mike Heins <mike at perusion.net>
@@ -26,7 +26,7 @@
 package Vend::Dispatch;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.90 $, 10);
+$VERSION = substr(q$Revision: 1.91 $, 10);
 
 use POSIX qw(strftime);
 use Vend::Util;
@@ -884,51 +884,10 @@
     $CGI::ip   = $CGI::remote_addr;
 
 	if($Global::DomainTail and $host) {
-		my $level = ($host =~ m{\.(?:
-		    (?:com|edu|gov|net|org)\.al |
-		    (?:ac|gov|mil|name|net|org|pro|sch)\.ae |
-		    (?:bank|com|edu|gov|hotel|law|music|net|org|tv)\.af |
-		    (?:co|com|org|net|nom)\.ag |
-		    (?:com|edu|gov|int|mil|net|org)\.ar |
-		    (?:ac|gv|or|co|priv)\.at |
-		    (?:com|net|org|edu|gov|csiro|asn|id|act|nsw|nt|qld|sa|tas|vic|wa)\.au |
-		    (?:adm|adv|agr|am|arq|art|ato|bio|blog|bmd|cim|cng|cnt|com|coop|ecn|edu|eng|esp|etc|eti|far|flog|fm|fnd|fot|fst|g12|ggf|gov|imb|ind|inf|jor|lel|mat|med|mil|mus|net|nom|not|ntr|odo|org|ppg|pro|psc|psi|qsl|rec|slg|srv|tmp|trd|tur|tv|vet|vlog|wiki|zlg)\.br |
-		    (?:ab|bc|mb|nb|nf|ns|nt|nu|on|pe|qc|sk|yk)\.ca |
-		    (?:com|edu|gov|mil|net|nom|org)\.co |
-		    (?:ac|biz|com|ekloges|gov|ltd|name|net|org|parliament|press|pro|tm)\.cy |
-		    (?:com|eun|gov|mil|net|org|sci)\.eg |
-		    (?:com|edu|gob|nom|org)\.es |
-		    (?:asso|com|gouv|nom|prd|presse|tm)\.fr |
-		    (?:co|gov|net|org|sch)\.gg |
-		    (?:com|edu|gov|idv|net|org)\.hk |
-		    (?:iz|from|com)\.hr |
-		    (?:ac|co|go|mil|net|or|sch|web)\.id |
-		    (?:ac|co|gov|idf|k12|muni|net|org)\.il |
-		    (?:ac|co|edu|ernet|firm|gen|gov|ind|mil|net|org|res)\.in |
-		    (?:edu|gov)\.it |
-		    (?:ac|ad|co|ed|go|gr|lg|ne|or)\.jp |
-		    (?:ac|co|es|go|hs|kg|mil|ms|ne|oe|or|re|sc|busan|chungbuk|chungnam|daegu|daejeon|gangwon|gwangju|gyeongbuk|gyeonggi|gyeongnam|incheon|jeju|jeonbuk|jeonnam|seoul|ulsan)\.kr |
-		    (?:com|edu|gov|id|med|net|org|plc|sch)\.ly |
-		    (?:com|edu|gov|net|org)\.mt |
-		    (?:com|edu|gob|net|org)\.mx |
-		    (?:ac|co|cri|geek|gen|govt|iwi|maori|mil|net|org|parliament|school)\.nz |
-		    (?:com|edu|gob|mil|net|nom|org)\.pe |
-		    (?:art|biz|com|edu|gov|info|mil|net|ngo|org|bialystok|gda|gdansk|katowice|krakow|lodz|lublin|olsztyn|poznan|slupsk|szczecin|torun|warszawa|waw|wroc|wroclaw|zgora)\.pl |
-		    (?:com|edu|gov|int|net|nome|org|publ)\.pt |
-		    (?:com|edu|gov|mil|net|org)\.py |
-		    (?:asso|com|nom)\.re |
-		    (?:com|net|org|pp)\.ru |
-		    (?:com|edu|gov|med|net|org|pub|sch)\.sa |
-		    (?:mil|org|parti|pp|press|tm|a|ac|bd|c|d|e|f|g|h|i|k|m|n|o|s|t|u|w|x|y|z)\.se |
-		    (?:com|edu|gob|org|red)\.sv |
-		    (?:ac|co|go|in|mi|net|or)\.th |
-		    (?:com|co|edu|gov|mil|net|nom|org)\.tm |
-		    (?:club|com|ebiz|edu|game|gov|idv|mil|net|org)\.tw |
-		    (?:com|edu|gov|in|net|org)\.ua |
-		    (?:ac|co|gov|ltd|me|mod|net|nic|nhs|org|plc|police|sch)\.uk |
-		    (?:ak|al|ar|az|ca|co|ct|dc|de|fl|ga|hi|ia|id|il|in|ks|ky|la|ma|md|me|mi|mn|mo|ms|mt|nc|nd|ne|nh|nj|nm|nv|ny|oh|ok|or|pa|ri|sc|sd|tn|tx|ut|va|vt|wa|wi|wv|wy|as|gu|pr|vi|dni|fed|isa|kids|nsn)\.us |
-		    (?:ac|agric|alt|co|edu|gov|law|mil|net|ngo|nis|nom|org|school|tm|web)\.za
-		)$}ix) ? 2 : 1;
+		$host =~ /\.([A-Za-z]+)$/;
+		my $tld = $1;
+
+		my $level = (defined($Global::CountrySubdomains->{$tld}) && $host =~ $Global::CountrySubdomains->{$tld}) ? 2 : 1;
 
 		$host =~ s/.*?((?:[-A-Za-z0-9]+\.){$level}[A-Za-z]+)$/$1/;
 	}



2.16      +3 -0      interchange/debian/interchange.cfg


rev 2.16, prev_rev 2.15
Index: interchange.cfg
===================================================================
RCS file: /var/cvs/interchange/debian/interchange.cfg,v
retrieving revision 2.15
retrieving revision 2.16
diff -u -r2.15 -r2.16
--- interchange.cfg	30 Jan 2006 17:44:10 -0000	2.15
+++ interchange.cfg	2 Sep 2007 19:21:05 -0000	2.16
@@ -125,6 +125,9 @@
 include /etc/interchange/robots.cfg
 endif
 
+# Include the list of country-specific "standard" subdomains
+include /etc/interchange/subdomains.cfg
+
 # Include global usertags put up by the administrator
 include /etc/interchange/usertag/*.tag
 



2.38      +1 -1      interchange/debian/rules


rev 2.38, prev_rev 2.37
Index: rules
===================================================================
RCS file: /var/cvs/interchange/debian/rules,v
retrieving revision 2.37
retrieving revision 2.38
diff -u -r2.37 -r2.38
--- rules	11 Aug 2007 22:27:07 -0000	2.37
+++ rules	2 Sep 2007 19:21:05 -0000	2.38
@@ -85,7 +85,7 @@
 # Setup configuration directory
 	mkdir -p $(TMP)/etc/interchange/
 	cp debian/interchange.cfg debian/catalogs.cfg debian/makecat.cfg \
-		dist/robots.cfg $(TMP)/etc/interchange    
+		dist/robots.cfg dist/subdomains.cfg $(TMP)/etc/interchange    
 # build Interchange control program(s)
 	mkdir -p $(TMP)/usr/lib/cgi-bin/ic
 	$(PERL) scripts/compile_link \








More information about the interchange-cvs mailing list