Skip to content

Commit 21f8245

Browse files
committed
Stop the upgrade stream pretending to be a socket
1 parent 999222d commit 21f8245

File tree

2 files changed

+2
-36
lines changed

2 files changed

+2
-36
lines changed

doc/api/http.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,9 +1725,8 @@ before starting to read from the upgraded stream.
17251725

17261726
The stream argument will typically be the {net.Socket} instance used by the
17271727
request, but in some cases (such as with a request body) it may be a duplex
1728-
stream (though socket properties are exposed for backward compatibility). If
1729-
required, you can access the raw connection underlying the request via
1730-
[`request.socket`][], which is guaranteed to be an instance of {net.Socket}
1728+
stream. If required, you can access the raw connection underlying the request
1729+
via [`request.socket`][], which is guaranteed to be an instance of {net.Socket}
17311730
unless the user specified another socket type.
17321731

17331732
### `server.close([callback])`

lib/_http_server.js

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,9 @@ const {
2626
Error,
2727
MathMin,
2828
NumberIsFinite,
29-
ObjectGetPrototypeOf,
3029
ObjectKeys,
3130
ObjectSetPrototypeOf,
32-
Proxy,
3331
ReflectApply,
34-
ReflectGet,
35-
ReflectSet,
3632
Symbol,
3733
SymbolAsyncDispose,
3834
SymbolFor,
@@ -987,35 +983,6 @@ class UpgradeStream extends Duplex {
987983

988984
// Other events (most notably, reading) all only
989985
// activate after requestBodyCompleted is called.
990-
991-
// This stream wraps itself in a proxy which forwards all non-stream
992-
// property lookups back to the underlying socket, for backward
993-
// compatibility.
994-
// eslint-disable-next-line no-constructor-return
995-
return new Proxy(this, {
996-
__proto__: null,
997-
has(target, prop) {
998-
return prop in target || prop in socket;
999-
},
1000-
get(target, prop, receiver) {
1001-
if (prop in target) {
1002-
return ReflectGet(target, prop, receiver);
1003-
}
1004-
1005-
return socket[prop];
1006-
},
1007-
set(target, prop, value, receiver) {
1008-
if (prop in target) {
1009-
return ReflectSet(target, prop, value, receiver);
1010-
}
1011-
1012-
socket[prop] = value;
1013-
return true;
1014-
},
1015-
getPrototypeOf(target) {
1016-
return ObjectGetPrototypeOf(socket);
1017-
},
1018-
});
1019986
}
1020987

1021988
requestBodyCompleted(upgradeHead) {

0 commit comments

Comments
 (0)