readIntegral: Support base between 2 and 36

This commit is contained in:
2018-06-06 21:05:35 +02:00
parent 7561b964d3
commit 173ae115ee
2 changed files with 86 additions and 32 deletions

View File

@ -305,8 +305,14 @@ struct URL
*/
private bool parsePort(const(char)[] port) @nogc nothrow pure @safe
{
auto portNumber = port[1 .. $];
return readString(portNumber, this.port) || portNumber[0] == '/';
auto unparsed = port[1 .. $];
auto parsed = readIntegral!ushort(unparsed);
if (unparsed.length == 0 || unparsed[0] == '/')
{
this.port = parsed;
return true;
}
return false;
}
}