/^host\s*:\s*(\S+)/i out of an HTTP stream and report back as soon as
possible. This is useful if you're writing something like a load balancer or
http host router.
var prehost = ;;
Connect to the server and you'll see 'Host: ...' values get printed when you try to visit the service on port 8000 with curl or a browser.
var prehost = ;
Create a new network server with the arguments in
... and try to parse HTTP
If there is an error,
err will be set in
req is an object with the keys:
prehost() returns the server object.
After parsing the host, the parser stops looking at data.
This behavior will break for
Connection: keep-alive or multipart requests.
With npm do:
npm install prehost