Hosts that begin with an IP but have further leading characters are not parsed correctly.
It's possible to create a Url object, get it's host and fail to parse it using the Host.parse method. See example below.
To Reproduce
import io.lemonlabs.uri.Host
import io.lemonlabs.uri.Url
val url = Url.parse("http://1.2.3.4.blah/")
Host.parse(url.hostOption.get.toString)
io.lemonlabs.uri.parsing.UriParsingException: Invalid Host could not be parsed. Invalid input '.', expected Digit or 'EOI' (line 1, column 8):
1.2.3.4.blah
^
at io.lemonlabs.uri.parsing.UrlParser$$anonfun$mapParseError$1.applyOrElse(UrlParser.scala:231)
at io.lemonlabs.uri.parsing.UrlParser$$anonfun$mapParseError$1.applyOrElse(UrlParser.scala:228)
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
at scala.util.Failure.recoverWith(Try.scala:203)
at io.lemonlabs.uri.parsing.UrlParser.mapParseError(UrlParser.scala:228)
at io.lemonlabs.uri.parsing.UrlParser.parseHost(UrlParser.scala:244)
at io.lemonlabs.uri.parsing.UrlParser$.parseHost(UrlParser.scala:295)
at io.lemonlabs.uri.Host$.parseTry(Host.scala:74)
at io.lemonlabs.uri.Host$.parse(Host.scala:80)
... 40 elided
Hosts that begin with an IP but have further leading characters are not parsed correctly. It's possible to create a
Url
object, get it's host and fail to parse it using theHost.parse
method. See example below.To Reproduce