Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions confutils/std/net.nim
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ func completeCmdArg*(T: type IpAddress, val: string): seq[string] =
func parseCmdArg*(T: type Port, s: string): T {.gcsafe, raises: [ValueError].} =
template fail =
raise newException(ValueError,
"The supplied port must be an integer value in the range 1-65535")
"The supplied port must be an integer value in the range 0-65535")

var intVal: int
let parsedChars = try: parseInt(s, intVal)
except CatchableError: fail()

if parsedChars != len(s) or intVal < 1 or intVal > 65535:
if parsedChars != len(s) or intVal < 0 or intVal > 65535:
fail()

return Port(intVal)
Expand Down
Loading