File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -1473,6 +1473,16 @@ pub(super) fn ssl_read(
14731473 None // BIO mode has no deadline
14741474 } ;
14751475
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+
14761486 // Loop to handle TLS records and post-handshake messages
14771487 // Matches SSL_read behavior which loops until data is available
14781488 // - CPython uses OpenSSL's SSL_read which loops on SSL_ERROR_WANT_READ/WANT_WRITE
You can’t perform that action at this time.
0 commit comments