MCPcopy Create free account
hub / github.com/mscdex/ssh2 / onPayload

Function onPayload

lib/protocol/Protocol.js:2031–2060  ·  view source on GitHub ↗
(payload)

Source from the content-addressed store, hash-verified

2029}
2030
2031function onPayload(payload) {
2032 // XXX: move this to the Decipher implementations?
2033
2034 this._onPacket();
2035
2036 if (payload.length === 0) {
2037 this._debug && this._debug('Inbound: Skipping empty packet payload');
2038 return;
2039 }
2040
2041 payload = this._packetRW.read.read(payload);
2042
2043 const type = payload[0];
2044 if (type === MESSAGE.USERAUTH_SUCCESS
2045 && !this._server
2046 && !this._authenticated) {
2047 this._authenticated = true;
2048 if (this._kex.negotiated.cs.compress === 'zlib@openssh.com')
2049 this._packetRW.write = new ZlibPacketWriter(this);
2050 if (this._kex.negotiated.sc.compress === 'zlib@openssh.com')
2051 this._packetRW.read = new ZlibPacketReader();
2052 }
2053 const handler = MESSAGE_HANDLERS[type];
2054 if (handler === undefined) {
2055 this._debug && this._debug(`Inbound: Unsupported message type: ${type}`);
2056 return;
2057 }
2058
2059 return handler(this, payload);
2060}
2061
2062function getCompatFlags(header) {
2063 const software = header.versions.software;

Callers

nothing calls this directly

Calls 1

readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…