http-server icon indicating copy to clipboard operation
http-server copied to clipboard

Printing interfaces filters incorrectly on node 18 (in server listening message)

Open alexanderankin opened this issue 2 years ago • 2 comments

This library prints ip addresses to stdout if they are ipv4 after listening. it does this by calling os.networkInterfaces(), which now returns 4 or 6 (unlike before in v17 - family <string> Either IPv4 or IPv6).

Environment Versions

  1. OS Type - any
  2. Node version: $ node --version: v18.0.0
  3. http-server version: $ http-server --version present in latest master - https://github.com/http-party/http-server/blob/318c55f8c966f7a7c98c84fee3c30fce2d0bf045/bin/http-server#L229

Steps to reproduce

  1. install node 18
  2. start server

Expected result

server prints:

Starting up http-server, serving ./
Available on:
  http://127.0.0.1:8082
Hit CTRL-C to stop the server

Actual result

server prints:

Starting up http-server, serving ./
Available on:
Hit CTRL-C to stop the server

Other information

I think the library should take into the current value of process.version when printing listening interfaces. Better yet would be to not check this at all. why not show the user (properly formatted) ipv6 links? I will submit a fix that replicates the old business logic, the new business logic could be considered in a different ticket.

alexanderankin avatar May 09 '22 07:05 alexanderankin

ping for this

lygstate avatar May 17 '22 20:05 lygstate

This issue has been inactive for 180 days

github-actions[bot] avatar Nov 14 '22 12:11 github-actions[bot]