Bug 14924 – Error in std.uri definition/description
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-08-16T00:18:35Z
Last change time
2020-03-21T03:56:39Z
Assigned to
No Owner
Creator
ted
Comments
Comment #0 by s_dlang_bugzilla — 2015-08-16T00:18:35Z
dmd2.068.0
size_t defined as (from http://dlang.org/type.html): "size_t is an alias to one of the unsigned integral basic types"
(i.e. size_t is unsigned)
Both uriLength and emailLength return size_t.
...but are supposed to return -1 if invalid
Cannot use a test that uses "< 0".
Additionaly, dmd does not issue any warning when performing this test.
Comment #2 by s_dlang_bugzilla — 2015-08-16T01:41:30Z
Another aspect that should be noted in the documentation is that only a _very_ narrow subset of URI's are accepted....
try ftp:///foo.com (valid URI, fails 'test').....!
Comment #3 by b2.temp — 2015-08-16T02:26:05Z
It looks like std.uri hasn't changed since it's been added in 2007. If you look at the implementation it's really old fashioned D.
For example nowadays, for `emailLength()` and `uriLength()`, the parameter would not be of type `in char[]` but at least `string` and even perahps an InputRange with a constraint of type `if (isInputRange!T && isSomeChar!T)`...
I wouldn't be surprised if someone from the organisation would come and say that's it's deprecated and that instead a Regex can be used. I hang on Dlang only still one or two years so I can't say more...I may be wrong.
Comment #4 by github-bugzilla — 2015-08-16T10:40:54Z