Shorten the regex private domain match

This commit is contained in:
luchua-bc
2020-08-01 03:42:13 +00:00
parent ff58abb7d3
commit b65a033302

View File

@@ -72,13 +72,7 @@ class URIConstructor extends ClassInstanceExpr {
* Gets a regular expression for matching private hosts.
*/
private string getPrivateHostRegex() {
result = "(?i)localhost(/.*)?" or
result = "127\\.0\\.0\\.1(/.*)?" or // IPv4 patterns
result = "10(\\.[0-9]+){3}(/.*)?" or
result = "172\\.16(\\.[0-9]+){2}(/.*)?" or
result = "192.168(\\.[0-9]+){2}(/.*)?" or
result = "\\[0:0:0:0:0:0:0:1\\](/.*)?" or // IPv6 patterns
result = "\\[::1\\](/.*)?"
result = "(?i)localhost([:/].*)?|127\\.0\\.0\\.1([:/].*)?|10(\\.[0-9]+){3}([:/].*)?|172\\.16(\\.[0-9]+){2}([:/].*)?|192.168(\\.[0-9]+){2}([:/].*)?|\\[0:0:0:0:0:0:0:1\\]([:/].*)?|\\[::1\\]([:/].*)?"
}
/**