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

Function getSessionForReuse

lib/internal/tls/wrap.js:165–191  ·  view source on GitHub ↗
(session, options)

Source from the content-addressed store, hash-verified

163}
164
165function getSessionForReuse(session, options) {
166 if (typeof session === 'string')
167 session = Buffer.from(session, 'latin1');
168
169 if (options?.isServer)
170 return session;
171
172 const wrappedSession = unwrapSessionState(session);
173 if (wrappedSession !== undefined) {
174 const servername = getSessionServerIdentity(options);
175 if (wrappedSession.servername !== servername) {
176 debug('ignore session for %s: authenticated for %s',
177 servername, wrappedSession.servername);
178 return;
179 }
180
181 return wrappedSession.session;
182 }
183
184 if (Buffer.isBuffer(session) && options?.rejectUnauthorized !== false) {
185 debug('ignore raw session for verified client connection to %s',
186 getSessionServerIdentity(options));
187 return;
188 }
189
190 return session;
191}
192
193let tlsTracingWarned = false;
194

Callers 1

wrap.jsFile · 0.85

Calls 4

unwrapSessionStateFunction · 0.85
getSessionServerIdentityFunction · 0.85
debugFunction · 0.50
fromMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…