Skip to content

Commit 03926de

Browse files
authored
Fix unclean TLS shutdown (#3191)
* Fix dirty shutdown * generic comment
1 parent 3e7aa6b commit 03926de

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sqlx-core/src/net/tls/tls_rustls.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@ impl<S: Socket> Socket for RustlsSocket<S> {
7171
}
7272

7373
futures_util::ready!(self.poll_complete_io(cx))?;
74-
self.inner.socket.poll_shutdown(cx)
74+
75+
// Server can close socket as soon as it receives the connection shutdown request.
76+
// We shouldn't expect it to stick around for the TLS session to close cleanly.
77+
// https://security.stackexchange.com/a/82034
78+
let _ = futures_util::ready!(self.inner.socket.poll_shutdown(cx));
79+
80+
Poll::Ready(Ok(()))
7581
}
7682
}
7783

0 commit comments

Comments
 (0)