|
@@ -28,6 +28,7 @@ import (
|
|
|
"io"
|
|
"io"
|
|
|
"net/http"
|
|
"net/http"
|
|
|
"os"
|
|
"os"
|
|
|
|
|
+ "regexp"
|
|
|
"sort"
|
|
"sort"
|
|
|
"strings"
|
|
"strings"
|
|
|
|
|
|
|
@@ -71,6 +72,11 @@ var (
|
|
|
labelsMap = map[string]bool{}
|
|
labelsMap = map[string]bool{}
|
|
|
rules = []string{}
|
|
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")
|
|
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")
|
|
subset = flag.Bool("subset", false, "generate only a subset of the full table, for debugging")
|
|
|
url = flag.String("url",
|
|
url = flag.String("url",
|
|
@@ -140,6 +146,9 @@ func main1() error {
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|
|
|
|
|
+ if !validSuffix.MatchString(s) {
|
|
|
|
|
+ return fmt.Errorf("bad publicsuffix.org list data: %q", s)
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if *subset {
|
|
if *subset {
|
|
|
switch {
|
|
switch {
|