]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
librbd/migration/HttpClient: ignore stream_truncated when shutting down SSL
authorIlya Dryomov <idryomov@gmail.com>
Mon, 9 Dec 2024 10:19:57 +0000 (11:19 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 16 Dec 2024 08:51:29 +0000 (09:51 +0100)
commit2c485039deba81ecb231b2685411f7a475dab4fe
tree04a52b659c316a334ce6c5ff0b7b5486211517d0
parent17b35b3d3c87f166d41bf0887df0b9acbc2712fc
librbd/migration/HttpClient: ignore stream_truncated when shutting down SSL

Propagate ec to handle_disconnect() and use it to suppress
stream_truncated errors.  Here is a quote from Beast documentation [1]:

  // Gracefully shutdown the SSL/TLS connection
  error_code ec;
  stream.shutdown(ec);
  // Non-compliant servers don't participate in the SSL/TLS shutdown process and
  // close the underlying transport layer. This causes the shutdown operation to
  // complete with a `stream_truncated` error. One might decide not to log such
  // errors as there are many non-compliant servers in the wild.
  if(ec != net::ssl::error::stream_truncated)
      log(ec);

... and a commit that made ignoring stream_truncated safe [2]:

  // ssl::error::stream_truncated, also known as an SSL "short read",
  // indicates the peer closed the connection without performing the
  // required closing handshake
  // [...]
  // When a short read would cut off the end of an HTTP message,
  // Beast returns the error beast::http::error::partial_message.
  // Therefore, if we see a short read here, it has occurred
  // after the message has been completed, so it is safe to ignore it.

[1] https://www.boost.org/doc/libs/develop/libs/beast/doc/html/beast/using_io/ssl_tls_shutdown.html
[2] https://github.com/boostorg/beast/commit/094f5ec5cb3be1c3ce2d985564f1f39e9bed74ff

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 9fa0bcc67d79d90996cd4ec2b5af56d051ef6be7)
src/librbd/migration/HttpClient.cc