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

Function fail

example/http/server/stackless-ssl/http_server_stackless_ssl.cpp:211–235  ·  view source on GitHub ↗

Report a failure

Source from the content-addressed store, hash-verified

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

Callers 3

loopMethod · 0.70
listenerMethod · 0.70
loopMethod · 0.70

Calls 1

messageMethod · 0.80

Tested by

no test coverage detected