MCPcopy Create free account
hub / github.com/boostorg/beast / fail

Function fail

example/http/server/async-ssl/http_server_async_ssl.cpp:209–233  ·  view source on GitHub ↗

Report a failure

Source from the content-addressed store, hash-verified

207
208// Report a failure
209void
210fail(beast::error_code ec, char const* what)
211{
212 // ssl::error::stream_truncated, also known as an SSL "short read",
213 // indicates the peer closed the connection without performing the
214 // required closing handshake (for example, Google does this to
215 // improve performance). Generally this can be a security issue,
216 // but if your communication protocol is self-terminated (as
217 // it is with both HTTP and WebSocket) then you may simply
218 // ignore the lack of close_notify.
219 //
220 // https://github.com/boostorg/beast/issues/38
221 //
222 // https://security.stackexchange.com/questions/91435/how-to-handle-a-malicious-ssl-tls-shutdown
223 //
224 // When a short read would cut off the end of an HTTP message,
225 // Beast returns the error beast::http::error::partial_message.
226 // Therefore, if we see a short read here, it has occurred
227 // after the message has been completed, so it is safe to ignore it.
228
229 if(ec == net::ssl::error::stream_truncated)
230 return;
231
232 std::cerr << what << ": " << ec.message() << "\n";
233}
234
235// Handles an HTTP server connection
236class session : public std::enable_shared_from_this<session>

Callers 6

on_handshakeMethod · 0.70
on_readMethod · 0.70
on_writeMethod · 0.70
on_shutdownMethod · 0.70
listenerMethod · 0.70
on_acceptMethod · 0.70

Calls 1

messageMethod · 0.80

Tested by

no test coverage detected