Comparing version 5.24.0 to 5.25.0
@@ -23,6 +23,6 @@ # Class: Client | ||
* **bodyTimeout** `number | null` (optional) - Default: `300e3` - The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Defaults to 300 seconds. | ||
* **headersTimeout** `number | null` (optional) - Default: `300e3` - The amount of time the parser will wait to receive the complete HTTP headers while not sending the request. Defaults to 300 seconds. | ||
* **keepAliveMaxTimeout** `number | null` (optional) - Default: `600e3` - The maximum allowed `keepAliveTimeout` when overridden by *keep-alive* hints from the server. Defaults to 10 minutes. | ||
* **keepAliveTimeout** `number | null` (optional) - Default: `4e3` - The timeout after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. See [MDN: HTTP - Headers - Keep-Alive directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive#directives) for more details. Defaults to 4 seconds. | ||
* **keepAliveTimeoutThreshold** `number | null` (optional) - Default: `1e3` - A number subtracted from server *keep-alive* hints when overriding `keepAliveTimeout` to account for timing inaccuracies caused by e.g. transport latency. Defaults to 1 second. | ||
* **headersTimeout** `number | null` (optional) - Default: `300e3` - The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers while not sending the request. Defaults to 300 seconds. | ||
* **keepAliveMaxTimeout** `number | null` (optional) - Default: `600e3` - The maximum allowed `keepAliveTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Defaults to 10 minutes. | ||
* **keepAliveTimeout** `number | null` (optional) - Default: `4e3` - The timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. See [MDN: HTTP - Headers - Keep-Alive directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive#directives) for more details. Defaults to 4 seconds. | ||
* **keepAliveTimeoutThreshold** `number | null` (optional) - Default: `1e3` - A number of milliseconds subtracted from server *keep-alive* hints when overriding `keepAliveTimeout` to account for timing inaccuracies caused by e.g. transport latency. Defaults to 1 second. | ||
* **maxHeaderSize** `number | null` (optional) - Default: `16384` - The maximum length of request headers in bytes. Defaults to 16KiB. | ||
@@ -46,3 +46,3 @@ * **maxResponseSize** `number | null` (optional) - Default: `-1` - The maximum length of response body in bytes. Set to `-1` to disable. | ||
* **maxCachedSessions** `number | null` (optional) - Default: `100` - Maximum number of TLS cached sessions. Use 0 to disable TLS session caching. Default: 100. | ||
* **timeout** `number | null` (optional) - Default `10e3` | ||
* **timeout** `number | null` (optional) - In milliseconds, Default `10e3`. | ||
* **servername** `string | null` (optional) | ||
@@ -49,0 +49,0 @@ * **keepAlive** `boolean | null` (optional) - Default: `true` - TCP keep-alive enabled |
@@ -16,4 +16,4 @@ # Connector | ||
* **socketPath** `string | null` (optional) - Default: `null` - An IPC endpoint, either Unix domain socket or Windows named pipe. | ||
* **maxCachedSessions** `number | null` (optional) - Default: `100` - Maximum number of TLS cached sessions. Use 0 to disable TLS session caching. Default: 100. | ||
* **timeout** `number | null` (optional) - Default `10e3` | ||
* **maxCachedSessions** `number | null` (optional) - Default: `100` - Maximum number of TLS cached sessions. Use 0 to disable TLS session caching. Default: `100`. | ||
* **timeout** `number | null` (optional) - In milliseconds. Default `10e3`. | ||
* **servername** `string | null` (optional) | ||
@@ -20,0 +20,0 @@ |
@@ -203,3 +203,3 @@ # Dispatcher | ||
* **bodyTimeout** `number | null` (optional) - The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Defaults to 300 seconds. | ||
* **headersTimeout** `number | null` (optional) - The amount of time the parser will wait to receive the complete HTTP headers while not sending the request. Defaults to 300 seconds. | ||
* **headersTimeout** `number | null` (optional) - The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers while not sending the request. Defaults to 300 seconds. | ||
* **throwOnError** `boolean` (optional) - Default: `false` - Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. | ||
@@ -206,0 +206,0 @@ * **expectContinue** `boolean` (optional) - Default: `false` - For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server |
@@ -5,5 +5,5 @@ 'use strict' | ||
module.exports.fetch = async function fetch (resource) { | ||
module.exports.fetch = async function fetch (resource, init = undefined) { | ||
try { | ||
return await fetchImpl(...arguments) | ||
return await fetchImpl(resource, init) | ||
} catch (err) { | ||
@@ -18,1 +18,2 @@ Error.captureStackTrace(err, this) | ||
module.exports.Request = require('./lib/fetch/request').Request | ||
module.exports.WebSocket = require('./lib/websocket/websocket').WebSocket |
@@ -9,3 +9,2 @@ // @ts-check | ||
const net = require('net') | ||
const http2 = require('http2') | ||
const { pipeline } = require('stream') | ||
@@ -83,2 +82,12 @@ const util = require('./core/util') | ||
} = require('./core/symbols') | ||
/** @type {import('http2')} */ | ||
let http2 | ||
try { | ||
http2 = require('http2') | ||
} catch { | ||
// @ts-ignore | ||
http2 = { constants: {} } | ||
} | ||
const { | ||
@@ -1692,2 +1701,3 @@ constants: { | ||
// `ready` event is triggered | ||
// We disabled endStream to allow the user to write to the stream | ||
stream = session.request(headers, { endStream: false, signal }) | ||
@@ -1767,2 +1777,3 @@ | ||
const shouldEndStream = method === 'GET' || method === 'HEAD' | ||
if (expectContinue) { | ||
@@ -1773,3 +1784,3 @@ headers[HTTP2_HEADER_EXPECT] = '100-continue' | ||
*/ | ||
stream = session.request(headers, { endStream: false, signal }) | ||
stream = session.request(headers, { endStream: shouldEndStream, signal }) | ||
@@ -1779,3 +1790,6 @@ stream.once('continue', writeBodyH2) | ||
/** @type {import('node:http2').ClientHttp2Stream} */ | ||
stream = session.request(headers, { endStream: false, signal }) | ||
stream = session.request(headers, { | ||
endStream: shouldEndStream, | ||
signal | ||
}) | ||
writeBodyH2() | ||
@@ -1782,0 +1796,0 @@ } |
@@ -323,7 +323,9 @@ 'use strict' | ||
const rawHeaders = raw.split('\r\n') | ||
const headers = {} | ||
const headers = {} | ||
for (const header of rawHeaders) { | ||
const [key, value] = header.split(': ') | ||
if (value == null || value.length === 0) continue | ||
if (headers[key]) headers[key] += `,${value}` | ||
@@ -330,0 +332,0 @@ else headers[key] = value |
@@ -37,2 +37,3 @@ 'use strict' | ||
autoSelectFamilyAttemptTimeout, | ||
allowH2, | ||
...options | ||
@@ -58,2 +59,3 @@ } = {}) { | ||
maxCachedSessions, | ||
allowH2, | ||
socketPath, | ||
@@ -71,3 +73,3 @@ timeout: connectTimeout == null ? 10e3 : connectTimeout, | ||
this[kUrl] = util.parseOrigin(origin) | ||
this[kOptions] = { ...util.deepClone(options), connect } | ||
this[kOptions] = { ...util.deepClone(options), connect, allowH2 } | ||
this[kOptions].interceptors = options.interceptors | ||
@@ -74,0 +76,0 @@ ? { ...options.interceptors } |
{ | ||
"name": "undici", | ||
"version": "5.24.0", | ||
"version": "5.25.0", | ||
"description": "An HTTP/1.1 client, written from scratch for Node.js", | ||
@@ -5,0 +5,0 @@ "homepage": "https://undici.nodejs.org", |
import { URL } from 'url' | ||
import { TlsOptions } from 'tls' | ||
import Dispatcher from './dispatcher' | ||
import DispatchInterceptor from './dispatcher' | ||
import buildConnector from "./connector"; | ||
@@ -22,3 +21,3 @@ | ||
export interface OptionsInterceptors { | ||
Client: readonly DispatchInterceptor[]; | ||
Client: readonly Dispatcher.DispatchInterceptor[]; | ||
} | ||
@@ -30,3 +29,3 @@ export interface Options { | ||
maxHeaderSize?: number; | ||
/** The amount of time the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */ | ||
/** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */ | ||
headersTimeout?: number; | ||
@@ -45,9 +44,9 @@ /** @deprecated unsupported socketTimeout, use headersTimeout & bodyTimeout instead */ | ||
keepAlive?: never; | ||
/** the timeout after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */ | ||
/** the timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */ | ||
keepAliveTimeout?: number; | ||
/** @deprecated unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead */ | ||
maxKeepAliveTimeout?: never; | ||
/** the maximum allowed `idleTimeout` when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */ | ||
/** the maximum allowed `idleTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */ | ||
keepAliveMaxTimeout?: number; | ||
/** A number subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */ | ||
/** A number of milliseconds subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */ | ||
keepAliveTimeoutThreshold?: number; | ||
@@ -77,4 +76,4 @@ /** TODO */ | ||
/** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */ | ||
autoSelectFamilyAttemptTimeout?: number; | ||
/** | ||
autoSelectFamilyAttemptTimeout?: number; | ||
/** | ||
* @description Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation. | ||
@@ -84,3 +83,3 @@ * @default false | ||
allowH2?: boolean; | ||
/** | ||
/** | ||
* @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overriden by a SETTINGS remote frame. | ||
@@ -87,0 +86,0 @@ * @default 100 |
@@ -112,3 +112,3 @@ import { URL } from 'url' | ||
upgrade?: boolean | string | null; | ||
/** The amount of time the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */ | ||
/** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */ | ||
headersTimeout?: number | null; | ||
@@ -115,0 +115,0 @@ /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use 0 to disable it entirely. Defaults to 300 seconds. */ |
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
1142288
19910