Comparing version 6.16.0 to 6.16.1
@@ -47,2 +47,3 @@ 'use strict' | ||
this.method = method | ||
this.responseHeaders = responseHeaders || null | ||
@@ -118,3 +119,11 @@ this.opaque = opaque || null | ||
const contentLength = parsedHeaders['content-length'] | ||
const res = new Readable({ resume, abort, contentType, contentLength, highWaterMark }) | ||
const res = new Readable({ | ||
resume, | ||
abort, | ||
contentType, | ||
contentLength: this.method !== 'HEAD' && contentLength | ||
? Number(contentLength) | ||
: null, | ||
highWaterMark | ||
}) | ||
@@ -121,0 +130,0 @@ if (this.removeAbortListener) { |
@@ -168,3 +168,3 @@ 'use strict' | ||
const timeoutId = setTimeout(() => { | ||
// setImmediate is added to make sure that we priotorise socket error events over timeouts | ||
// setImmediate is added to make sure that we prioritize socket error events over timeouts | ||
s1 = setImmediate(() => { | ||
@@ -171,0 +171,0 @@ if (process.platform === 'win32') { |
@@ -258,12 +258,19 @@ 'use strict' | ||
function appendRequestOriginHeader (request) { | ||
// 1. Let serializedOrigin be the result of byte-serializing a request origin with request. | ||
// 1. Let serializedOrigin be the result of byte-serializing a request origin | ||
// with request. | ||
// TODO: implement "byte-serializing a request origin" | ||
let serializedOrigin = request.origin | ||
// 2. If request’s response tainting is "cors" or request’s mode is "websocket", then append (`Origin`, serializedOrigin) to request’s header list. | ||
if (request.responseTainting === 'cors' || request.mode === 'websocket') { | ||
if (serializedOrigin) { | ||
request.headersList.append('origin', serializedOrigin, true) | ||
} | ||
// "'client' is changed to an origin during fetching." | ||
// This doesn't happen in undici (in most cases) because undici, by default, | ||
// has no concept of origin. | ||
if (serializedOrigin === 'client') { | ||
return | ||
} | ||
// 2. If request’s response tainting is "cors" or request’s mode is "websocket", | ||
// then append (`Origin`, serializedOrigin) to request’s header list. | ||
// 3. Otherwise, if request’s method is neither `GET` nor `HEAD`, then: | ||
if (request.responseTainting === 'cors' || request.mode === 'websocket') { | ||
request.headersList.append('origin', serializedOrigin, true) | ||
} else if (request.method !== 'GET' && request.method !== 'HEAD') { | ||
@@ -279,3 +286,5 @@ // 1. Switch on request’s referrer policy: | ||
case 'strict-origin-when-cross-origin': | ||
// If request’s origin is a tuple origin, its scheme is "https", and request’s current URL’s scheme is not "https", then set serializedOrigin to `null`. | ||
// If request’s origin is a tuple origin, its scheme is "https", and | ||
// request’s current URL’s scheme is not "https", then set | ||
// serializedOrigin to `null`. | ||
if (request.origin && urlHasHttpsScheme(request.origin) && !urlHasHttpsScheme(requestCurrentURL(request))) { | ||
@@ -286,3 +295,4 @@ serializedOrigin = null | ||
case 'same-origin': | ||
// If request’s origin is not same origin with request’s current URL’s origin, then set serializedOrigin to `null`. | ||
// If request’s origin is not same origin with request’s current URL’s | ||
// origin, then set serializedOrigin to `null`. | ||
if (!sameOrigin(request, requestCurrentURL(request))) { | ||
@@ -296,6 +306,4 @@ serializedOrigin = null | ||
if (serializedOrigin) { | ||
// 2. Append (`Origin`, serializedOrigin) to request’s header list. | ||
request.headersList.append('origin', serializedOrigin, true) | ||
} | ||
// 2. Append (`Origin`, serializedOrigin) to request’s header list. | ||
request.headersList.append('origin', serializedOrigin, true) | ||
} | ||
@@ -302,0 +310,0 @@ } |
@@ -38,3 +38,3 @@ 'use strict' | ||
*/ | ||
function establishWebSocketConnection (url, protocols, ws, onEstablish, options) { | ||
function establishWebSocketConnection (url, protocols, client, ws, onEstablish, options) { | ||
// 1. Let requestURL be a copy of url, with its scheme set to "http", if url’s | ||
@@ -52,2 +52,3 @@ // scheme is "ws", and to "https" otherwise. | ||
urlList: [requestURL], | ||
client, | ||
serviceWorkers: 'none', | ||
@@ -54,0 +55,0 @@ referrer: 'no-referrer', |
@@ -215,3 +215,3 @@ 'use strict' | ||
// 2^31 is the maxinimum bytes an arraybuffer can contain | ||
// 2^31 is the maximum bytes an arraybuffer can contain | ||
// on 32-bit systems. Although, on 64-bit systems, this is | ||
@@ -318,2 +318,6 @@ // 2^53-1 bytes. | ||
if (code !== undefined && !isValidStatusCode(code)) { | ||
return { code: 1002, reason: 'Invalid status code', error: true } | ||
} | ||
// https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.6 | ||
@@ -328,6 +332,2 @@ /** @type {Buffer} */ | ||
if (code !== undefined && !isValidStatusCode(code)) { | ||
return { code: 1002, reason: 'Invalid status code', error: true } | ||
} | ||
try { | ||
@@ -334,0 +334,0 @@ reason = utf8Decode(reason) |
@@ -127,2 +127,3 @@ 'use strict' | ||
// 11. Let client be this's relevant settings object. | ||
const client = environmentSettingsObject.settingsObject | ||
@@ -136,2 +137,3 @@ // 12. Run this step in parallel: | ||
protocols, | ||
client, | ||
this, | ||
@@ -552,3 +554,3 @@ (response) => this.#onConnectionEstablished(response), | ||
// This implements the propsal made in https://github.com/whatwg/websockets/issues/42 | ||
// This implements the proposal made in https://github.com/whatwg/websockets/issues/42 | ||
webidl.converters.WebSocketInit = webidl.dictionaryConverter([ | ||
@@ -555,0 +557,0 @@ { |
{ | ||
"name": "undici", | ||
"version": "6.16.0", | ||
"version": "6.16.1", | ||
"description": "An HTTP/1.1 client, written from scratch for Node.js", | ||
@@ -5,0 +5,0 @@ "homepage": "https://undici.nodejs.org", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1117399
23503