Skip to content

Commit 498f2ae

Browse files
committed
Set servername on tls connect - fixes porsager#543
1 parent c62243d commit 498f2ae

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

deno/polyfills.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
/* global Deno */
22

33
import { Buffer } from 'https://deno.land/std@0.132.0/node/buffer.ts'
4+
import { isIP } from 'https://deno.land/std@0.132.0/node/net.ts'
45

56
const events = () => ({ data: [], error: [], drain: [], connect: [], secureConnect: [], close: [] })
67

78
export const net = {
9+
isIP,
810
createServer() {
911
const server = {
1012
address() {

src/connection.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
266266
socket.removeAllListeners()
267267
socket = tls.connect({
268268
socket,
269+
servername: net.isIP(socket.host) ? undefined : socket.host,
269270
...(ssl === 'require' || ssl === 'allow' || ssl === 'prefer'
270271
? { rejectUnauthorized: false }
271272
: ssl === 'verify-full'

0 commit comments

Comments
 (0)