File tree Expand file tree Collapse file tree 4 files changed +31
-53
lines changed Expand file tree Collapse file tree 4 files changed +31
-53
lines changed Original file line number Diff line number Diff line change @@ -2608,15 +2608,18 @@ Please use `Server.prototype.setSecureContext()` instead.
2608
2608
2609
2609
<!-- YAML
2610
2610
changes:
2611
+ - version: REPLACEME
2612
+ pr-url: https://github.com/nodejs/node/pull/58533
2613
+ description: End-of-Life.
2611
2614
- version: v12.0.0
2612
2615
pr-url: https://github.com/nodejs/node/pull/23329
2613
2616
description: Runtime deprecation.
2614
2617
-->
2615
2618
2616
- Type: Runtime
2619
+ Type: End-of-Life
2617
2620
2618
2621
Setting the TLS ServerName to an IP address is not permitted by
2619
- [ RFC 6066] [ ] . This will be ignored in a future version.
2622
+ [ RFC 6066] [ ] .
2620
2623
2621
2624
### DEP0124: using ` REPLServer.rli `
2622
2625
Original file line number Diff line number Diff line change @@ -112,7 +112,6 @@ const kIsVerified = Symbol('verified');
112
112
113
113
const noop = ( ) => { } ;
114
114
115
- let ipServernameWarned = false ;
116
115
let tlsTracingWarned = false ;
117
116
118
117
// Server side times how long a handshake is taking to protect against slow
@@ -1715,6 +1714,14 @@ exports.connect = function connect(...args) {
1715
1714
1716
1715
const context = options . secureContext || tls . createSecureContext ( options ) ;
1717
1716
1717
+ if ( options . servername && net . isIP ( options . servername ) ) {
1718
+ throw new ERR_INVALID_ARG_VALUE (
1719
+ 'options.servername' ,
1720
+ options . servername ,
1721
+ 'Setting the TLS ServerName to an IP address is not permitted.' ,
1722
+ ) ;
1723
+ }
1724
+
1718
1725
const tlssock = new TLSSocket ( options . socket , {
1719
1726
allowHalfOpen : options . allowHalfOpen ,
1720
1727
pipe : ! ! options . path ,
@@ -1760,15 +1767,6 @@ exports.connect = function connect(...args) {
1760
1767
tlssock . setSession ( options . session ) ;
1761
1768
1762
1769
if ( options . servername ) {
1763
- if ( ! ipServernameWarned && net . isIP ( options . servername ) ) {
1764
- process . emitWarning (
1765
- 'Setting the TLS ServerName to an IP address is not permitted by ' +
1766
- 'RFC 6066. This will be ignored in a future version.' ,
1767
- 'DeprecationWarning' ,
1768
- 'DEP0123' ,
1769
- ) ;
1770
- ipServernameWarned = true ;
1771
- }
1772
1770
tlssock . setServername ( options . servername ) ;
1773
1771
}
1774
1772
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const common = require ( '../common' ) ;
4
+ const { throws } = require ( 'assert' ) ;
5
+
6
+ if ( ! common . hasCrypto )
7
+ common . skip ( 'missing crypto' ) ;
8
+
9
+ const tls = require ( 'tls' ) ;
10
+
11
+ // Verify that passing an IP address the the servername option
12
+ // throws an error.
13
+ throws ( ( ) => tls . connect ( {
14
+ port : 1234 ,
15
+ servername : '127.0.0.1' ,
16
+ } , common . mustNotCall ( ) ) , {
17
+ code : 'ERR_INVALID_ARG_VALUE' ,
18
+ } ) ;
You can’t perform that action at this time.
0 commit comments