Comparing version 5.25.4 to 5.26.0
@@ -27,3 +27,3 @@ # Class: Client | ||
* **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. | ||
* **maxHeaderSize** `number | null` (optional) - Default: `--max-http-header-size` or `16384` - The maximum length of request headers in bytes. Defaults to Node.js' --max-http-header-size or 16KiB. | ||
* **maxResponseSize** `number | null` (optional) - Default: `-1` - The maximum length of response body in bytes. Set to `-1` to disable. | ||
@@ -30,0 +30,0 @@ * **pipelining** `number | null` (optional) - Default: `1` - The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Carefully consider your workload and environment before enabling concurrent requests as pipelining may reduce performance if used incorrectly. Pipelining is sensitive to network stack settings as well as head of line blocking caused by e.g. long running requests. Set to `0` to disable keep-alive connections. |
@@ -9,2 +9,3 @@ // @ts-check | ||
const net = require('net') | ||
const http = require('http') | ||
const { pipeline } = require('stream') | ||
@@ -97,2 +98,3 @@ const util = require('./core/util') | ||
HTTP2_HEADER_PATH, | ||
HTTP2_HEADER_SCHEME, | ||
HTTP2_HEADER_CONTENT_LENGTH, | ||
@@ -274,3 +276,3 @@ HTTP2_HEADER_EXPECT, | ||
this[kPipelining] = pipelining != null ? pipelining : 1 | ||
this[kMaxHeadersSize] = maxHeaderSize || 16384 | ||
this[kMaxHeadersSize] = maxHeaderSize || http.maxHeaderSize | ||
this[kKeepAliveDefaultTimeout] = keepAliveTimeout == null ? 4e3 : keepAliveTimeout | ||
@@ -1695,3 +1697,3 @@ this[kKeepAliveMaxTimeout] = keepAliveMaxTimeout == null ? 600e3 : keepAliveMaxTimeout | ||
headers[HTTP2_HEADER_AUTHORITY] = host || client[kHost] | ||
headers[HTTP2_HEADER_PATH] = path | ||
headers[HTTP2_HEADER_METHOD] = method | ||
@@ -1723,6 +1725,10 @@ if (method === 'CONNECT') { | ||
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 | ||
@@ -1864,2 +1870,3 @@ // https://tools.ietf.org/html/rfc7231#section-4.3.2 | ||
stream.uncork() | ||
stream.end() | ||
request.onBodySent(body) | ||
@@ -2099,3 +2106,5 @@ request.onRequestSent() | ||
if (!h2stream.write(chunk)) { | ||
const res = h2stream.write(chunk) | ||
request.onBodySent(chunk) | ||
if (!res) { | ||
await waitForDrain() | ||
@@ -2107,2 +2116,4 @@ } | ||
} finally { | ||
request.onRequestSent() | ||
h2stream.end() | ||
h2stream | ||
@@ -2109,0 +2120,0 @@ .off('close', onDrain) |
@@ -25,7 +25,9 @@ 'use strict' | ||
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) | ||
} | ||
}) | ||
} | ||
} | ||
@@ -32,0 +34,0 @@ } |
@@ -384,3 +384,4 @@ 'use strict' | ||
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 ( | ||
@@ -387,0 +388,0 @@ key.length === 17 && |
{ | ||
"name": "undici", | ||
"version": "5.25.4", | ||
"version": "5.26.0", | ||
"description": "An HTTP/1.1 client, written from scratch for Node.js", | ||
@@ -78,3 +78,3 @@ "homepage": "https://undici.nodejs.org", | ||
"lint:fix": "standard --fix | snazzy", | ||
"test": "npm run test:tap && npm run test:node-fetch && npm run test:fetch && npm run test:cookies && npm run test:wpt && npm run test:websocket && npm run test:jest && npm run test:typescript", | ||
"test": "node scripts/generate-pem && npm run test:tap && npm run test:node-fetch && npm run test:fetch && npm run test:cookies && npm run test:wpt && npm run test:websocket && npm run test:jest && npm run test:typescript", | ||
"test:cookies": "node scripts/verifyVersion 16 || tap test/cookie/*.js", | ||
@@ -126,3 +126,4 @@ "test:node-fetch": "node scripts/verifyVersion.js 16 || mocha --exit test/node-fetch", | ||
"proxyquire": "^2.1.3", | ||
"sinon": "^15.0.0", | ||
"semver": "^7.5.4", | ||
"sinon": "^16.1.0", | ||
"snazzy": "^9.0.0", | ||
@@ -129,0 +130,0 @@ "standard": "^17.0.0", |
@@ -20,3 +20,3 @@ import { URL } from 'url' | ||
/** Default: `(origin, opts) => new Pool(origin, opts)`. */ | ||
factory?(origin: URL, opts: Object): Dispatcher; | ||
factory?(origin: string | URL, opts: Object): Dispatcher; | ||
/** Integer. Default: `0` */ | ||
@@ -23,0 +23,0 @@ maxRedirections?: number; |
@@ -26,3 +26,3 @@ import { URL } from 'url' | ||
interceptors?: OptionsInterceptors; | ||
/** The maximum length of request headers in bytes. Default: `16384` (16KiB). */ | ||
/** The maximum length of request headers in bytes. Default: Node.js' `--max-http-header-size` or `16384` (16KiB). */ | ||
maxHeaderSize?: number; | ||
@@ -29,0 +29,0 @@ /** 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). */ |
@@ -9,2 +9,3 @@ import { TLSSocket, ConnectionOptions } from 'tls' | ||
export type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & { | ||
allowH2?: boolean; | ||
maxCachedSessions?: number | null; | ||
@@ -11,0 +12,0 @@ socketPath?: string | null; |
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
1144367
19938
36
10