MCPcopy
hub / github.com/plasma-umass/browsix / requestOCSP

Function requestOCSP

node/lib/_tls_wrap.js:109–143  ·  view source on GitHub ↗
(self, hello, ctx, cb)

Source from the content-addressed store, hash-verified

107
108
109function requestOCSP(self, hello, ctx, cb) {
110 if (!hello.OCSPRequest || !self.server)
111 return cb(null);
112
113 if (!ctx)
114 ctx = self.server._sharedCreds;
115 if (ctx.context)
116 ctx = ctx.context;
117
118 if (self.server.listenerCount('OCSPRequest') === 0) {
119 return cb(null);
120 } else {
121 self.server.emit('OCSPRequest',
122 ctx.getCertificate(),
123 ctx.getIssuer(),
124 onOCSP);
125 }
126
127 var once = false;
128 function onOCSP(err, response) {
129 if (once)
130 return cb(new Error('TLS OCSP callback was called 2 times'));
131 once = true;
132
133 if (err)
134 return cb(err);
135
136 if (!self._handle)
137 return cb(new Error('Socket is closed'));
138
139 if (response)
140 self._handle.setOCSPResponse(response);
141 cb(null);
142 }
143}
144
145
146function onclienthello(hello) {

Callers 1

oncertcbFunction · 0.85

Calls 3

listenerCountMethod · 0.80
cbFunction · 0.70
emitMethod · 0.65

Tested by

no test coverage detected