Commit 1e9f3465 authored by Subodh Iyengar's avatar Subodh Iyengar Committed by Facebook Github Bot 2

Allow override of session context

Summary:We currently set the session context to the
default of common name, this allows session
context to be set to a different value
for different applications

Reviewed By: ngoyal

Differential Revision: D3059769

fb-gh-sync-id: 185afeb487c2c62dcf44f96076bd05871692c7ab
shipit-source-id: 185afeb487c2c62dcf44f96076bd05871692c7ab
parent 2ea64dd2
...@@ -556,6 +556,14 @@ SSL* SSLContext::createSSL() const { ...@@ -556,6 +556,14 @@ SSL* SSLContext::createSSL() const {
return ssl; return ssl;
} }
void SSLContext::setSessionCacheContext(const std::string& context) {
SSL_CTX_set_session_id_context(
ctx_,
reinterpret_cast<const unsigned char*>(context.data()),
std::min(
static_cast<int>(context.length()), SSL_MAX_SSL_SESSION_ID_LENGTH));
}
/** /**
* Match a name with a pattern. The pattern may include wildcard. A single * Match a name with a pattern. The pattern may include wildcard. A single
* wildcard "*" can match up to one component in the domain name. * wildcard "*" can match up to one component in the domain name.
......
...@@ -309,6 +309,11 @@ class SSLContext { ...@@ -309,6 +309,11 @@ class SSLContext {
*/ */
SSL* createSSL() const; SSL* createSSL() const;
/**
* Sets the namespace to use for sessions created from this context.
*/
void setSessionCacheContext(const std::string& context);
/** /**
* Set the options on the SSL_CTX object. * Set the options on the SSL_CTX object.
*/ */
...@@ -373,6 +378,7 @@ class SSLContext { ...@@ -373,6 +378,7 @@ class SSLContext {
ClientProtocolFilterCallback getClientProtocolFilterCallback() { ClientProtocolFilterCallback getClientProtocolFilterCallback() {
return clientProtoFilter_; return clientProtoFilter_;
} }
/** /**
* Disables NPN on this SSL context. * Disables NPN on this SSL context.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment