| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5fddde6 commit 53cc16c
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,15 +24,23 @@ An [`Agent`][] object for HTTPS similar to [`http.Agent`][]. See | |||
| 24 | 24 | [`https.request()`][] for more information. | |
| 25 | 25 | ||
| 26 | 26 | ### new Agent([options]) | |
| 27 | - | ||
| 27 | + <!-- YAML | ||
| 28 | + changes: | ||
| 29 | + - version: REPLACEME | ||
| 30 | + pr-url: https://github.com/nodejs/node/pull/28209 | ||
| 31 | + description: do not automatically set servername if the target host was | ||
| 32 | + specified using an IP address. | ||
| 33 | + --> | ||
| 28 | 34 | * `options` {Object} Set of configurable options to set on the agent. | |
| 29 | 35 | Can have the same fields as for [`http.Agent(options)`][], and | |
| 30 | 36 | * `maxCachedSessions` {number} maximum number of TLS cached sessions. | |
| 31 | 37 | Use `0` to disable TLS session caching. **Default:** `100`. | |
| 32 | 38 | * `servername` {string} the value of | |
| 33 | 39 | [Server Name Indication extension][sni wiki] to be sent to the server. Use | |
| 34 | 40 | empty string `''` to disable sending the extension. | |
| 35 | - **Default:** hostname or IP address of the target server. | ||
| 41 | + **Default:** hostname of the target server, unless the target server | ||
| 42 | + is specified using an IP address, in which case the default is `''` (no | ||
| 43 | + extension). | ||
| 36 | 44 | ||
| 37 | 45 | See [`Session Resumption`][] for infomation about TLS session reuse. | |
| 38 | 46 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -256,6 +256,9 @@ function calculateServerName(options, req) { | |||
| 256 | 256 | servername = hostHeader.split(':', 1)[0]; | |
| 257 | 257 | } | |
| 258 | 258 | } | |
| 259 | + // Don't implicitly set invalid (IP) servernames. | ||
| 260 | + if (net.isIP(servername)) | ||
| 261 | + servername = ''; | ||
| 259 | 262 | return servername; | |
| 260 | 263 | } | |
| 261 | 264 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,6 +29,9 @@ if (!common.hasCrypto) | |||
| 29 | 29 | const assert = require('assert'); | |
| 30 | 30 | const https = require('https'); | |
| 31 | 31 | ||
| 32 | + // Assert that the IP-as-servername deprecation warning does not occur. | ||
| 33 | + process.on('warning', common.mustNotCall()); | ||
| 34 | + | ||
| 32 | 35 | const options = { | |
| 33 | 36 | key: fixtures.readKey('agent1-key.pem'), | |
| 34 | 37 | cert: fixtures.readKey('agent1-cert.pem') | |
| Back | FazBrowse Home | New Git URL |
0 commit comments