summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test-webserver.cpp29
1 files changed, 6 insertions, 23 deletions
diff --git a/tests/test-webserver.cpp b/tests/test-webserver.cpp
index e9e6df5..077c27e 100644
--- a/tests/test-webserver.cpp
+++ b/tests/test-webserver.cpp
@@ -202,7 +202,7 @@ public:
}
// wait for server to start up
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ std::this_thread::sleep_for(std::chrono::milliseconds(200));
}
void stop()
@@ -611,7 +611,7 @@ private:
std::unique_ptr<shared_data_t, std::function<void(shared_data_t*)>> m_shared;
}; // class WebsocketServerProcess
-BOOST_FIXTURE_TEST_CASE(websocket, Fixture)
+BOOST_FIXTURE_TEST_CASE(websocket_ssl, Fixture)
{
std::string webserver_config{R"CONFIG(<webserver>
<user>www-data</user>
@@ -752,7 +752,7 @@ BOOST_FIXTURE_TEST_CASE(websocket, Fixture)
BOOST_REQUIRE(websocketProcess.is_running());
}
-BOOST_FIXTURE_TEST_CASE(websocket_subprotocol, Fixture)
+BOOST_FIXTURE_TEST_CASE(websocket_plain_subprotocol, Fixture)
{
std::string webserver_config{R"CONFIG(<webserver>
<user>www-data</user>
@@ -810,35 +810,21 @@ BOOST_FIXTURE_TEST_CASE(websocket_subprotocol, Fixture)
BOOST_REQUIRE(websocketProcess.is_running());
std::string host = "::1";
- auto const port = "8081" ;
+ auto const port = "8080" ;
auto const text = "request1";
// The io_context is required for all I/O
boost::asio::io_context ioc;
- // The SSL context is required, and holds certificates
- boost::asio::ssl::context ctx{boost::asio::ssl::context::tlsv13_client};
-
- // This holds the root certificate used for verification
- load_root_certificates(ctx);
-
// These objects perform our I/O
boost::asio::ip::tcp::resolver resolver{ioc};
- boost::beast::websocket::stream<boost::beast::ssl_stream<boost::asio::ip::tcp::socket>> ws{ioc, ctx};
+ boost::beast::websocket::stream<boost::asio::ip::tcp::socket> ws{ioc};
// Look up the domain name
auto const results = resolver.resolve(host, port);
// Make the connection on the IP address we get from a lookup
- auto ep = boost::asio::connect(get_lowest_layer(ws), results);
-
- // Set SNI Hostname (many hosts need this to handshake successfully)
- if(! SSL_set_tlsext_host_name(ws.next_layer().native_handle(), host.c_str()))
- throw boost::beast::system_error(
- boost::beast::error_code(
- static_cast<int>(::ERR_get_error()),
- boost::asio::error::get_ssl_category()),
- "Failed to set SNI Hostname");
+ auto ep = boost::asio::connect(boost::beast::get_lowest_layer(ws), results);
// Update the host_ string. This will provide the value of the
// Host HTTP header during the WebSocket handshake.
@@ -847,9 +833,6 @@ BOOST_FIXTURE_TEST_CASE(websocket_subprotocol, Fixture)
host = "[" + host + "]";
host += ':' + std::to_string(ep.port());
- // Perform the SSL handshake
- ws.next_layer().handshake(boost::asio::ssl::stream_base::client);
-
// Set a decorator to change the User-Agent of the handshake
ws.set_option(boost::beast::websocket::stream_base::decorator(
[](boost::beast::websocket::request_type& req)