Skip to content

tls: stronger validation for 'servername' in server.addContext

If 'servername' is not provided, 'ERR_MISSING_ARGS is thrown. If 'servername' is not a string, 'ERR_INVALID_ARG_TYPE' is thrown. If 'servername' is an IP address, 'ERR_INVALID_ARG_VALUE' is thrown, since literal IPv4 and IPv6 addresses are not permitted in SNI.

Fixed API documentation ('hostname' -> 'servername').

Also removed a redundant error 'ERR_TLS_REQUIRED_SERVER_NAME'.

This PR was inspired by: https://github.com/nodejs/node/pull/19988

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Merge request reports

Loading