Skip to content

Commit 91dda5f

Browse files
authored
deps: update undici to 6.22.0
Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: #60112 Reviewed-By: Richard Lau <richard.lau@ibm.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
1 parent 27cf259 commit 91dda5f

12 files changed

Lines changed: 1679 additions & 22 deletions

File tree

‎deps/undici/src/docs/docs/api/ProxyAgent.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ For detailed information on the parsing process and potential validation errors,
2222
***token**`string` (optional) - It can be passed by a string of token for authentication.
2323
***auth**`string` (**deprecated**) - Use token.
2424
***clientFactory**`(origin: URL, opts: Object) => Dispatcher` (optional) - Default: `(origin, opts) => new Pool(origin, opts)`
25-
***requestTls**`BuildOptions` (optional) - Options object passed when creating the underlying socket via the connector builder for the request. See [TLS](https://nodejs.org/api/tls.html#tlsconnectoptions-callback).
26-
***proxyTls**`BuildOptions` (optional) - Options object passed when creating the underlying socket via the connector builder for the proxy server. See [TLS](https://nodejs.org/api/tls.html#tlsconnectoptions-callback).
25+
***requestTls**`BuildOptions` (optional) - Options object passed when creating the underlying socket via the connector builder for the request. It extends from [`Client#ConnectOptions`](/docs/docs/api/Client.md#parameter-connectoptions).
26+
***proxyTls**`BuildOptions` (optional) - Options object passed when creating the underlying socket via the connector builder for the proxy server. It extends from [`Client#ConnectOptions`](/docs/docs/api/Client.md#parameter-connectoptions).
27+
***proxyTunnel**`boolean` (optional) - For connections involving secure protocols, Undici will always establish a tunnel via the HTTP2 CONNECT extension. If proxyTunnel is set to true, this will occur for unsecured proxy/endpoint connections as well. Currently, there is no way to facilitate HTTP1 IP tunneling as described in https://www.rfc-editor.org/rfc/rfc9484.html#name-http-11-request. If proxyTunnel is set to false (the default), ProxyAgent connections where both the Proxy and Endpoint are unsecured will issue all requests to the Proxy, and prefix the endpoint request path with the endpoint origin address.
2728

2829
Examples:
2930

‎deps/undici/src/index-fetch.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ module.exports.createFastMessageEvent = createFastMessageEvent
2626

2727
module.exports.EventSource=require('./lib/web/eventsource/eventsource').EventSource
2828

29+
constapi=require('./lib/api')
30+
constDispatcher=require('./lib/dispatcher/dispatcher')
31+
Object.assign(Dispatcher.prototype,api)
2932
// Expose the fetch implementation to be enabled in Node.js core via a flag
3033
module.exports.EnvHttpProxyAgent=EnvHttpProxyAgent
3134
module.exports.getGlobalDispatcher=getGlobalDispatcher

‎deps/undici/src/lib/core/errors.js‎

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,85 @@
11
'use strict'
22

3+
constkUndiciError=Symbol.for('undici.error.UND_ERR')
34
classUndiciErrorextendsError{
45
constructor(message){
56
super(message)
67
this.name='UndiciError'
78
this.code='UND_ERR'
89
}
10+
11+
static[Symbol.hasInstance](instance){
12+
returninstance&&instance[kUndiciError]===true
13+
}
14+
15+
[kUndiciError]=true
916
}
1017

18+
constkConnectTimeoutError=Symbol.for('undici.error.UND_ERR_CONNECT_TIMEOUT')
1119
classConnectTimeoutErrorextendsUndiciError{
1220
constructor(message){
1321
super(message)
1422
this.name='ConnectTimeoutError'
1523
this.message=message||'Connect Timeout Error'
1624
this.code='UND_ERR_CONNECT_TIMEOUT'
1725
}
26+
27+
static[Symbol.hasInstance](instance){
28+
returninstance&&instance[kConnectTimeoutError]===true
29+
}
30+
31+
[kConnectTimeoutError]=true
1832
}
1933

34+
constkHeadersTimeoutError=Symbol.for('undici.error.UND_ERR_HEADERS_TIMEOUT')
2035
classHeadersTimeoutErrorextendsUndiciError{
2136
constructor(message){
2237
super(message)
2338
this.name='HeadersTimeoutError'
2439
this.message=message||'Headers Timeout Error'
2540
this.code='UND_ERR_HEADERS_TIMEOUT'
2641
}
42+
43+
static[Symbol.hasInstance](instance){
44+
returninstance&&instance[kHeadersTimeoutError]===true
45+
}
46+
47+
[kHeadersTimeoutError]=true
2748
}
2849

50+
constkHeadersOverflowError=Symbol.for('undici.error.UND_ERR_HEADERS_OVERFLOW')
2951
classHeadersOverflowErrorextendsUndiciError{
3052
constructor(message){
3153
super(message)
3254
this.name='HeadersOverflowError'
3355
this.message=message||'Headers Overflow Error'
3456
this.code='UND_ERR_HEADERS_OVERFLOW'
3557
}
58+
59+
static[Symbol.hasInstance](instance){
60+
returninstance&&instance[kHeadersOverflowError]===true
61+
}
62+
63+
[kHeadersOverflowError]=true
3664
}
3765

66+
constkBodyTimeoutError=Symbol.for('undici.error.UND_ERR_BODY_TIMEOUT')
3867
classBodyTimeoutErrorextendsUndiciError{
3968
constructor(message){
4069
super(message)
4170
this.name='BodyTimeoutError'
4271
this.message=message||'Body Timeout Error'
4372
this.code='UND_ERR_BODY_TIMEOUT'
4473
}
74+
75+
static[Symbol.hasInstance](instance){
76+
returninstance&&instance[kBodyTimeoutError]===true
77+
}
78+
79+
[kBodyTimeoutError]=true
4580
}
4681

82+
constkResponseStatusCodeError=Symbol.for('undici.error.UND_ERR_RESPONSE_STATUS_CODE')
4783
classResponseStatusCodeErrorextendsUndiciError{
4884
constructor(message,statusCode,headers,body){
4985
super(message)
@@ -55,88 +91,159 @@ class ResponseStatusCodeError extends UndiciError {
5591
this.statusCode=statusCode
5692
this.headers=headers
5793
}
94+
95+
static[Symbol.hasInstance](instance){
96+
returninstance&&instance[kResponseStatusCodeError]===true
97+
}
98+
99+
[kResponseStatusCodeError]=true
58100
}
59101

102+
constkInvalidArgumentError=Symbol.for('undici.error.UND_ERR_INVALID_ARG')
60103
classInvalidArgumentErrorextendsUndiciError{
61104
constructor(message){
62105
super(message)
63106
this.name='InvalidArgumentError'
64107
this.message=message||'Invalid Argument Error'
65108
this.code='UND_ERR_INVALID_ARG'
66109
}
110+
111+
static[Symbol.hasInstance](instance){
112+
returninstance&&instance[kInvalidArgumentError]===true
113+
}
114+
115+
[kInvalidArgumentError]=true
67116
}
68117

118+
constkInvalidReturnValueError=Symbol.for('undici.error.UND_ERR_INVALID_RETURN_VALUE')
69119
classInvalidReturnValueErrorextendsUndiciError{
70120
constructor(message){
71121
super(message)
72122
this.name='InvalidReturnValueError'
73123
this.message=message||'Invalid Return Value Error'
74124
this.code='UND_ERR_INVALID_RETURN_VALUE'
75125
}
126+
127+
static[Symbol.hasInstance](instance){
128+
returninstance&&instance[kInvalidReturnValueError]===true
129+
}
130+
131+
[kInvalidReturnValueError]=true
76132
}
77133

134+
constkAbortError=Symbol.for('undici.error.UND_ERR_ABORT')
78135
classAbortErrorextendsUndiciError{
79136
constructor(message){
80137
super(message)
81138
this.name='AbortError'
82139
this.message=message||'The operation was aborted'
140+
this.code='UND_ERR_ABORT'
141+
}
142+
143+
static[Symbol.hasInstance](instance){
144+
returninstance&&instance[kAbortError]===true
83145
}
146+
147+
[kAbortError]=true
84148
}
85149

150+
constkRequestAbortedError=Symbol.for('undici.error.UND_ERR_ABORTED')
86151
classRequestAbortedErrorextendsAbortError{
87152
constructor(message){
88153
super(message)
89154
this.name='AbortError'
90155
this.message=message||'Request aborted'
91156
this.code='UND_ERR_ABORTED'
92157
}
158+
159+
static[Symbol.hasInstance](instance){
160+
returninstance&&instance[kRequestAbortedError]===true
161+
}
162+
163+
[kRequestAbortedError]=true
93164
}
94165

166+
constkInformationalError=Symbol.for('undici.error.UND_ERR_INFO')
95167
classInformationalErrorextendsUndiciError{
96168
constructor(message){
97169
super(message)
98170
this.name='InformationalError'
99171
this.message=message||'Request information'
100172
this.code='UND_ERR_INFO'
101173
}
174+
175+
static[Symbol.hasInstance](instance){
176+
returninstance&&instance[kInformationalError]===true
177+
}
178+
179+
[kInformationalError]=true
102180
}
103181

182+
constkRequestContentLengthMismatchError=Symbol.for('undici.error.UND_ERR_REQ_CONTENT_LENGTH_MISMATCH')
104183
classRequestContentLengthMismatchErrorextendsUndiciError{
105184
constructor(message){
106185
super(message)
107186
this.name='RequestContentLengthMismatchError'
108187
this.message=message||'Request body length does not match content-length header'
109188
this.code='UND_ERR_REQ_CONTENT_LENGTH_MISMATCH'
110189
}
190+
191+
static[Symbol.hasInstance](instance){
192+
returninstance&&instance[kRequestContentLengthMismatchError]===true
193+
}
194+
195+
[kRequestContentLengthMismatchError]=true
111196
}
112197

198+
constkResponseContentLengthMismatchError=Symbol.for('undici.error.UND_ERR_RES_CONTENT_LENGTH_MISMATCH')
113199
classResponseContentLengthMismatchErrorextendsUndiciError{
114200
constructor(message){
115201
super(message)
116202
this.name='ResponseContentLengthMismatchError'
117203
this.message=message||'Response body length does not match content-length header'
118204
this.code='UND_ERR_RES_CONTENT_LENGTH_MISMATCH'
119205
}
206+
207+
static[Symbol.hasInstance](instance){
208+
returninstance&&instance[kResponseContentLengthMismatchError]===true
209+
}
210+
211+
[kResponseContentLengthMismatchError]=true
120212
}
121213

214+
constkClientDestroyedError=Symbol.for('undici.error.UND_ERR_DESTROYED')
122215
classClientDestroyedErrorextendsUndiciError{
123216
constructor(message){
124217
super(message)
125218
this.name='ClientDestroyedError'
126219
this.message=message||'The client is destroyed'
127220
this.code='UND_ERR_DESTROYED'
128221
}
222+
223+
static[Symbol.hasInstance](instance){
224+
returninstance&&instance[kClientDestroyedError]===true
225+
}
226+
227+
[kClientDestroyedError]=true
129228
}
130229

230+
constkClientClosedError=Symbol.for('undici.error.UND_ERR_CLOSED')
131231
classClientClosedErrorextendsUndiciError{
132232
constructor(message){
133233
super(message)
134234
this.name='ClientClosedError'
135235
this.message=message||'The client is closed'
136236
this.code='UND_ERR_CLOSED'
137237
}
238+
239+
static[Symbol.hasInstance](instance){
240+
returninstance&&instance[kClientClosedError]===true
241+
}
242+
243+
[kClientClosedError]=true
138244
}
139245

246+
constkSocketError=Symbol.for('undici.error.UND_ERR_SOCKET')
140247
classSocketErrorextendsUndiciError{
141248
constructor(message,socket){
142249
super(message)
@@ -145,44 +252,79 @@ class SocketError extends UndiciError {
145252
this.code='UND_ERR_SOCKET'
146253
this.socket=socket
147254
}
255+
256+
static[Symbol.hasInstance](instance){
257+
returninstance&&instance[kSocketError]===true
258+
}
259+
260+
[kSocketError]=true
148261
}
149262

263+
constkNotSupportedError=Symbol.for('undici.error.UND_ERR_NOT_SUPPORTED')
150264
classNotSupportedErrorextendsUndiciError{
151265
constructor(message){
152266
super(message)
153267
this.name='NotSupportedError'
154268
this.message=message||'Not supported error'
155269
this.code='UND_ERR_NOT_SUPPORTED'
156270
}
271+
272+
static[Symbol.hasInstance](instance){
273+
returninstance&&instance[kNotSupportedError]===true
274+
}
275+
276+
[kNotSupportedError]=true
157277
}
158278

279+
constkBalancedPoolMissingUpstreamError=Symbol.for('undici.error.UND_ERR_BPL_MISSING_UPSTREAM')
159280
classBalancedPoolMissingUpstreamErrorextendsUndiciError{
160281
constructor(message){
161282
super(message)
162283
this.name='MissingUpstreamError'
163284
this.message=message||'No upstream has been added to the BalancedPool'
164285
this.code='UND_ERR_BPL_MISSING_UPSTREAM'
165286
}
287+
288+
static[Symbol.hasInstance](instance){
289+
returninstance&&instance[kBalancedPoolMissingUpstreamError]===true
290+
}
291+
292+
[kBalancedPoolMissingUpstreamError]=true
166293
}
167294

295+
constkHTTPParserError=Symbol.for('undici.error.UND_ERR_HTTP_PARSER')
168296
classHTTPParserErrorextendsError{
169297
constructor(message,code,data){
170298
super(message)
171299
this.name='HTTPParserError'
172300
this.code=code ? `HPE_${code}` : undefined
173301
this.data=data ? data.toString() : undefined
174302
}
303+
304+
static[Symbol.hasInstance](instance){
305+
returninstance&&instance[kHTTPParserError]===true
306+
}
307+
308+
[kHTTPParserError]=true
175309
}
176310

311+
constkResponseExceededMaxSizeError=Symbol.for('undici.error.UND_ERR_RES_EXCEEDED_MAX_SIZE')
177312
classResponseExceededMaxSizeErrorextendsUndiciError{
178313
constructor(message){
179314
super(message)
180315
this.name='ResponseExceededMaxSizeError'
181316
this.message=message||'Response content exceeded max size'
182317
this.code='UND_ERR_RES_EXCEEDED_MAX_SIZE'
183318
}
319+
320+
static[Symbol.hasInstance](instance){
321+
returninstance&&instance[kResponseExceededMaxSizeError]===true
322+
}
323+
324+
[kResponseExceededMaxSizeError]=true
184325
}
185326

327+
constkRequestRetryError=Symbol.for('undici.error.UND_ERR_REQ_RETRY')
186328
classRequestRetryErrorextendsUndiciError{
187329
constructor(message,code,{ headers, data }){
188330
super(message)
@@ -193,8 +335,15 @@ class RequestRetryError extends UndiciError {
193335
this.data=data
194336
this.headers=headers
195337
}
338+
339+
static[Symbol.hasInstance](instance){
340+
returninstance&&instance[kRequestRetryError]===true
341+
}
342+
343+
[kRequestRetryError]=true
196344
}
197345

346+
constkResponseError=Symbol.for('undici.error.UND_ERR_RESPONSE')
198347
classResponseErrorextendsUndiciError{
199348
constructor(message,code,{ headers, data }){
200349
super(message)
@@ -205,8 +354,15 @@ class ResponseError extends UndiciError {
205354
this.data=data
206355
this.headers=headers
207356
}
357+
358+
static[Symbol.hasInstance](instance){
359+
returninstance&&instance[kResponseError]===true
360+
}
361+
362+
[kResponseError]=true
208363
}
209364

365+
constkSecureProxyConnectionError=Symbol.for('undici.error.UND_ERR_PRX_TLS')
210366
classSecureProxyConnectionErrorextendsUndiciError{
211367
constructor(cause,message,options){
212368
super(message,{ cause, ...(options??{})})
@@ -215,6 +371,12 @@ class SecureProxyConnectionError extends UndiciError {
215371
this.code='UND_ERR_PRX_TLS'
216372
this.cause=cause
217373
}
374+
375+
static[Symbol.hasInstance](instance){
376+
returninstance&&instance[kSecureProxyConnectionError]===true
377+
}
378+
379+
[kSecureProxyConnectionError]=true
218380
}
219381

220382
module.exports={

0 commit comments

Comments
 (0)