There was an error while loading. Please reload this page.
1 parent 8baade6 commit 23436d4Copy full SHA for 23436d4
1 file changed
crates/stdlib/src/ssl/compat.rs
@@ -1473,6 +1473,16 @@ pub(super) fn ssl_read(
1473
None // BIO mode has no deadline
1474
};
1475
1476
+ // CRITICAL: Flush any pending TLS output before reading
1477
+ // This ensures data from previous write() calls is sent before we wait for response.
1478
+ // Without this, write() may leave data in pending_tls_output (if socket buffer was full),
1479
+ // and read() would timeout waiting for a response that the server never received.
1480
+ if !is_bio {
1481
+ socket
1482
+ .flush_pending_tls_output(vm, deadline)
1483
+ .map_err(SslError::Py)?;
1484
+ }
1485
+
1486
// Loop to handle TLS records and post-handshake messages
1487
// Matches SSL_read behavior which loops until data is available
1488
// - CPython uses OpenSSL's SSL_read which loops on SSL_ERROR_WANT_READ/WANT_WRITE
0 commit comments