/*
* If sid_ctx_length is 0 there is no specific application context
* associated with this session, so when we try to resume it and
- * SSL_VERIFY_PEER is requested, we have no indication that this is
- * actually a session for the proper application context, and the
- * *handshake* will fail, not just the resumption attempt.
- * Do not cache these sessions that are not resumable.
+ * SSL_VERIFY_PEER is requested to verify the client identity, we have no
+ * indication that this is actually a session for the proper application
+ * context, and the *handshake* will fail, not just the resumption attempt.
+ * Do not cache (on the server) these sessions that are not resumable
+ * (clients can set SSL_VERIFY_PEER without needing a sid_ctx set).
*/
- if (s->session->sid_ctx_length == 0
+ if (s->server && s->session->sid_ctx_length == 0
&& (s->verify_mode & SSL_VERIFY_PEER) != 0)
return;