danf: curl-www ipwhere.pm,1.3,1.4 metalink.cgi,1.5,1.6

[email protected]
Newsgroups gmane.comp.web.curl.www.cvs
Message-ID <[email protected]>
Update of /cvsroot/curl/curl-www
In directory labb:/tmp/cvs-serv29492

Modified Files:
	ipwhere.pm metalink.cgi 
Log Message:
Fix the Great Britain special case.


Index: metalink.cgi
===================================================================
RCS file: /cvsroot/curl/curl-www/metalink.cgi,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- metalink.cgi	23 Jul 2007 20:03:45 -0000	1.5
+++ metalink.cgi	23 Jul 2007 20:13:07 -0000	1.6
@@ -89,8 +89,8 @@
     my ($country)=@_;
     my $tld = country2tld($country);
 
-    if($country =~ /United Kingdom/i) {
-        # NOTE: this is GB not UK, as the Metalink spec says
+    if($tld eq "uk") {
+        # NOTE: this is GB, not UK, to follow the Metalink spec
         $tld="gb";
     }
     return $tld;

Index: ipwhere.pm
===================================================================
RCS file: /cvsroot/curl/curl-www/ipwhere.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ipwhere.pm	23 Jul 2007 20:03:45 -0000	1.3
+++ ipwhere.pm	23 Jul 2007 20:13:07 -0000	1.4
@@ -525,12 +525,17 @@
 sub country2tld {
     my ($cntr)=@_;
 
+    if ($cntr =~ /Great Britain/) {
+    	return "uk";	# TLD is uk, not gb
+    }
+
     for (keys(%tld2cntr)) {
         if ($cntr =~ /$tld2cntr{$_}/) {
         	return $_;
         }
     }
-    # Special case alternative country name
+
+    # This is a pretty vague regex, so match it only as a last resort
     if ($cntr =~ /US/) {
     	return "us";
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.