runtimejs / runtime

[not maintained] Lightweight JavaScript library operating system for the cloud
http://runtimejs.org
Apache License 2.0
1.93k stars 128 forks source link

Fix "AssertionError: false == true" #57

Closed facekapow closed 9 years ago

facekapow commented 9 years ago

This fix prevents an AssertionError when given a domain including the URL schema (http...). Note: The regex used returns the domain like "www.example.com", i'm sure this is what it expects.

facekapow commented 9 years ago

Nevermind, have to test it first. Need to tweak it. Closing and fixing.

iefserge commented 9 years ago

@ArielAbreu I think this should be a part of http code that resolves URLs, DNS resolver knows nothing about URLs (or other protocol addresses) and cares only about hostnames.

facekapow commented 9 years ago

OK, I found a regex that works no matter what URL you give it. Ex: "http://httpbin.org/ip" -> "httpbin.org" Putting into the code that resolves URLs.

iefserge commented 9 years ago

Thank you!

facekapow commented 9 years ago

Going to place in runtime-node-net, which is what resolves the IP.

iefserge commented 9 years ago

Yep, sounds good.

iefserge commented 9 years ago

@ArielAbreu Btw, there is a parse function that can parse URLs, might be simpler than using regex https://nodejs.org/api/url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost

facekapow commented 9 years ago

Thanks for the tip. Probably going to use it.