issue-576: Fix SSL uploads corruption when using Unix curl passive mode #663
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit addresses issue #576 where Unix curl FTP uploads over SSL/TLS resulted in corrupted zip files. The root cause was premature SSL shutdown during active data transfers.
Problem:
When
OpenSSL.SSL.ZeroReturnError
occurred inSSLConnection.recv()
during an active file transfer, the connection would immediately close viasuper().handle_close()
, causing incomplete file writes and corruption.Solution:
Modified
SSLConnection.recv()
to defer connection closure when a file transfer is in progress. Iffile_obj
exists (indicating active transfer), the method returnsb''
instead of closing the connection immediately.Changes:
SSLConnection.recv()
to check for active file transfers before closing onSSL.ZeroReturnError
TLS_DTPHandler.close()
override to ensure proper SSL shutdownFTPHandler.on_file_received()
Testing:
The fix prevents premature SSL shutdown during file transfers while maintaining proper connection cleanup after transfer completion. This resolves the specific corruption issue reported in #576.
Note: This addresses the SSL-specific corruption issue. Broader 0-byte transfer problems observed during testing are separate and require additional investigation.