Node: Inconsistent documentation: hostname vs host

Created on 22 May 2018  路  17Comments  路  Source: nodejs/node

The Node.js documentation is currently rather freeform when it comes to distinguishing between hostname and host. There are arguments and properties named host that refer to hostname and their description makes as much clear. There are also arguments and properties that refer to host in both the name and the description, despite actually intending to represent the hostname.

This can without any doubt create confusion for end users but also for contributors. For a recent example see: https://github.com/nodejs/node/pull/20875 or https://github.com/nodejs/node/pull/20493

I think it would be nice if we could slowly update the the documentation and code to be more clear about this. While we cannot change property names on options objects, argument names can certainly be changed and documentation can be updated.

Some example entries:

https://nodejs.org/dist/latest-v10.x/docs/api/tls.html#tls_tls_checkserveridentity_host_cert
https://nodejs.org/dist/latest-v10.x/docs/api/tls.html#tls_tls_connect_port_host_options_callback
https://nodejs.org/dist/latest-v10.x/docs/api/tls.html#tls_tls_connect_options_callback
https://nodejs.org/dist/latest-v10.x/docs/api/net.html#net_server_listen_options_callback

doc good first issue help wanted

Most helpful comment

Interested in picking this up...

All 17 comments

@nodejs/documentation @nodejs/http @nodejs/http2

Definitely 馃憤 . I think this would be a good source of tasks for a code&learn.

I agree, this is a source of confusion for myself.

This ASCII Chart does a good job of explaining the difference.

I even found a Chrome Bug after reading through the Node.js docs regarding hostname assignment.

All that to say, I agree with this change 馃憤

Interested in picking this up...

@davisokoth let me know if you need any guidance. There are a few links in the OP to documentation mistakes but it would be nice to also update some of the variable names in our code. Feel free to also open a PR just with one of those documentation changes 鈥斅爓e don't have to change everything all at once.

Also interested in contributing to this

Also interested in contributing to this if help is still needed

I am also interested in contributing...

@apapirovski anything left to be done or can you please point other issue to work on?

I'm working on doc/api/net.md and the corresponding lib/net.js.

I'm interested in getting involved in this project. Thanks guys.

@thatshailesh @sagirk @graezzon There's definitely more to be done. Some of the links in the OP haven't been updated and there are likely more instances of this in the codebase. Just look for any irregularities of hostname vs host usage, in particular cases where the term is used interchangeably to refer to the same thing.

@apapirovski I ran a project-wide search and found a few instances of this issue in

  • doc/api/tls.md and the corresponding lib/tls.js
  • doc/api/net.md and the corresponding lib/net.js _(taken; I'm working on this)_
  • doc/api/dns.md and the corresponding lib/dns.js

@benjipelletier @lliepert @UlisesGascon @thatshailesh @graezzon Take a look at one of the files listed above and claim it in this thread so we know who is working on what.

Thanks @sagirk! I am working now in doc/api/dns.md and lib/dns.js. I can take tls too after that if nobody else does ;-)

Hi All
I will be taking doc/api/tls.md and lib/tls.js
Thanks @sagirk

Hi guys, I'm late to join. I'm interested to contribute as well. Can I get started. Are there any open tasks to pick up?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

srl295 picture srl295  路  3Comments

vsemozhetbyt picture vsemozhetbyt  路  3Comments

sandeepks1 picture sandeepks1  路  3Comments

fanjunzhi picture fanjunzhi  路  3Comments

Brekmister picture Brekmister  路  3Comments