MCPcopy Index your code
hub / github.com/nodejs/node / constructor

Method constructor

lib/_http_server.js:1028–1054  ·  view source on GitHub ↗
(socket, req)

Source from the content-addressed store, hash-verified

1026
1027class UpgradeStream extends Duplex {
1028 constructor(socket, req) {
1029 super({
1030 allowHalfOpen: socket.allowHalfOpen,
1031 });
1032
1033 this[kSocket] = socket;
1034 this[kIncomingMessage] = req;
1035
1036 // Proxy error, end & closure events immediately.
1037 socket.on('error', (err) => this.destroy(err));
1038
1039 socket.on('close', () => this.destroy());
1040 this.on('close', () => socket.destroy());
1041
1042 socket.on('end', () => {
1043 this.push(null);
1044
1045 // Match the socket behaviour, where 'end' will fire despite no 'data'
1046 // listeners if a socket with no pending data ends:
1047 if (this.readableLength === 0) {
1048 this.resume();
1049 }
1050 });
1051
1052 // Other events (most notably, reading) all only
1053 // activate after requestBodyCompleted is called.
1054 }
1055
1056 requestBodyCompleted(upgradeHead) {
1057 this[kIncomingMessage] = null;

Callers

nothing calls this directly

Calls 4

resumeMethod · 0.65
onMethod · 0.45
destroyMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected