Commit 4c53d991 authored by Nigel Tao's avatar Nigel Tao

go.net/publicsuffix: update table to latest list from publicsuffix.org.

Also add a sanity check for the erroneous all-caps "TOKYO" that was
fixed in http://hg.mozilla.org/mozilla-central/rev/e85f83f352de

LGTM=dr.volker.dobler
R=dr.volker.dobler
CC=golang-codereviews
https://golang.org/cl/58890045
parent 28a4bd90
......@@ -28,6 +28,7 @@ import (
"io"
"net/http"
"os"
"regexp"
"sort"
"strings"
......@@ -71,6 +72,11 @@ var (
labelsMap = map[string]bool{}
rules = []string{}
// validSuffix is used to check that the entries in the public suffix list
// are in canonical form (after Punycode encoding). Specifically, capital
// letters are not allowed.
validSuffix = regexp.MustCompile(`^[a-z0-9_\!\*\-\.]+$`)
crush = flag.Bool("crush", true, "make the generated node text as small as possible")
subset = flag.Bool("subset", false, "generate only a subset of the full table, for debugging")
url = flag.String("url",
......@@ -140,6 +146,9 @@ func main1() error {
if err != nil {
return err
}
if !validSuffix.MatchString(s) {
return fmt.Errorf("bad publicsuffix.org list data: %q", s)
}
if *subset {
switch {
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment