Repository navigation
fix(ftp): stream files of unknown size and name the path a server lacks - #635
Merged
Merged
Conversation
A file whose size the server would not tell, as on servers without SIZE, could not be downloaded at all: the download failed with "Unknown file size - file may not exist". A missing file or a folder failed the same way, with no detail. - Such a file now streams over one connection from byte zero to the end of the transfer, as HTTP content of unknown size does. - SIZE answering 550 is a path with no file there, missing or a folder, unless MDTM dates it: the client fails with "The server has no file at <path> (FTP 550: ...)", as curl treats it. - Other 5xx replies carry the server's reply as the error's detail, so the CLI and the apps say "FTP 550: No such file or directory." rather than "Source 'ftp' error".
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
Test Results 2 201 files 2 229 suites 56m 6s ⏱️ Results for commit 1409846. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
FtpDownloadSourcerefused any file whose size it couldn't read:SIZE(old or embedded servers) could not be downloaded from at all, even thoughRETRworks.RETRrefusals (5xx) had no detail either.Fix
MDTMdates it; a few servers can't size a file that exists.RealFtpClient.sizethen fails with aSourceErrorwhose detail names the path and the reply (FtpError.noFile). curl and aria2 also treat a 550 toSIZEas "not found".FTP <code>: <message>as the detail, cut to 200 characters.After:
Tests
FtpDownloadSourceTest:SIZEstreams the file over one connection, with no segments and final progress equal to its size.RealFtpClientSizeTest(jvmTest, against the scripted server, which now answersSIZEandMDTMwhen given replies):MDTMdates is unknown, not missing.SIZEgives an unknown size.FtpErrorTest: the 550 detail.ftp.gnu.org: a missing file and a folder fail with the path named; a real file still downloads in segments.SIZE/MDTMremoved streams 64 MB with a matching SHA-256, and its missing file and folder say why.