Skip to content

Commit 23b0dfd

Browse files
authored
Merge pull request #304 from arduino/dependabot/npm_and_yarn/undici-5.26.3
Bump undici from 5.25.4 to 5.26.3
2 parents de4395e + ebca965 commit 23b0dfd

File tree

2 files changed

+38
-18
lines changed

2 files changed

+38
-18
lines changed

dist/index.js

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13999,6 +13999,7 @@ module.exports = {
1399913999

1400014000
const assert = __nccwpck_require__(9491)
1400114001
const net = __nccwpck_require__(1808)
14002+
const http = __nccwpck_require__(3685)
1400214003
const { pipeline } = __nccwpck_require__(2781)
1400314004
const util = __nccwpck_require__(3983)
1400414005
const timers = __nccwpck_require__(9459)
@@ -14086,6 +14087,7 @@ const {
1408614087
HTTP2_HEADER_AUTHORITY,
1408714088
HTTP2_HEADER_METHOD,
1408814089
HTTP2_HEADER_PATH,
14090+
HTTP2_HEADER_SCHEME,
1408914091
HTTP2_HEADER_CONTENT_LENGTH,
1409014092
HTTP2_HEADER_EXPECT,
1409114093
HTTP2_HEADER_STATUS
@@ -14262,7 +14264,7 @@ class Client extends DispatcherBase {
1426214264
this[kConnector] = connect
1426314265
this[kSocket] = null
1426414266
this[kPipelining] = pipelining != null ? pipelining : 1
14265-
this[kMaxHeadersSize] = maxHeaderSize || 16384
14267+
this[kMaxHeadersSize] = maxHeaderSize || http.maxHeaderSize
1426614268
this[kKeepAliveDefaultTimeout] = keepAliveTimeout == null ? 4e3 : keepAliveTimeout
1426714269
this[kKeepAliveMaxTimeout] = keepAliveMaxTimeout == null ? 600e3 : keepAliveMaxTimeout
1426814270
this[kKeepAliveTimeoutThreshold] = keepAliveTimeoutThreshold == null ? 1e3 : keepAliveTimeoutThreshold
@@ -15682,7 +15684,7 @@ function writeH2 (client, session, request) {
1568215684
const h2State = client[kHTTP2SessionState]
1568315685

1568415686
headers[HTTP2_HEADER_AUTHORITY] = host || client[kHost]
15685-
headers[HTTP2_HEADER_PATH] = path
15687+
headers[HTTP2_HEADER_METHOD] = method
1568615688

1568715689
if (method === 'CONNECT') {
1568815690
session.ref()
@@ -15709,10 +15711,14 @@ function writeH2 (client, session, request) {
1570915711
})
1571015712

1571115713
return true
15712-
} else {
15713-
headers[HTTP2_HEADER_METHOD] = method
1571415714
}
1571515715

15716+
// https://tools.ietf.org/html/rfc7540#section-8.3
15717+
// :path and :scheme headers must be omited when sending CONNECT
15718+
15719+
headers[HTTP2_HEADER_PATH] = path
15720+
headers[HTTP2_HEADER_SCHEME] = 'https'
15721+
1571615722
// https://tools.ietf.org/html/rfc7231#section-4.3.1
1571715723
// https://tools.ietf.org/html/rfc7231#section-4.3.2
1571815724
// https://tools.ietf.org/html/rfc7231#section-4.3.5
@@ -15849,6 +15855,7 @@ function writeH2 (client, session, request) {
1584915855
stream.cork()
1585015856
stream.write(body)
1585115857
stream.uncork()
15858+
stream.end()
1585215859
request.onBodySent(body)
1585315860
request.onRequestSent()
1585415861
} else if (util.isBlobLike(body)) {
@@ -16083,13 +16090,17 @@ async function writeIterable ({ h2stream, body, client, request, socket, content
1608316090
throw socket[kError]
1608416091
}
1608516092

16086-
if (!h2stream.write(chunk)) {
16093+
const res = h2stream.write(chunk)
16094+
request.onBodySent(chunk)
16095+
if (!res) {
1608716096
await waitForDrain()
1608816097
}
1608916098
}
1609016099
} catch (err) {
1609116100
h2stream.destroy(err)
1609216101
} finally {
16102+
request.onRequestSent()
16103+
h2stream.end()
1609316104
h2stream
1609416105
.off('close', onDrain)
1609516106
.off('drain', onDrain)
@@ -16302,11 +16313,13 @@ class CompatFinalizer {
1630216313
}
1630316314

1630416315
register (dispatcher, key) {
16305-
dispatcher.on('disconnect', () => {
16306-
if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) {
16307-
this.finalizer(key)
16308-
}
16309-
})
16316+
if (dispatcher.on) {
16317+
dispatcher.on('disconnect', () => {
16318+
if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) {
16319+
this.finalizer(key)
16320+
}
16321+
})
16322+
}
1631016323
}
1631116324
}
1631216325

@@ -17972,7 +17985,8 @@ function processHeader (request, key, val, skipAppend = false) {
1797217985
key.toLowerCase() === 'content-type'
1797317986
) {
1797417987
request.contentType = val
17975-
request.headers += processHeaderValue(key, val)
17988+
if (skipAppend) request.headers[key] = processHeaderValue(key, val, skipAppend)
17989+
else request.headers += processHeaderValue(key, val)
1797617990
} else if (
1797717991
key.length === 17 &&
1797817992
key.toLowerCase() === 'transfer-encoding'
@@ -22662,6 +22676,10 @@ async function httpRedirectFetch (fetchParams, response) {
2266222676
if (!sameOrigin(requestCurrentURL(request), locationURL)) {
2266322677
// https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
2266422678
request.headersList.delete('authorization')
22679+
22680+
// "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
22681+
request.headersList.delete('cookie')
22682+
request.headersList.delete('host')
2266522683
}
2266622684

2266722685
// 14. If request’s body is non-null, then set request’s body to the first return
@@ -22806,7 +22824,7 @@ async function httpNetworkOrCacheFetch (
2280622824
// user agents should append `User-Agent`/default `User-Agent` value to
2280722825
// httpRequest’s header list.
2280822826
if (!httpRequest.headersList.contains('user-agent')) {
22809-
httpRequest.headersList.append('user-agent', 'undici')
22827+
httpRequest.headersList.append('user-agent', typeof esbuildDetection === 'undefined' ? 'undici' : 'node')
2281022828
}
2281122829

2281222830
// 15. If httpRequest’s cache mode is "default" and httpRequest’s header
@@ -22868,6 +22886,8 @@ async function httpNetworkOrCacheFetch (
2286822886
}
2286922887
}
2287022888

22889+
httpRequest.headersList.delete('host')
22890+
2287122891
// 20. If includeCredentials is true, then:
2287222892
if (includeCredentials) {
2287322893
// 1. If the user agent is not configured to block cookies for httpRequest

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)