Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 32 additions & 12 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13999,6 +13999,7 @@ module.exports = {

const assert = __nccwpck_require__(9491)
const net = __nccwpck_require__(1808)
const http = __nccwpck_require__(3685)
const { pipeline } = __nccwpck_require__(2781)
const util = __nccwpck_require__(3983)
const timers = __nccwpck_require__(9459)
Expand Down Expand Up @@ -14086,6 +14087,7 @@ const {
HTTP2_HEADER_AUTHORITY,
HTTP2_HEADER_METHOD,
HTTP2_HEADER_PATH,
HTTP2_HEADER_SCHEME,
HTTP2_HEADER_CONTENT_LENGTH,
HTTP2_HEADER_EXPECT,
HTTP2_HEADER_STATUS
Expand Down Expand Up @@ -14262,7 +14264,7 @@ class Client extends DispatcherBase {
this[kConnector] = connect
this[kSocket] = null
this[kPipelining] = pipelining != null ? pipelining : 1
this[kMaxHeadersSize] = maxHeaderSize || 16384
this[kMaxHeadersSize] = maxHeaderSize || http.maxHeaderSize
this[kKeepAliveDefaultTimeout] = keepAliveTimeout == null ? 4e3 : keepAliveTimeout
this[kKeepAliveMaxTimeout] = keepAliveMaxTimeout == null ? 600e3 : keepAliveMaxTimeout
this[kKeepAliveTimeoutThreshold] = keepAliveTimeoutThreshold == null ? 1e3 : keepAliveTimeoutThreshold
Expand Down Expand Up @@ -15682,7 +15684,7 @@ function writeH2 (client, session, request) {
const h2State = client[kHTTP2SessionState]

headers[HTTP2_HEADER_AUTHORITY] = host || client[kHost]
headers[HTTP2_HEADER_PATH] = path
headers[HTTP2_HEADER_METHOD] = method

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

return true
} else {
headers[HTTP2_HEADER_METHOD] = method
}

// https://tools.ietf.org/html/rfc7540#section-8.3
// :path and :scheme headers must be omited when sending CONNECT

headers[HTTP2_HEADER_PATH] = path
headers[HTTP2_HEADER_SCHEME] = 'https'

// https://tools.ietf.org/html/rfc7231#section-4.3.1
// https://tools.ietf.org/html/rfc7231#section-4.3.2
// https://tools.ietf.org/html/rfc7231#section-4.3.5
Expand Down Expand Up @@ -15849,6 +15855,7 @@ function writeH2 (client, session, request) {
stream.cork()
stream.write(body)
stream.uncork()
stream.end()
request.onBodySent(body)
request.onRequestSent()
} else if (util.isBlobLike(body)) {
Expand Down Expand Up @@ -16083,13 +16090,17 @@ async function writeIterable ({ h2stream, body, client, request, socket, content
throw socket[kError]
}

if (!h2stream.write(chunk)) {
const res = h2stream.write(chunk)
request.onBodySent(chunk)
if (!res) {
await waitForDrain()
}
}
} catch (err) {
h2stream.destroy(err)
} finally {
request.onRequestSent()
h2stream.end()
h2stream
.off('close', onDrain)
.off('drain', onDrain)
Expand Down Expand Up @@ -16302,11 +16313,13 @@ class CompatFinalizer {
}

register (dispatcher, key) {
dispatcher.on('disconnect', () => {
if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) {
this.finalizer(key)
}
})
if (dispatcher.on) {
dispatcher.on('disconnect', () => {
if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) {
this.finalizer(key)
}
})
}
}
}

Expand Down Expand Up @@ -17972,7 +17985,8 @@ function processHeader (request, key, val, skipAppend = false) {
key.toLowerCase() === 'content-type'
) {
request.contentType = val
request.headers += processHeaderValue(key, val)
if (skipAppend) request.headers[key] = processHeaderValue(key, val, skipAppend)
else request.headers += processHeaderValue(key, val)
} else if (
key.length === 17 &&
key.toLowerCase() === 'transfer-encoding'
Expand Down Expand Up @@ -22662,6 +22676,10 @@ async function httpRedirectFetch (fetchParams, response) {
if (!sameOrigin(requestCurrentURL(request), locationURL)) {
// https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
request.headersList.delete('authorization')

// "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
request.headersList.delete('cookie')
request.headersList.delete('host')
}

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

// 15. If httpRequest’s cache mode is "default" and httpRequest’s header
Expand Down Expand Up @@ -22868,6 +22886,8 @@ async function httpNetworkOrCacheFetch (
}
}

httpRequest.headersList.delete('host')

// 20. If includeCredentials is true, then:
if (includeCredentials) {
// 1. If the user agent is not configured to block cookies for httpRequest
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.