Skip to content

Commit 69d661d

Browse files
mcollinarichardlau
authored andcommitted
deps: update undici to v5.29.0
Signed-off-by: Matteo Collina <[email protected]> PR-URL: #57557 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]>
1 parent 50c4e1d commit 69d661d

File tree

7 files changed

+44
-32
lines changed

7 files changed

+44
-32
lines changed

‎deps/undici/src/lib/cookies/index.js‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
const{ parseSetCookie }=require('./parse')
4-
const{ stringify, getHeadersList}=require('./util')
4+
const{ stringify }=require('./util')
55
const{ webidl }=require('../fetch/webidl')
66
const{ Headers }=require('../fetch/headers')
77

@@ -77,14 +77,13 @@ function getSetCookies (headers){
7777

7878
webidl.brandCheck(headers,Headers,{strict: false})
7979

80-
constcookies=getHeadersList(headers).cookies
80+
constcookies=headers.getSetCookie()
8181

8282
if(!cookies){
8383
return[]
8484
}
8585

86-
// In older versions of undici, cookies is a list of name:value.
87-
returncookies.map((pair)=>parseSetCookie(Array.isArray(pair) ? pair[1] : pair))
86+
returncookies.map((pair)=>parseSetCookie(pair))
8887
}
8988

9089
/**

‎deps/undici/src/lib/cookies/util.js‎

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
'use strict'
22

3-
constassert=require('assert')
4-
const{ kHeadersList }=require('../core/symbols')
5-
3+
/**
4+
* @param{string} value
5+
* @returns{boolean}
6+
*/
67
functionisCTLExcludingHtab(value){
78
if(value.length===0){
89
returnfalse
@@ -263,29 +264,11 @@ function stringify (cookie){
263264
returnout.join(' ')
264265
}
265266

266-
letkHeadersListNode
267-
268-
functiongetHeadersList(headers){
269-
if(headers[kHeadersList]){
270-
returnheaders[kHeadersList]
271-
}
272-
273-
if(!kHeadersListNode){
274-
kHeadersListNode=Object.getOwnPropertySymbols(headers).find(
275-
(symbol)=>symbol.description==='headers list'
276-
)
277-
278-
assert(kHeadersListNode,'Headers cannot be parsed')
279-
}
280-
281-
constheadersList=headers[kHeadersListNode]
282-
assert(headersList)
283-
284-
returnheadersList
285-
}
286-
287267
module.exports={
288268
isCTLExcludingHtab,
289-
stringify,
290-
getHeadersList
269+
validateCookieName,
270+
validateCookiePath,
271+
validateCookieValue,
272+
toIMFDate,
273+
stringify
291274
}

‎deps/undici/src/lib/fetch/headers.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const{
1010
isValidHeaderName,
1111
isValidHeaderValue
1212
}=require('./util')
13+
constutil=require('util')
1314
const{ webidl }=require('./webidl')
1415
constassert=require('assert')
1516

@@ -563,6 +564,9 @@ Object.defineProperties(Headers.prototype,{
563564
[Symbol.toStringTag]: {
564565
value: 'Headers',
565566
configurable: true
567+
},
568+
[util.inspect.custom]: {
569+
enumerable: false
566570
}
567571
})
568572

‎deps/undici/src/lib/pool.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,20 @@ class Pool extends PoolBase{
7373
? { ...options.interceptors}
7474
: undefined
7575
this[kFactory]=factory
76+
77+
this.on('connectionError',(origin,targets,error)=>{
78+
// If a connection error occurs, we remove the client from the pool,
79+
// and emit a connectionError event. They will not be re-used.
80+
// Fixes https://github.com/nodejs/undici/issues/3895
81+
for(consttargetoftargets){
82+
// Do not use kRemoveClient here, as it will close the client,
83+
// but the client cannot be closed in this state.
84+
constidx=this[kClients].indexOf(target)
85+
if(idx!==-1){
86+
this[kClients].splice(idx,1)
87+
}
88+
}
89+
})
7690
}
7791

7892
[kGetDispatcher](){

‎deps/undici/src/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "undici",
3-
"version": "5.28.5",
3+
"version": "5.29.0",
44
"description": "An HTTP/1.1 client, written from scratch for Node.js",
55
"homepage": "https://undici.nodejs.org",
66
"bugs":{

‎deps/undici/undici.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,6 +2168,7 @@ var require_headers = __commonJS({
21682168
isValidHeaderName,
21692169
isValidHeaderValue
21702170
} = require_util2();
2171+
var util = require("util");
21712172
var{webidl } = require_webidl();
21722173
var assert = require("assert");
21732174
var kHeadersMap = Symbol("headers map");
@@ -2531,6 +2532,9 @@ var require_headers = __commonJS({
25312532
[Symbol.toStringTag]:{
25322533
value: "Headers",
25332534
configurable: true
2535+
},
2536+
[util.inspect.custom]:{
2537+
enumerable: false
25342538
}
25352539
});
25362540
webidl.converters.HeadersInit = function(V){
@@ -10122,6 +10126,14 @@ var require_pool = __commonJS({
1012210126
this[kOptions] ={...util.deepClone(options), connect, allowH2 };
1012310127
this[kOptions].interceptors = options.interceptors ?{...options.interceptors } : void 0;
1012410128
this[kFactory] = factory;
10129+
this.on("connectionError", (origin2, targets, error) =>{
10130+
for (const target of targets){
10131+
const idx = this[kClients].indexOf(target);
10132+
if (idx !== -1){
10133+
this[kClients].splice(idx, 1);
10134+
}
10135+
}
10136+
});
1012510137
}
1012610138
[kGetDispatcher](){
1012710139
let dispatcher = this[kClients].find((dispatcher2) => !dispatcher2[kNeedDrain]);

‎src/undici_version.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
// Refer to tools/update-undici.sh
33
#ifndefSRC_UNDICI_VERSION_H_
44
#defineSRC_UNDICI_VERSION_H_
5-
#defineUNDICI_VERSION "5.28.5"
5+
#defineUNDICI_VERSION "5.29.0"
66
#endif// SRC_UNDICI_VERSION_H_

0 commit comments

Comments
(0)