Open treebly opened 4 years ago
According to the spec, a.local.com
is actually a valid scheme, making a.local.com:3000
a valid Url. Maybe the documentation could make it clearer that HTTP headers and user inputs will have to be normalized based on the appropriate heuristics.
Go seems to handle it in a similar way: https://play.golang.org/p/VI4EFKVIUA2
Trying to parse a string such as
a.local.com:3000
should fail, as it does not have a scheme. However, it is allowed to parse, and when.scheme()
is called on the resulting Url struct.a.local.com
is returned as the scheme. This can cause unexpected behavior and allow invalid URLs to slip through as valid.This seems to be related to this issue.
Code Sample:
Output:
a.local.com:3000, scheme: a.local.com