UriParser.parsePort

int parsePort(string p) @safe

Parse a decimal port number.

RFC 3986 defines port = *DIGIT, so an empty port is syntactically valid: in non-strict mode it is treated as absent (-1). Strict mode keeps rejecting it.

Parameters

pPort string.

Returns

The port number, or -1 for an empty port in non-strict mode.

Throws

UriParseException if p is empty in strict mode, non-numeric,

or outside 0..65535.