Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/detail/connection_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
#include <boost/corosio/socket_option.hpp>
#include <boost/corosio/tcp_socket.hpp>
#include <boost/corosio/timeout.hpp>
#include <boost/corosio/tls_stream.hpp>
#include <boost/url/scheme.hpp>
#include <boost/url/url_view.hpp>

#include <memory>
#include <string>
#include <string_view>
#include <utility>

namespace boost
Expand Down Expand Up @@ -123,7 +125,13 @@ class tls_connection final : public connection
capy::io_task<>
handshake()
{
return stream_.handshake(corosio::openssl_stream::client);
return stream_.handshake(corosio::tls_role::client);
}

void
set_hostname(std::string_view hostname)
{
stream_.set_hostname(hostname);
}

bool
Expand Down Expand Up @@ -361,11 +369,9 @@ connection_pool::connect(urls::url_view url) const

if(url.scheme_id() == scheme::https)
{
auto tls_ctx = tls_ctx_;
tls_ctx.set_hostname(url.encoded_host());

auto conn =
std::make_unique<tls_connection>(std::move(socket), tls_ctx);
std::make_unique<tls_connection>(std::move(socket), tls_ctx_);
conn->set_hostname(url.encoded_host());
auto [hec] = co_await conn->handshake();
if(hec)
co_return { hec, {} };
Expand Down
3 changes: 2 additions & 1 deletion test/unit/detail/connection_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <boost/corosio/socket_option.hpp>
#include <boost/corosio/tcp_acceptor.hpp>
#include <boost/corosio/tls_context.hpp>
#include <boost/corosio/tls_stream.hpp>

#include "scripted_net.hpp"
#include "test_suite.hpp"
Expand Down Expand Up @@ -486,7 +487,7 @@ class connection_pool_test
{
corosio::openssl_stream s{ co_await server.next(), tls_ctx };
auto [hec] = co_await s.handshake(
corosio::openssl_stream::server);
corosio::tls_role::server);
BOOST_TEST(!hec);

co_await pong(&s);
Expand Down
Loading