Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f93d03d
node-api: define version 8
gabrielschulhof Mar 7, 2021
5ff4959
crypto: add optional callback to crypto.sign and crypto.verify
panva Feb 24, 2021
1c62f2d
deps: V8: cherry-pick 1648e050cade
cjihrig Mar 9, 2021
7fd2a69
test: fixup flaky test-crypto-x509
panva Mar 11, 2021
7530873
doc: crypto esm examples
jasnell Mar 3, 2021
4f892af
src: fix variable name of OnCloseReceived callback
tniessen Feb 26, 2021
4233d6c
doc: use sentence case in README.md headers
marsonya Mar 6, 2021
6ef1d33
crypto: add internal error codes
RaisinTen Mar 7, 2021
bb1967c
module: refactor NativeModule to avoid unsafe array iteration
aduh95 Feb 12, 2021
71150ee
doc: fix typo in description of close event
tniessen Mar 8, 2021
756328a
stream,util: fix "the the" typo in comments
lpinca Mar 9, 2021
5d12de3
lib: fix typo in lib/internal/http2/core.js
marsonya Mar 10, 2021
ce0350d
doc: fix link to googletest fixtures
tniessen Mar 10, 2021
28e827f
crypto: reconcile duplicated code
jasnell Mar 11, 2021
2577f10
test,crypto: ensure promises resolve in webcrypto tests
aduh95 Mar 8, 2021
77c5c2f
http: refactor to avoid unsafe array iteration
aduh95 Feb 12, 2021
311ddc9
tls: refactor to avoid unsafe array iteration
aduh95 Feb 12, 2021
e556215
fs: improve fsPromises writeFile performance
Linkgoron Mar 5, 2021
ea10155
benchmark: add benchmark for fsPromises.writeFile
Linkgoron Mar 5, 2021
ce8ac4d
assert,util: fix commutativity edge case
BridgeAR Mar 11, 2021
efd14a9
deps: upgrade npm to 7.6.3
ruyadorno Mar 11, 2021
3acba1d
events: remove return value on addEventListener
jasnell Mar 10, 2021
e4667eb
http2: make res.req a normal property
cjihrig Mar 11, 2021
8c084d9
lib: use AbortError consistently
jasnell Mar 11, 2021
0563260
doc: recommend checking abortSignal.aborted first
jasnell Mar 11, 2021
8fdc4a5
util: inspect __proto__ key as written in object literal
addaleax Mar 11, 2021
e6e2112
test: address flaky wpt/test-timers
Trott Mar 13, 2021
8d0af3e
deps: switch openssl to quictls/openssl
jasnell Mar 4, 2021
53b9805
deps: update archs files for OpenSSL-1.1.1+quic
jasnell Mar 4, 2021
345af4d
test: fixup test to account for quic openssl version
jasnell Mar 4, 2021
faffb61
doc: update maintaining-openssl guide
jasnell Mar 4, 2021
b62c08b
worker: add setEnvironmentData/getEnvironmentData
jasnell Feb 23, 2021
a4e9edb
lib: implement AbortSignal.abort()
jasnell Mar 10, 2021
ba5a0d9
test: update dom/abort tests
jasnell Mar 15, 2021
fb46d03
doc: add hints to http.request() options
lpinca Mar 13, 2021
35b0395
errors: remove experimental from --enable-source-maps
Mar 13, 2021
dba24b3
tools: use bundled npm in update scripts
ruyadorno Mar 4, 2021
bcbdcfc
src,test: support dynamically linking OpenSSL 3.0
danbev Oct 26, 2020
9fad821
doc: add marsonya as a triager
marsonya Mar 9, 2021
8a94870
doc: update v14 and v12 changelogs
danielleadams Mar 16, 2021
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
Prev Previous commit
Next Next commit
http: refactor to avoid unsafe array iteration
PR-URL: #37654
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
  • Loading branch information
aduh95 authored and danielleadams committed Mar 16, 2021
commit 77c5c2f3d1cf16e82c83fc7d11d1b14c145dd2df
13 changes: 8 additions & 5 deletions lib/_http_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const {
ArrayPrototypePop,
ArrayPrototypePush,
ArrayPrototypeShift,
ArrayPrototypeSome,
ArrayPrototypeSplice,
FunctionPrototypeCall,
NumberIsNaN,
Expand Down Expand Up @@ -390,10 +391,10 @@ function installListeners(agent, s, options) {
// Destroy if in free list.
// TODO(ronag): Always destroy, even if not in free list.
const sockets = agent.freeSockets;
for (const name of ObjectKeys(sockets)) {
if (ArrayPrototypeIncludes(sockets[name], s)) {
return s.destroy();
}
if (ArrayPrototypeSome(ObjectKeys(sockets), (name) =>
ArrayPrototypeIncludes(sockets[name], s)
)) {
return s.destroy();
}
}
s.on('timeout', onTimeout);
Expand Down Expand Up @@ -449,7 +450,9 @@ Agent.prototype.removeSocket = function removeSocket(s, options) {
// There might be older requests in a different origin, but
// if the origin which releases the socket has pending requests
// that will be prioritized.
for (const prop of ObjectKeys(this.requests)) {
const keys = ObjectKeys(this.requests);
for (let i = 0; i < keys.length; i++) {
const prop = keys[i];
// Check whether this specific origin is already at maxSockets
if (this.sockets[prop] && this.sockets[prop].length) break;
debug('removeSocket, have a request with different origin,' +
Expand Down