boostorg / beast

HTTP and WebSocket built on Boost.Asio in C++11
http://www.boost.org/libs/beast
Boost Software License 1.0
4.25k stars 633 forks source link

SSL mode not handshake happening #2894

Open EkbalCode opened 1 week ago

EkbalCode commented 1 week ago

I am using example/http/client/async-ssl/http_client_async_ssl.cpp

// The SSL context is required, and holds certificates ssl::context ctx{ssl::context::tlsv12_client};

// This holds the root certificate used for verification
load_root_certificates(ctx);

// Verify the remote server's certificate
ctx.set_verify_mode(ssl::verify_peer);

This code execution not making handshake so in turn I am getting 404 status code .

Kindly help

ashtum commented 4 days ago

This code execution not making handshake.

The handshake happens in the following line. What is the error message on failure?

        // Perform the SSL handshake
        stream_.async_handshake(
            ssl::stream_base::client,
            beast::bind_front_handler(
                &session::on_handshake,
                shared_from_this()));

so in turn I am getting 404 status code .

Do you mean an HTTP 404 error? This shouldn't be related to the handshake process because if the connection fails to perform the handshake correctly, it can't make any request at all.