Require a valid port that isn't greater than 65,535

This commit is contained in:
Brian Muller 2018-08-16 21:05:41 -04:00
parent 99e62dddb4
commit 6537c6c55a
2 changed files with 4 additions and 1 deletions

3
uri.go
View file

@ -173,6 +173,9 @@ func parseAddress(address string) (uri *URI, err error) {
if err != nil {
return nil, errors.New("converting port string to int")
}
if port > 65535 {
return nil, errors.New("port must be in range 0 - 65535")
}
}
uri = &URI{
Scheme: scheme,

View file

@ -172,5 +172,5 @@ func validFixture() []uriItem {
}
func invalidFixture() []string {
return []string{"foo:bar", "http://foo:", "foo:", ":bar", "http://pilosa.com:129999999999999999999999993", "fd42:4201:f86b:7e09:216:3eff:fefa:ed80"}
return []string{"foo:bar", "http://foo:", "foo:", ":bar", "http://pilosa.com:129999999999999999999999993", "fd42:4201:f86b:7e09:216:3eff:fefa:ed80", ":65536"}
}