Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache example is write-only #11

Closed
alexlamsl opened this issue May 9, 2016 · 0 comments · Fixed by #25
Closed

Cache example is write-only #11

alexlamsl opened this issue May 9, 2016 · 0 comments · Fixed by #25

Comments

@alexlamsl
Copy link

It may makes sense for the example to call .probe() so cached OCSP responses get reused.

var cache = new ocsp.Cache();

var server = https.createServer({
  cert: cert,
  key: key
}, function(req, res) {
  res.end('hello world');
});

server.on('OCSPRequest', function(cert, issuer, cb) {
  ocsp.getOCSPURI(cert, function(err, uri) {
    if (err)
      return cb(err);

    var req = ocsp.request.generate(cert, issuer);
    cache.probe(req.id, function(err, response) {
      if (err)
        return cb(err);

      if (response)
        return cb(null, response);

      var options = {
        url: uri,
        ocsp: req.data
      };

      cache.request(req.id, options, cb);
    });
  });
});
sebdeckers added a commit to sebdeckers/ocsp that referenced this issue Nov 10, 2017
- Handle missing URI
- Look up cached response

fix indutny#11
fix indutny#10
fix indutny#15
indutny pushed a commit that referenced this issue Nov 10, 2017
- Handle missing URI
- Look up cached response

fix #11
fix #10
fix #15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant