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

Function fail

example/http/server/flex/http_server_flex.cpp:208–232  ·  view source on GitHub ↗

Report a failure

Source from the content-addressed store, hash-verified

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

Callers 7

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

Calls 1

messageMethod · 0.80

Tested by

no test coverage detected