mirror of
https://github.com/qinyuhang/ShadowsocksX-NG-R.git
synced 2026-10-04 09:43:53 +00:00
underscores should be allowed in domain names
[It is perfectly legal to have an underscore in a domain name.](https://stackoverflow.com/a/2183140/6247478) I fixed `validateDomainName` so that users who are given a domain name with underscores will not be prevented from using this software.
This commit is contained in:
@@ -131,7 +131,7 @@ class ServerProfile: NSObject {
|
||||
}
|
||||
|
||||
func validateDomainName(_ value: String) -> Bool {
|
||||
let validHostnameRegex = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$"
|
||||
let validHostnameRegex = "^(([a-zA-Z0-9_]|[a-zA-Z0-9_][a-zA-Z0-9\\-_]*[a-zA-Z0-9_])\\.)*([A-Za-z0-9_]|[A-Za-z0-9_][A-Za-z0-9\\-_]*[A-Za-z0-9_])$"
|
||||
|
||||
if (value.range(of: validHostnameRegex, options: .regularExpression) != nil) {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user