Commit 6f7d8f37 authored by Samuel Miller's avatar Samuel Miller Committed by Facebook GitHub Bot

Adding SSL option setting to AsyncSSLSocket test client

Summary: This allows the test client to be used with session tickets enabled, if desired

Reviewed By: yfeldblum

Differential Revision: D25795104

fbshipit-source-id: 1adfb6c17c6da24db9c6367485a5cd0f8e534661
parent aa8c3c8f
......@@ -741,6 +741,7 @@ TEST(AsyncSSLSocketTest, SSLClientTest) {
// Set up SSL client
EventBase eventBase;
auto client = std::make_shared<SSLClient>(&eventBase, server.getAddress(), 1);
client->setSSLOptions(SSL_OP_NO_TICKET);
client->connect();
EventBaseAborter eba(&eventBase, 3000);
......@@ -767,6 +768,7 @@ TEST(AsyncSSLSocketTest, SSLClientTestReuse) {
EventBase eventBase;
auto client =
std::make_shared<SSLClient>(&eventBase, server.getAddress(), 10);
client->setSSLOptions(SSL_OP_NO_TICKET);
client->connect();
EventBaseAborter eba(&eventBase, 3000);
......@@ -793,6 +795,8 @@ TEST(AsyncSSLSocketTest, SSLClientTimeoutTest) {
EventBase eventBase;
auto client =
std::make_shared<SSLClient>(&eventBase, server.getAddress(), 1, 10);
client->setSSLOptions(SSL_OP_NO_TICKET);
client->connect(true /* write before connect completes */);
EventBaseAborter eba(&eventBase, 3000);
eventBase.loop();
......
......@@ -1127,7 +1127,6 @@ class SSLClient : public AsyncSocket::ConnectCallback,
errors_(0),
writeAfterConnectErrors_(0) {
ctx_.reset(new folly::SSLContext());
ctx_->setOptions(SSL_OP_NO_TICKET);
ctx_->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
memset(buf_, 'a', sizeof(buf_));
}
......@@ -1148,6 +1147,8 @@ class SSLClient : public AsyncSocket::ConnectCallback,
return writeAfterConnectErrors_;
}
void setSSLOptions(long options) { ctx_->setOptions(options); }
void connect(bool writeNow = false) {
sslSocket_ = AsyncSSLSocket::newSocket(ctx_, eventBase_);
if (session_ != nullptr) {
......
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