forked from boostorg/beast
Better treatment of SSL short reads:
fix #38 This improves the behavior when encountering a short read: * Any stream error encountered during a read is converting into `http::error::partial_message` if some data was received but the message is incomplete. * Examples squelch SSL short read errors from the logs.
This commit is contained in:
1 parent
d4dddec1c0
commit
094f5ec5cb
11 files changed
+124
-5
No files matched your search
@@ -43,7 +43,7 @@ parse_until(
|
||||
{
|
||||
if(parser.got_some())
|
||||
{
|
||||
// caller sees EOF on next read
|
||||
// Caller sees EOF on next read
|
||||
ec = {};
|
||||
parser.put_eof(ec);
|
||||
BOOST_ASSERT(ec || parser.is_done());
|
||||
@@ -55,7 +55,17 @@ parse_until(
|
||||
return 0;
|
||||
}
|
||||
if(ec)
|
||||
{
|
||||
// Upgrade the error if we have a partial message.
|
||||
// This causes SSL short reads (and every other error)
|
||||
// to be converted into something else, allowing the
|
||||
// caller to distinguish an SSL short read which
|
||||
// represents a safe connection closure, versus
|
||||
// a closure with data loss.
|
||||
if(parser.got_some() && ! parser.is_done())
|
||||
ec = error::partial_message;
|
||||
return 0;
|
||||
}
|
||||
if(parser.is_done())
|
||||
return 0;
|
||||
if(buffer.size() > 0)
|
||||
|
||||
@@ -105,6 +105,7 @@ public:
|
||||
// What else could it be?
|
||||
BOOST_ASSERT(sr_.is_done());
|
||||
}
|
||||
|
||||
return net::post(
|
||||
s_.get_executor(),
|
||||
beast::bind_front_handler(
|
||||
|
||||
Reference in new issue
Block a user