garycourt/uri-js

xip.io hosts parse fail

terion-name opened this issue · 1 comments

Hi.
There is a problem with parser in host recognition.

For example:
http://10.10.10.10.xip.io/en/process

errors: Array[0]
fragment: undefined
host: "10.10.10.10"
path: ".xip.io/en/ingredients"
port: undefined
query: undefined
reference: "absolute"
scheme: "http"
userinfo: undefined

But:
http://sub.10.10.10.10.xip.io/en/process

errors: Array[0]
fragment: undefined
host: "sub.10.10.10.10.xip.io"
path: "/ru/process"
port: undefined
query: undefined
reference: "absolute"
scheme: "http"
userinfo: undefined

In first case host was recognized incorrectly

Interesting; it's matching the host too early because it thinks it's an IPv4 address. I'll take a look at it tonight and see how to fix this.