ftp_server 2.3.1
ftp_server: ^2.3.1 copied to clipboard
Standards-compliant FTP/FTPS server in Dart. Supports plain FTP and encrypted FTPS (explicit/implicit TLS), read-only and read-write modes, with pluggable file system backends.
Changelog #
2.3.1 #
- Updated README with comprehensive documentation for all features
- Updated package description
2.3.0 #
FTPS Support (RFC 4217 / RFC 2228) #
- Explicit FTPS:
AUTH TLS/AUTH TLS-Cupgrade on standard port - Implicit FTPS: TLS from connection start via
SecureServerSocket - Data channel encryption:
PROT P(private) andPROT C(clear) with configurable enforcement - New commands:
AUTH,PBSZ,PROT,CCC TlsConfigclass for certificate configuration (PEM files or pre-builtSecurityContext)- Mutual TLS (client certificate) support via
requireClientCert FEATadvertisesAUTH TLS,PBSZ,PROTwhen TLS configuredrequireEncryptedDataoption (defaults totruefor implicit mode)- Known limitations:
CCCreturns 534 — Dart'sSecureSocketcannot be unwrapped to plain TCPREINreturns 502 under TLS — same Dart limitation- FileZilla (GnuTLS) may warn "TLS connection was non-properly terminated" on data connections — this is a client-side GnuTLS issue; the server sends close_notify correctly and data transfers complete successfully
2.2.0 #
This release focuses on RFC compliance and stability. The server now follows RFC 959, RFC 2389, RFC 2428, and RFC 3659 for all implemented commands.
RFC Compliance Fixes #
RETRnow validates file existence before opening data connection (no orphaned 150 replies)STOR,RETR,CWD,DELE,RMD,SIZE,MDTMreturn 501 for empty argumentsMKD257 response now contains the absolute FTP path (not relative)CWD/CDUP250 response uses virtual FTP path (no physical path leakage)PASSnow works with username-only or password-only server configurationsUSERsends 230 directly for no-auth servers (clients can skip PASS)FEATno longer listsPASV(base RFC 959 command, not an extension per RFC 2389)EPSV ALLnow enforced —PORT/PASVrefused afterEPSV ALL(RFC 2428 §4)EPSVvalidates network protocol argument; returns 522 for unsupported protocols (RFC 2428 §3)PORTvalidates all byte values are 0–255 (501 on invalid syntax)ABORreplies 225 when data connection open but no transfer in progress (RFC 959 §5.4)MLSDomitssizefact for directory entries (RFC 3659 §7.5.5)LIST -la/LIST -aflags are stripped before directory lookup
Bug Fixes #
- Fixed unhandled
SocketExceptioncrashes when clients disconnect during transfers (#15) - Fixed
OPTS UTF8crash when sent without ON/OFF argument - Fixed passive socket file descriptor leak when clients send multiple PASV/EPSV commands
- Fixed session list memory leak — sessions now auto-remove on disconnect
- Fixed fire-and-forget async in MKD, RMD, DELE, RNTO, RENAME handlers — all now properly awaited
- Fixed
handleRntorethrowing exceptions without sending response to client - Fixed
_getIpAddressonly matching 192.x.x.x networks — now supports 10.x and 172.x, and prefers control socket address - Fixed pipelined commands (multiple commands in one TCP segment) being silently dropped
- Fixed
waitForClientDataSocketcrash when passive listener is closed before client connects
New Commands #
NLST— returns bare filenames only, separated from LIST (was aliased to LIST)HELP— returns list of all supported commandsSTAT— returns server statusSTRU— accepts F (File), rejects others with 504MODE— accepts S (Stream), rejects others with 504ALLO— validates byte count and optionalR <record-size>syntax (RFC 959)ACCT— accepts account string, returns 202 (superfluous); allowed pre-authREIN— full session reinitialize: resets auth, CWD, data connections, pending stateSITE— returns 501/502 with proper syntax validation
Improvements #
- Authentication enforcement: commands require login when credentials are configured
TYPEnow acceptsTYPE A Nform (ASCII Non-print) per RFC 959FEATnow advertises MLSD capability- Error responses sanitized — no server path or exception leakage to clients
activeSessionsnow returns unmodifiable list- Async command queue ensures sequential processing of pipelined commands
Internal API Changes #
FTPCommandHandlerconstructor no longer takescontrolSocket(it was unused — all communication goes through the session)FTPCommandHandler.handleCommandis nowasyncto properly await all operationsFtpSession.handleMlsdandhandleMdtmno longer take an extrasessionparameter- Added
FtpSession.reinitialize()for clean REIN implementation - Added
FtpSession.epsvAllModeflag for EPSV ALL enforcement
2.1.1 #
- Updated README documentation to include new rename commands
2.1.0 #
- Added RNFR/RNTO and RENAME commands for file and directory renaming
- Support for both PhysicalFileOperations and VirtualFileOperations
2.0.0 #
-
Added
PhysicalFileOperationsfor direct access to a single physical root directory, with no virtual mapping. -
PhysicalFileOperationsallows writing, creating, and deleting files/directories at the root directory. This is the main difference fromVirtualFileOperations, which does NOT allow writing to the virtual root (/). -
Updated documentation and tests to cover both file operation backends, their differences, and their limitations.
-
Users can now choose between virtual mapping (multiple mapped roots) and direct physical access (single root) depending on their use case.
-
BREAKING: The
sharedDirectoriesparameter is removed from FtpServer. To use shared directories, users must now create aVirtualFileOperationsinstance with their desired directories and pass it to thefileOperationsparameter. See the README for updated usage and migration instructions. -
BREAKING: The
startingDirectoryparameter is removed from FtpServer. The starting directory is now handled by theFileOperationsinstance (eitherVirtualFileOperationsorPhysicalFileOperations). Both backends now accept astartingDirectoryparameter in their constructors to control the initial directory.
1.0.7 #
- Improve pub points
- Update deps versions
1.0.6+1 #
- Fixing ChangeLog Styling
1.0.6 #
- Added a getter for getting a list of active sessions
1.0.4 #
- Adding MLSD,MDTM
1.0.3 #
- Android fix ip address
- Fix race condition for passive transfer
- Added UTF8 to Feat command
1.0.2 #
- Remove flutter test Dependency
1.0.1 #
- Fix Readme.
1.0.0 #
Breaking Changes #
-
Virtual File System: Replaced
allowedDirectorieswithsharedDirectoriesfor better directory management under a virtual root. All directories specified insharedDirectoriesare now shared under a virtual root, providing a unified view of multiple directories to the FTP clients. -
Removed Flutter Dependency: The server now runs directly on Dart, removing the need for Flutter and making it lighter.
Enhancements #
-
Improved Error Handling: Added more robust error messages and safeguards for file operations.
-
Removed Legacy Code: Cleaned up old path handling logic, streamlining file operations with the new virtual file system.
0.0.7 #
- update dependencies
0.0.5 #
0.0.4 #
0.0.3 #
- Refactored to allow custom logs
0.0.2 #
- Added CDUP command
0.0.1+1 #
- update readme
0.0.1 #
- initial release.