Closed christophgysin closed 7 years ago
The failing check seems to fail on master too: https://travis-ci.org/75lb/local-web-server/branches
Hi, thanks for this PR - it highlighted that local-web-server was suddenly broken in node v4 and v5 thanks to misuse of semver in the Koa project.
Thanks for the new feature - I started looking at it but have run out of time, for now. Will look again tonight. The first issues i noticed were lack of basic validation:
$ ws -a
serving at http://null:8000
$ ws -a server.home
events.js:163
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND server.home
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:73:26)
Will look more later.
I confess that I have not done much input validation.
$ ws -a serving at http://null:8000
This seems like something the command line parser should handle. Is there a way to mark the argument to -a
as required?
$ ws -a server.home events.js:163 throw er; // Unhandled 'error' event ^
Error: getaddrinfo ENOTFOUND server.home at errnoException (dns.js:28:10) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:73:26)
While verification for this can be implemented, it requires a DNS lookup. Maybe it would be better to only allow IP addresses. They can easily be validated. Is there a real use-case for listening on a hostname? It's usually either 127.0.0.1
or 0.0.0.0
, or then a specific IP address assigned to a local interface.
don't worry, I will see to this feature. I working on version 2 of local-web-server as we speak, it is long overdue. I'll let you know once it's in beta!
Also, defaults to listening on localhost by default. Set
--address 0.0.0.0
to listen on all interfaces.fixes #55