undici 6.14.0 → 6.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,7 @@ Returns: `Client`
23
23
  * **headersTimeout** `number | null` (optional) - Default: `300e3` - The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers while not sending the request. Defaults to 300 seconds.
24
24
  * **keepAliveMaxTimeout** `number | null` (optional) - Default: `600e3` - The maximum allowed `keepAliveTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Defaults to 10 minutes.
25
25
  * **keepAliveTimeout** `number | null` (optional) - Default: `4e3` - The timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. See [MDN: HTTP - Headers - Keep-Alive directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive#directives) for more details. Defaults to 4 seconds.
26
- * **keepAliveTimeoutThreshold** `number | null` (optional) - Default: `1e3` - A number of milliseconds subtracted from server *keep-alive* hints when overriding `keepAliveTimeout` to account for timing inaccuracies caused by e.g. transport latency. Defaults to 1 second.
26
+ * **keepAliveTimeoutThreshold** `number | null` (optional) - Default: `2e3` - A number of milliseconds subtracted from server *keep-alive* hints when overriding `keepAliveTimeout` to account for timing inaccuracies caused by e.g. transport latency. Defaults to 2 seconds.
27
27
  * **maxHeaderSize** `number | null` (optional) - Default: `--max-http-header-size` or `16384` - The maximum length of request headers in bytes. Defaults to Node.js' --max-http-header-size or 16KiB.
28
28
  * **maxResponseSize** `number | null` (optional) - Default: `-1` - The maximum length of response body in bytes. Set to `-1` to disable.
29
29
  * **pipelining** `number | null` (optional) - Default: `1` - The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Carefully consider your workload and environment before enabling concurrent requests as pipelining may reduce performance if used incorrectly. Pipelining is sensitive to network stack settings as well as head of line blocking caused by e.g. long running requests. Set to `0` to disable keep-alive connections.
@@ -4,11 +4,11 @@ Stability: Experimental.
4
4
 
5
5
  Extends: `undici.Dispatcher`
6
6
 
7
- EnvHttpProxyAgent automatically reads the proxy configuration from the environment variables `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` and sets up the proxy agents accordingly. When `HTTP_PROXY` and `HTTPS_PROXY` are set, `HTTP_PROXY` is used for HTTP requests and `HTTPS_PROXY` is used for HTTPS requests. If only `HTTP_PROXY` is set, `HTTP_PROXY` is used for both HTTP and HTTPS requests. If only `HTTPS_PROXY` is set, it is only used for HTTPS requests.
7
+ EnvHttpProxyAgent automatically reads the proxy configuration from the environment variables `http_proxy`, `https_proxy`, and `no_proxy` and sets up the proxy agents accordingly. When `http_proxy` and `https_proxy` are set, `http_proxy` is used for HTTP requests and `https_proxy` is used for HTTPS requests. If only `http_proxy` is set, `http_proxy` is used for both HTTP and HTTPS requests. If only `https_proxy` is set, it is only used for HTTPS requests.
8
8
 
9
- `NO_PROXY` is a comma or space-separated list of hostnames that should not be proxied. The list may contain leading wildcard characters (`*`). If `NO_PROXY` is set, the EnvHttpProxyAgent will bypass the proxy for requests to hosts that match the list. If `NO_PROXY` is set to `"*"`, the EnvHttpProxyAgent will bypass the proxy for all requests.
9
+ `no_proxy` is a comma or space-separated list of hostnames that should not be proxied. The list may contain leading wildcard characters (`*`). If `no_proxy` is set, the EnvHttpProxyAgent will bypass the proxy for requests to hosts that match the list. If `no_proxy` is set to `"*"`, the EnvHttpProxyAgent will bypass the proxy for all requests.
10
10
 
11
- Lower case environment variables are also supported: `http_proxy`, `https_proxy`, and `no_proxy`. However, if both the lower case and upper case environment variables are set, the lower case environment variables will be ignored.
11
+ Uppercase environment variables are also supported: `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`. However, if both the lowercase and uppercase environment variables are set, the uppercase environment variables will be ignored.
12
12
 
13
13
  ## `new EnvHttpProxyAgent([options])`
14
14
 
@@ -226,7 +226,7 @@ class Client extends DispatcherBase {
226
226
  this[kMaxHeadersSize] = maxHeaderSize || http.maxHeaderSize
227
227
  this[kKeepAliveDefaultTimeout] = keepAliveTimeout == null ? 4e3 : keepAliveTimeout
228
228
  this[kKeepAliveMaxTimeout] = keepAliveMaxTimeout == null ? 600e3 : keepAliveMaxTimeout
229
- this[kKeepAliveTimeoutThreshold] = keepAliveTimeoutThreshold == null ? 1e3 : keepAliveTimeoutThreshold
229
+ this[kKeepAliveTimeoutThreshold] = keepAliveTimeoutThreshold == null ? 2e3 : keepAliveTimeoutThreshold
230
230
  this[kKeepAliveTimeoutValue] = this[kKeepAliveDefaultTimeout]
231
231
  this[kServerName] = null
232
232
  this[kLocalAddress] = localAddress != null ? localAddress : null
@@ -32,14 +32,14 @@ class EnvHttpProxyAgent extends DispatcherBase {
32
32
 
33
33
  this[kNoProxyAgent] = new Agent(agentOpts)
34
34
 
35
- const HTTP_PROXY = httpProxy ?? process.env.HTTP_PROXY ?? process.env.http_proxy
35
+ const HTTP_PROXY = httpProxy ?? process.env.http_proxy ?? process.env.HTTP_PROXY
36
36
  if (HTTP_PROXY) {
37
37
  this[kHttpProxyAgent] = new ProxyAgent({ ...agentOpts, uri: HTTP_PROXY })
38
38
  } else {
39
39
  this[kHttpProxyAgent] = this[kNoProxyAgent]
40
40
  }
41
41
 
42
- const HTTPS_PROXY = httpsProxy ?? process.env.HTTPS_PROXY ?? process.env.https_proxy
42
+ const HTTPS_PROXY = httpsProxy ?? process.env.https_proxy ?? process.env.HTTPS_PROXY
43
43
  if (HTTPS_PROXY) {
44
44
  this[kHttpsProxyAgent] = new ProxyAgent({ ...agentOpts, uri: HTTPS_PROXY })
45
45
  } else {
@@ -153,7 +153,7 @@ class EnvHttpProxyAgent extends DispatcherBase {
153
153
  }
154
154
 
155
155
  get #noProxyEnv () {
156
- return process.env.NO_PROXY ?? process.env.no_proxy ?? ''
156
+ return process.env.no_proxy ?? process.env.NO_PROXY ?? ''
157
157
  }
158
158
  }
159
159
 
@@ -1,5 +1,7 @@
1
1
  'use strict'
2
2
 
3
+ const TICK_MS = 499
4
+
3
5
  let fastNow = Date.now()
4
6
  let fastNowTimeout
5
7
 
@@ -14,7 +16,7 @@ function onTimeout () {
14
16
  const timer = fastTimers[idx]
15
17
 
16
18
  if (timer.state === 0) {
17
- timer.state = fastNow + timer.delay
19
+ timer.state = fastNow + timer.delay - TICK_MS
18
20
  } else if (timer.state > 0 && fastNow >= timer.state) {
19
21
  timer.state = -1
20
22
  timer.callback(timer.opaque)
@@ -43,7 +45,7 @@ function refreshTimeout () {
43
45
  fastNowTimeout.refresh()
44
46
  } else {
45
47
  clearTimeout(fastNowTimeout)
46
- fastNowTimeout = setTimeout(onTimeout, 1e3)
48
+ fastNowTimeout = setTimeout(onTimeout, TICK_MS)
47
49
  if (fastNowTimeout.unref) {
48
50
  fastNowTimeout.unref()
49
51
  }
@@ -83,7 +85,7 @@ class Timeout {
83
85
 
84
86
  module.exports = {
85
87
  setTimeout (callback, delay, opaque) {
86
- return delay < 1e3
88
+ return delay <= 1e3
87
89
  ? setTimeout(callback, delay, opaque)
88
90
  : new Timeout(callback, delay, opaque)
89
91
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undici",
3
- "version": "6.14.0",
3
+ "version": "6.14.1",
4
4
  "description": "An HTTP/1.1 client, written from scratch for Node.js",
5
5
  "homepage": "https://undici.nodejs.org",
6
6
  "bugs": {
@@ -104,7 +104,7 @@
104
104
  "@sinonjs/fake-timers": "^11.1.0",
105
105
  "@types/node": "^18.0.3",
106
106
  "abort-controller": "^3.0.0",
107
- "borp": "^0.11.0",
107
+ "borp": "^0.12.0",
108
108
  "c8": "^9.1.0",
109
109
  "cross-env": "^7.0.3",
110
110
  "dns-packet": "^5.4.0",