garycourt / uri-js

An RFC 3986 compliant, scheme extendable URI parsing/validating/normalizing/resolving library for JavaScript
Other
306 stars 68 forks source link

xip.io hosts parse fail #4

Closed terion-name closed 10 years ago

terion-name commented 10 years ago

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

garycourt commented 10 years ago

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.