Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
fcd0424
http: server add async dispose
atlowChemi Jun 25, 2023
7a00bda
http2: server add `asyncDispose`
atlowChemi Jun 25, 2023
a9711bb
deps: update acorn to 8.9.0
nodejs-github-bot Jun 18, 2023
c4e8b51
doc: update security release stewards
RafaelGSS Jun 30, 2023
dbca197
test: add missing assertions to test-runner-cli
MoLow Jul 2, 2023
eb4550a
http: null the joinDuplicateHeaders property on cleanup
lpinca Jul 3, 2023
61231c2
doc: fix options order
lpinca Jul 3, 2023
3fc8004
test_runner: fixed `test` shorthands return type
shockerqt Jul 3, 2023
31ec622
src: fix uninitialized field access in AsyncHooks
hybrist Jul 3, 2023
f02e23c
src: deduplicate X509 getter implementations
tniessen Jul 3, 2023
3146327
meta: bump github/codeql-action from 2.3.6 to 2.20.1
dependabot[bot] Jul 3, 2023
0b3fd8e
meta: bump ossf/scorecard-action from 2.1.3 to 2.2.0
dependabot[bot] Jul 3, 2023
c0e025c
meta: bump step-security/harden-runner from 2.4.0 to 2.4.1
dependabot[bot] Jul 3, 2023
609804d
tools: update lint-md-dependencies to rollup@3.26.0
nodejs-github-bot Jul 4, 2023
c77d9c8
tools: update eslint to 8.44.0
nodejs-github-bot Jul 4, 2023
7826d36
meta: bump actions/checkout from 3.5.2 to 3.5.3
dependabot[bot] Jul 5, 2023
535de5a
child_process: support `Symbol.dispose`
MoLow Jul 5, 2023
0b62218
Revert "test: remove test-crypto-keygen flaky designation"
lpinca Jul 5, 2023
0a3ae9f
events: allow safely adding listener to abortSignal
atlowChemi Jul 5, 2023
71da5dc
http2: send RST code 8 on AbortController signal
devm33 Jul 6, 2023
0d544b4
doc: mention git node release prepare
RafaelGSS Jul 6, 2023
616ecf0
doc: clarify transform._transform() callback argument logic
rafasofizada Jul 8, 2023
caccc61
events: fix bug listenerCount don't compare wrapped listener
yuzheng14 Jul 10, 2023
0de99d2
src: remove kEagerCompile for CompileFunction
kvakil Jul 6, 2023
222082d
deps: V8: cherry-pick cb00db4dba6c
kvakil Jul 6, 2023
2713de6
tools: update lint-md-dependencies to rollup@3.26.2
nodejs-github-bot Jul 11, 2023
03b7163
tools: update doc to unist-util-select@5.0.0 unist-util-visit@5.0.0
nodejs-github-bot Jul 11, 2023
5861589
esm: fix emit deprecation on legacy main resolve
aduh95 Jul 11, 2023
627bc92
http2: use addAbortListener
atlowChemi Jul 5, 2023
b5c7634
readline: use addAbortListener
atlowChemi Jul 5, 2023
c44413d
stream: use addAbortListener
atlowChemi Jul 5, 2023
cfeee51
dgram: use addAbortListener
atlowChemi Jul 5, 2023
24eeae3
child_process: use addAbortListener
atlowChemi Jul 5, 2023
33c9cea
lib: use addAbortListener
atlowChemi Jul 5, 2023
bf75a11
dgram: socket add `asyncDispose`
atlowChemi Jul 9, 2023
45c7e5e
net: server add `asyncDispose`
atlowChemi Jul 9, 2023
48f292d
test: move test-net-throttle to parallel
lpinca Jun 29, 2023
fcdcf1a
test: deflake test-net-throttle
lpinca Jun 29, 2023
5c2b200
deps: update acorn to 8.10.0
nodejs-github-bot Jul 12, 2023
eed884b
fs, stream: initial `Symbol.dispose` and `Symbol.asyncDispose` support
MoLow Jun 25, 2023
4ee7f44
deps: upgrade to libuv 1.45.0
santigimeno May 17, 2023
0ed29c0
deps: upgrade to libuv 1.46.0
santigimeno Jul 2, 2023
4b0c098
build: sync libuv header change
gengjiawen Jun 14, 2023
34a9a3c
deps: add missing thread-common.c in uv.gyp
santigimeno Sep 1, 2023
959b0c2
timers: support Symbol.dispose
MoLow Jul 5, 2023
5579177
test: mark test-http-regr-gh-2928 as flaky
joyeecheung Sep 11, 2023
e1098dd
doc: add release key for Ulises Gascon
UlisesGascon Sep 7, 2023
72a7fcc
doc: fix ambiguity in http.md and https.md
an5er Jul 8, 2023
98663a9
tools: run fetch_deps.py with Python 3
richardlau Jul 12, 2023
47be64c
build: do not pass target toolchain flags to host toolchain
tie Jul 12, 2023
1989bcd
src: make BaseObject iteration order deterministic
joyeecheung Jul 12, 2023
6dcba08
deps: update minimatch to 9.0.3
nodejs-github-bot Jul 12, 2023
76c9f35
doc: add atlowChemi to collaborators
atlowChemi Jul 13, 2023
07eac0d
permission: add debug log when inserting fs nodes
RafaelGSS Jul 13, 2023
1e87ce9
test: fix flaky test-string-decode.js on x86
StefanStojanovic Jul 14, 2023
ee024cf
child_process: harden against prototype pollution
LiviaMedeiros Jul 14, 2023
af9064d
deps: update nghttp2 to 1.55.0
nodejs-github-bot Jul 14, 2023
817b59c
permission: fix data types in PrintTree
tniessen Jul 14, 2023
10495ad
doc: expand on squashing and rebasing to land a PR
legendecas Jul 15, 2023
66fb032
util: use `primordials.ArrayPrototypeIndexOf` instead of mutable method
DaisyDogs07 Jul 15, 2023
ef85828
crypto: update root certificates to NSS 3.93
nodejs-github-bot Aug 29, 2023
28626c9
node-api: treat V8 platform symbols same as base
sparist Feb 12, 2023
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
Next Next commit
http: server add async dispose
PR-URL: #48548
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
atlowChemi authored and ruyadorno committed Sep 12, 2023
commit fcd0424687ef27dd234c4432f19926fa804025d0
12 changes: 12 additions & 0 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,17 @@ to 8.0.0, which did not have a keep-alive timeout.
The socket timeout logic is set up on connection, so changing this value only
affects new connections to the server, not any existing connections.

### `server[Symbol.asyncDispose]()`

<!-- YAML
added: REPLACEME
-->

> Stability: 1 - Experimental

Calls [`server.close()`][] and returns a promise that fulfills when the
server has closed.

## Class: `http.ServerResponse`

<!-- YAML
Expand Down Expand Up @@ -3843,6 +3854,7 @@ Set the maximum number of idle HTTP parsers.
[`response.write(data, encoding)`]: #responsewritechunk-encoding-callback
[`response.writeContinue()`]: #responsewritecontinue
[`response.writeHead()`]: #responsewriteheadstatuscode-statusmessage-headers
[`server.close()`]: #serverclosecallback
[`server.headersTimeout`]: #serverheaderstimeout
[`server.listen()`]: net.md#serverlisten
[`server.requestTimeout`]: #serverrequesttimeout
Expand Down
9 changes: 9 additions & 0 deletions lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
const {
ArrayIsArray,
Error,
FunctionPrototypeCall,
MathMin,
ObjectKeys,
ObjectSetPrototypeOf,
RegExpPrototypeExec,
ReflectApply,
Symbol,
SymbolAsyncDispose,
SymbolFor,
} = primordials;

Expand Down Expand Up @@ -80,6 +82,9 @@ const {
ERR_INVALID_ARG_VALUE,
ERR_INVALID_CHAR,
} = codes;
const {
promisify,
} = require('internal/util');
const {
validateInteger,
validateBoolean,
Expand Down Expand Up @@ -548,6 +553,10 @@ Server.prototype.close = function() {
ReflectApply(net.Server.prototype.close, this, arguments);
};

Server.prototype[SymbolAsyncDispose] = async function() {
return FunctionPrototypeCall(promisify(this.close), this);
};

Server.prototype.closeAllConnections = function() {
const connections = this[kConnections].all();

Expand Down
14 changes: 14 additions & 0 deletions test/parallel/test-http-server-async-dispose.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const { createServer } = require('http');
const { kConnectionsCheckingInterval } = require('_http_server');

const server = createServer();

server.listen(0, common.mustCall(() => {
server.on('close', common.mustCall());
server[Symbol.asyncDispose]().then(common.mustCall(() => {
assert(server[kConnectionsCheckingInterval]._destroyed);
}));
}));