C++ WebSocket
Summary: ^ Changes include: - C++ WebSocket integration - Explicit asio namespace usage as namespace asio = websocketpp::lib::asio; this way we don't care if boost::asio or just asio is used in the end. Reviewed By: javache Differential Revision: D34388770 fbshipit-source-id: d0b3ee8ac687751ab1b93d483729eb2baccb8687
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4c91382e09
commit
5993a748ba
@@ -19,6 +19,7 @@
|
|||||||
#include <folly/json.h>
|
#include <folly/json.h>
|
||||||
#include <websocketpp/common/memory.hpp>
|
#include <websocketpp/common/memory.hpp>
|
||||||
#include <websocketpp/common/thread.hpp>
|
#include <websocketpp/common/thread.hpp>
|
||||||
|
#include <websocketpp/config/asio.hpp>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -278,30 +279,28 @@ void WebSocketTLSClient::onClose(
|
|||||||
SocketTLSContext WebSocketTLSClient::onTLSInit(
|
SocketTLSContext WebSocketTLSClient::onTLSInit(
|
||||||
const char* hostname,
|
const char* hostname,
|
||||||
websocketpp::connection_hdl) {
|
websocketpp::connection_hdl) {
|
||||||
SocketTLSContext ctx =
|
namespace asio = websocketpp::lib::asio;
|
||||||
websocketpp::lib::make_shared<boost::asio::ssl::context>(
|
SocketTLSContext ctx = websocketpp::lib::make_shared<asio::ssl::context>(
|
||||||
boost::asio::ssl::context::sslv23);
|
asio::ssl::context::sslv23);
|
||||||
|
|
||||||
ctx->set_options(
|
ctx->set_options(
|
||||||
boost::asio::ssl::context::default_workarounds |
|
asio::ssl::context::default_workarounds | asio::ssl::context::no_sslv2 |
|
||||||
boost::asio::ssl::context::no_sslv2 |
|
asio::ssl::context::no_sslv3 | asio::ssl::context::single_dh_use);
|
||||||
boost::asio::ssl::context::no_sslv3 |
|
|
||||||
boost::asio::ssl::context::single_dh_use);
|
|
||||||
|
|
||||||
ctx->set_verify_mode(boost::asio::ssl::verify_peer);
|
ctx->set_verify_mode(asio::ssl::verify_peer);
|
||||||
ctx->load_verify_file(connectionContextStore_->getPath(
|
ctx->load_verify_file(connectionContextStore_->getPath(
|
||||||
ConnectionContextStore::StoreItem::FLIPPER_CA));
|
ConnectionContextStore::StoreItem::FLIPPER_CA));
|
||||||
|
|
||||||
boost::system::error_code error;
|
asio::error_code error;
|
||||||
ctx->use_certificate_file(
|
ctx->use_certificate_file(
|
||||||
connectionContextStore_->getPath(
|
connectionContextStore_->getPath(
|
||||||
ConnectionContextStore::StoreItem::CLIENT_CERT),
|
ConnectionContextStore::StoreItem::CLIENT_CERT),
|
||||||
boost::asio::ssl::context::pem,
|
asio::ssl::context::pem,
|
||||||
error);
|
error);
|
||||||
ctx->use_private_key_file(
|
ctx->use_private_key_file(
|
||||||
connectionContextStore_->getPath(
|
connectionContextStore_->getPath(
|
||||||
ConnectionContextStore::StoreItem::PRIVATE_KEY),
|
ConnectionContextStore::StoreItem::PRIVATE_KEY),
|
||||||
boost::asio::ssl::context::pem,
|
asio::ssl::context::pem,
|
||||||
error);
|
error);
|
||||||
|
|
||||||
return ctx;
|
return ctx;
|
||||||
|
|||||||
Reference in New Issue
Block a user