File tree Expand file tree Collapse file tree 3 files changed +60
-3
lines changed Expand file tree Collapse file tree 3 files changed +60
-3
lines changed Original file line number Diff line number Diff line change @@ -2293,6 +2293,20 @@ Type: Runtime
2293
2293
Please use `Server.prototype.setSecureContext()` instead.
2294
2294
2295
2295
2296
+ <a id="DEP00XX"></a>
2297
+ ### DEP00XX: setting the TLS ServerName to an IP address
2298
+ <!-- YAML
2299
+ changes:
2300
+ - version: REPLACEME
2301
+ pr-url: https://github.com/nodejs/node/pull/REPLACEME
2302
+ description: Runtime deprecation.
2303
+ -->
2304
+
2305
+ Type: Runtime
2306
+
2307
+ Setting the TLS ServerName to an IP address is not permitted by
2308
+ [RFC 6066][]. This will be ignored in a future version.
2309
+
2296
2310
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
2297
2311
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
2298
2312
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
@@ -2393,3 +2407,4 @@ Please use `Server.prototype.setSecureContext()` instead.
2393
2407
[legacy `urlObject`]: url.html#url_legacy_urlobject
2394
2408
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
2395
2409
[WHATWG URL API]: url.html#url_the_whatwg_url_api
2410
+ [RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
Original file line number Diff line number Diff line change @@ -1235,9 +1235,10 @@ exports.connect = function connect(...args) {
1235
1235
if ( options . servername ) {
1236
1236
if ( ! ipServernameWarned && net . isIP ( options . servername ) ) {
1237
1237
process . emitWarning (
1238
- 'Setting the TLS ServerName to an IP address is not supported by ' +
1239
- 'RFC6066. This will be ignored in a future version.' ,
1240
- 'UnsupportedWarning'
1238
+ 'Setting the TLS ServerName to an IP address is not permitted by ' +
1239
+ 'RFC 6066. This will be ignored in a future version.' ,
1240
+ 'DeprecationWarning' ,
1241
+ 'DEP00XX'
1241
1242
) ;
1242
1243
ipServernameWarned = true ;
1243
1244
}
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const common = require ( '../common' ) ;
4
+ const fixtures = require ( '../common/fixtures' ) ;
5
+
6
+ if ( ! common . hasCrypto )
7
+ common . skip ( 'missing crypto' ) ;
8
+
9
+ const tls = require ( 'tls' ) ;
10
+
11
+ // This test expects `tls.connect()` to emit a warning when
12
+ // `servername` of options is an IP address.
13
+ common . expectWarning (
14
+ 'DeprecationWarning' ,
15
+ 'Setting the TLS ServerName to an IP address is not permitted by ' +
16
+ 'RFC 6066. This will be ignored in a future version.' ,
17
+ 'DEP00XX'
18
+ ) ;
19
+
20
+ {
21
+ const options = {
22
+ key : fixtures . readKey ( 'agent1-key.pem' ) ,
23
+ cert : fixtures . readKey ( 'agent1-cert.pem' )
24
+ } ;
25
+
26
+ const server = tls . createServer ( options , function ( s ) {
27
+ s . end ( 'hello' ) ;
28
+ } ) . listen ( 0 , function ( ) {
29
+ const client = tls . connect ( {
30
+ port : this . address ( ) . port ,
31
+ rejectUnauthorized : false ,
32
+ servername : '127.0.0.1' ,
33
+ } , function ( ) {
34
+ client . end ( ) ;
35
+ } ) ;
36
+ } ) ;
37
+
38
+ server . on ( 'connection' , common . mustCall ( function ( socket ) {
39
+ server . close ( ) ;
40
+ } ) ) ;
41
+ }
You can’t perform that action at this time.
0 commit comments