(session, options)
| 163 | } |
| 164 | |
| 165 | function 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 | |
| 193 | let tlsTracingWarned = false; |
| 194 |
no test coverage detected
searching dependent graphs…