Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lib http client #697

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Next Next commit
handshake
  • Loading branch information
weyrick committed Nov 14, 2023
commit 5b0f6f6dff1f70ca76d593ea5ff53b4ab0109e30
8 changes: 6 additions & 2 deletions libs/visor_http_client/httpssession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,12 @@ void HTTPSSession::do_handshake()
_tls_state = LinkState::DATA;
} else {
int error = SSL_get_error(_ssl_session, err);
if (error == SSL_ERROR_SSL || error == SSL_ERROR_SYSCALL) {
std::cerr << "Handshake failed: SSL or syscall error" << std::endl;
if (error == SSL_ERROR_SSL) {
std::cerr << "Handshake failed: SSL error" << std::endl;
ERR_print_errors_fp(stderr);
_handshake_error();
} else if (error == SSL_ERROR_SYSCALL) {
std::cerr << "Handshake failed: syscall error" << std::endl;
ERR_print_errors_fp(stderr);
_handshake_error();
} else if (error == SSL_ERROR_WANT_READ || error == SSL_ERROR_WANT_WRITE) {
Expand Down
14 changes: 6 additions & 8 deletions libs/visor_http_client/test_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,14 @@ TEST_CASE("HTTP Client", "[http]")
// tcp_session->write(std::move(std::get<0>(qt)), std::get<1>(qt));
};

tcp_session = std::make_shared<HTTPSSession>(tcp_handle, malformed_data, got_dns_message, connection_ready,
malformed_data, target_list[0], HTTPMethod::GET);
connect_tcp_events(tcp_handle, tcp_session);
auto client = std::make_shared<HTTPSSession>(tcp_handle,
nullptr,
nullptr,
nullptr,
nullptr,
tcp_session = std::make_shared<HTTPSSession>(tcp_handle,
malformed_data,
got_dns_message,
connection_ready,
malformed_data,
target_list[0],
HTTPMethod::GET);
connect_tcp_events(tcp_handle, tcp_session);
if (!tcp_session->setup()) {
std::cerr << "setup failed" << std::endl;
}
Expand Down
Loading