-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
fixed TLSSocket documentation error from Issue #3963. #14062
Changes from 1 commit
55f3170
09f8564
cbbe60c
7e766ff
8b945f8
5144cf4
fda1b66
de3d050
872132e
5c41572
955ad0f
9658ac3
077508d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -885,7 +885,7 @@ the socket option: | |
const { Socket } = require('net'); | ||
const tls = require('tls'); | ||
const sock = new Socket(); | ||
const secureSock = tls.connect({ port: 6697, host: 'irc.freenode.net' }, () => { | ||
const secureSock = tls.connect({ socket: sock }, () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you rename There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks man! Destructured. |
||
console.log('The tls socket connected.'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. 😄 Altered! |
||
}); | ||
``` | ||
|
@@ -895,7 +895,7 @@ use only `tls.connect()` to upgrade the socket: | |
|
||
```js | ||
const tls = require('tls'); | ||
const secureSock = tls.connect({ port: 6697, host: 'irc.freenode.net' }, () => { | ||
const secureSock = tls.connect({ port: 6697, host: 'https://example.org:443/' }, () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am sorry if we were too vague about this, but this is not how TLS sockets work. You need to specify There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ha, sorry - this is now fixed. Thanks so much for your patience, @tniessen 😝 |
||
console.log('The tls socket connected.'); | ||
}); | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this variable used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhm something went wrong here... The original code (see first commit) looked like
tls.connect({ socket: sock })
. @VerteDinde You probably don't want to usetls.connect({ port: 6697, host: 'irc.freenode.net' })
in both cases, right? This won't upgrade an existing socket, it establishes a new connection.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right! Just updated to reflect that variable and changed the
irc.freenode.net
tohttps://example.org:443/
.