Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeprecationWarning when connection to IP address over wss #1829

Closed
1 task done
Hornwitser opened this issue Dec 28, 2020 · 1 comment
Closed
1 task done

DeprecationWarning when connection to IP address over wss #1829

Hornwitser opened this issue Dec 28, 2020 · 1 comment

Comments

@Hornwitser
Copy link

  • I've searched for any related issues and avoided creating a duplicate
    issue.

Description

Connecting to IP addresses over wss causes a deprecation warning to emitted.

Reproducible in:

  • version: 7.3.1
  • Node.js version(s): 14.9.0
  • OS version(s): Linux 5.8.5-arch1-1

Steps to reproduce:

Connect to a WebSocket endpoint over a wss url to an IP address:

const WebSocket = require("ws");
const ws = new WebSocket("wss://1.1.1.1/");
ws.on("error", () => {});

Observer node print a Deprecation warning:

(node:2399511) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version.
    at Object.connect (_tls_wrap.js:1619:15)
    at Object.tlsConnect [as createConnection] (node_modules/ws/lib/websocket.js:673:14)
    at new ClientRequest (_http_client.js:312:33)
    at request (https.js:312:10)
    at get (https.js:316:15)
    at initAsClient (node_modules/ws/lib/websocket.js:538:31)
    at new WebSocket (node_modules/ws/lib/websocket.js:72:7)
    at Object.<anonymous> (bug.js:2:12)
    at Module._compile (internal/modules/cjs/loader.js:1075:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1096:10)

Expected result:

No deprecation warning from using wss urls to IP addresses.

Actual result:

ws erroneously set the servername TLS option to an IP address. Compare what ws does vs what node does. Node does not set the servername option if the host is an IP address while ws does.

@Hornwitser Hornwitser changed the title DeprecationWarning when connection to IP address over wss. DeprecationWarning when connection to IP address over wss Dec 28, 2020
@lpinca lpinca closed this as completed in a2c0d44 Dec 28, 2020
@lpinca
Copy link
Member

lpinca commented Dec 28, 2020

Thank you for the good report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants