Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

detect_ssl

Detect a TLS client handshake on a stream.

Synopsis

Defined in header <boost/beast/core/detect_ssl.hpp>

template<
    class SyncReadStream,
    class DynamicBuffer>
bool
detect_ssl(
    SyncReadStream& stream,
    DynamicBuffer& buffer,
    error_code& ec);
Description

This function reads from a stream to determine if a client handshake message is being received. The call blocks until one of the following is true:

The algorithm, known as a composed operation, is implemented in terms of calls to the next layer's read_some function. Bytes read from the stream will be stored in the passed dynamic buffer, which may be used to perform the TLS handshake if the detector returns true, or be otherwise consumed by the caller based on the expected protocol.

Parameters

Name

Description

stream

The stream to read from. This type must meet the requirements of SyncReadStream.

buffer

The dynamic buffer to use. This type must meet the requirements of DynamicBuffer.

ec

Set to the error if any occurred.

Return Value

true if the buffer contains a TLS client handshake and no error occurred, otherwise false.


PrevUpHomeNext