Improved SSL_R_SHORT_READ check
This commit is contained in:
parent
adbdc6fcda
commit
88569844ea
2 changed files with 12 additions and 4 deletions
|
|
@ -670,15 +670,18 @@ namespace SimpleWeb {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Ignore end of file error codes
|
||||||
|
virtual error_code clean_error_code(const error_code &ec) {
|
||||||
|
return ec == error::eof ? error_code() : ec;
|
||||||
|
}
|
||||||
|
|
||||||
void read_content(const std::shared_ptr<Session> &session) {
|
void read_content(const std::shared_ptr<Session> &session) {
|
||||||
asio::async_read(*session->connection->socket, session->response->streambuf, [this, session](const error_code &ec_, std::size_t /*bytes_transferred*/) {
|
asio::async_read(*session->connection->socket, session->response->streambuf, [this, session](const error_code &ec_, std::size_t /*bytes_transferred*/) {
|
||||||
auto lock = session->connection->handler_runner->continue_lock();
|
auto lock = session->connection->handler_runner->continue_lock();
|
||||||
if(!lock)
|
if(!lock)
|
||||||
return;
|
return;
|
||||||
# define SSL_R_SHORT_READ 219
|
|
||||||
auto ec = ec_ == error::eof ? error_code() : ec_;
|
auto ec = clean_error_code(ec_);
|
||||||
if((ec.value() & 0xff) == SSL_R_SHORT_READ)
|
|
||||||
ec = error_code();
|
|
||||||
|
|
||||||
if(!ec) {
|
if(!ec) {
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,11 @@ namespace SimpleWeb {
|
||||||
protected:
|
protected:
|
||||||
asio::ssl::context context;
|
asio::ssl::context context;
|
||||||
|
|
||||||
|
/// Ignore for end of file and SSL_R_SHORT_READ error codes
|
||||||
|
error_code clean_error_code(const error_code &ec) override {
|
||||||
|
return ec == error::eof || ec == asio::ssl::error::stream_truncated ? error_code() : ec;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<Connection> create_connection() noexcept override {
|
std::shared_ptr<Connection> create_connection() noexcept override {
|
||||||
return std::make_shared<Connection>(handler_runner, *io_service, context);
|
return std::make_shared<Connection>(handler_runner, *io_service, context);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue