]> git.apps.os.sepia.ceph.com Git - ceph-ci.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:49:51 +0000 (09:49 +0100)
commit7e1856f18ca53ec253e247794ac9df742f60eab9
treedbb3b3d7a7efb22ece172220b2151f62086283b4
parent54df7fb33b451c5ae25ef2501c61664d40373a59
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