Repository navigation
fix(ftp): speak implicit FTPS on port 990 and fail fast on TLS reuse - #615
Merged
Merged
Conversation
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. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
linroid
force-pushed
the
fix/ftps-implicit-tls
branch
from
October 23, 2026 14:21
9755b9f to
48ebb43
Compare
ftps:// URLs default to port 990, where servers start with TLS (implicit FTPS), but RealFtpClient sent AUTH TLS in plaintext and waited for a greeting that never came: the download hung until killed. An ftps:// URL on port 990 now opens its control connection with TLS and skips AUTH TLS, as curl and FileZilla read it; other ports keep explicit FTPS. Servers that require data connections to resume the control connection's TLS session (Rebex, vsftpd's require_ssl_reuse, FileZilla Server) refuse every transfer, which Ketch retried for minutes as a short transfer. A transfer that ends with an error reply now throws it, and FtpError reads the session-reuse refusals as KetchError.Unsupported with the reason.
linroid
force-pushed
the
fix/ftps-implicit-tls
branch
from
October 23, 2026 14:50
48ebb43 to
2aff8d4
Compare
Contributor
Test Results 2 194 files 2 222 suites 57m 22s ⏱️ Results for commit 2aff8d4. |
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.
Follows #614 (merged), which touched the same files.
Found while downloading from Rebex's public FTPS test server (
test.rebex.net) with the CLI.1.
ftps://on its default port hung foreverFtpUrldefaultsftps://to port 990, which is implicit FTPS: the server expects a TLS handshake as soon as the connection opens.RealFtpClientonly spoke explicit FTPS: it waited for a plaintext220greeting and then sentAUTH TLS. Neither side ever spoke, andketch ftps://demo:[email protected]/readme.txthung until it was killed.Now an
ftps://URL on port 990 (FtpUrl.implicitTls) opens its control connection with TLS before reading the greeting, andupgradeToTls()only sendsPBSZ 0/PROT P. This is how curl and FileZilla readftps://. Other ports (e.g.ftps://host:21/) keep explicitAUTH TLS, so existing setups behave as before.2. Servers requiring TLS session reuse were retried for minutes
ktor-network-tls cannot resume TLS sessions (a known, documented limit). Servers that require data connections to resume the control session therefore refuse every transfer: Rebex, vsftpd with its default
require_ssl_reuse=YES, and FileZilla Server. They say why in the transfer's final reply (425 Cannot secure data connection - TLS session resumption required.), but Ketch only logged that as a warning and retried a generic short transfer. Before: 114 s of retries ending inFTP connection closed prematurely: received 0 of 95 bytes.Now
retrieve()throws the error reply a transfer ends with, andFtpError.fromReplyreads the session-reuse refusals of Rebex, vsftpd and FileZilla Server asKetchError.Unsupported, which is not retried. The download fails in about 10 s with:Verification
ketchfrom this branch againsttest.rebex.net: implicit (:990) now connects, logs in and reads SIZE/MDTM over TLS. Both implicit and explicit (:21) transfers fail in ~10 s with the message above, as Rebex requires session resumption.RealFtpClientTlsTest.retrieve_implicitTls_securesBeforeGreeting(scripted JSSE server that starts with TLS: download completes, noAUTH TLS,PROT Psent, data over TLS),RealFtpClientPassiveTest.retrieve_transferEndingWithRefusal_throwsTheReplysError,FtpErrorTest.fromReply_tlsSessionReuseRequired_mapsToUnsupported(Rebex, vsftpd and FileZilla Server wordings), andFtpUrlTestcases for whichftps://URLs are implicit../gradlew :library:ftp:jvmTestpasses.