golgote/neturl

Whitespace on the host name

pyk opened this issue · 1 comments

pyk commented
> url = require("net.url")
> res = url.parse("http:// spacehost.com")
> = res.scheme
http
> = res.host
 spacehost.com
>

In this case, the res.host should be nil right?

I have read the discussion here : sporkmonger/addressable#161
Looks like there would be different ways to deal with this issue, like:

  • throwing an error
  • stripping leading and trailing whitespace

But the library here is not really for validating an url, just parsing it by trying to extract the different parts. Maybe another library, or a dedicated function, could first validate each part before trying to parse the url.