Repository navigation
Bind pure-Go net-ftp into rbgo (require "net/ftp") - #204
Closed
tannevaled wants to merge 1 commit into
Closed
tannevaled wants to merge 1 commit into
tannevaled wants to merge 1 commit into
Conversation
Wire github.com/go-ruby-net-ftp/net-ftp — the interpreter-independent FTP protocol codec (command construction, reply classification, PASV/EPSV address extraction, MLSx parsing) — into a real Net::FTP client that drives Go net sockets, mirroring the socket-transport pattern of the Net::HTTP binding. - net_ftp.go: Net::FTP class + the Net::FTPError family (Reply/Temp/Perm/ Proto/Connection) + Net::FTP::MLSxEntry. Surface: new/open (block-closing), connect/login (USER/PASS/ACCT ladder, anonymous default), passive/binary/ use_pasv_ip accessors, pwd/chdir(CDUP->CWD fallback)/mkdir/rmdir/delete/ rename, size/mtime/mdtm/system/status/help/site/noop, nlst/list/mlsd/mlst, retrlines/retrbinary/storlines/storbinary, get*/put* file helpers, abort/quit/close, sendcmd/voidcmd. - net_ftp_bind.go: the transport engine — control-connection reply reading via the codec LineReader, passive (PASV/EPSV dial) and active (PORT/EPRT listen) data connections, TYPE negotiation, and codec-error -> Ruby-class mapping. The transfer path closes the data socket before raising on an error reply so no fd/goroutine leaks. - registerNetFTP() runs after registerNetHTTP (Net module) and registerSocket/ registerOpenSSL; "net/ftp" added to providedFeatures; ftpObj / ftpMLSxEntry wired into classOf. Tests drive an in-process loopback FTP server (no real network, connections force-closed and joined -> no leaked goroutines), covering every command, passive/active + PASV/EPSV/PORT/EPRT, and each error branch; new files at 100% statement coverage. CGO=0, builds on all six 64-bit arches. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
Superseded by the net-wave consolidation PR (single merge onto main; shared builtins/require/object_model). Work preserved verbatim; branch kept. |
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.
Summary
Binds github.com/go-ruby-net-ftp/net-ftp — the interpreter-independent FTP protocol codec (command construction, reply classification, PASV/EPSV address extraction, MLSx parsing) — into a real Net::FTP client. rbgo owns the sockets (Go
net), the library owns every observable byte, mirroring the socket-transport pattern of the Net::HTTP binding.require "net/ftp"now works with no.rbfile.Surface
Net::FTP.new(host=nil, options),Net::FTP.open(...) { |ftp| }(yields and closes, even on raise).connect,login(USER/PASS/ACCT ladder, anonymous default password),welcome,last_response,last_response_code/lastresp.passive/passive=,binary/binary=,use_pasv_ip/use_pasv_ip=(both PASV and EPSV, PORT and EPRT).pwd/getdir,chdir(CDUP→CWD fallback on 500),mkdir,rmdir,delete,rename,size,mtime,mdtm,system,status,help,site,noop.nlst,list/ls/dir,mlsd,mlst→Net::FTP::MLSxEntry(pathname, facts Hash of Integer/Time/String,file?/directory?, perm predicates).retrlines,retrbinary,storlines,storbinary; file helpersget/getbinaryfile/gettextfile,put/putbinaryfile/puttextfile.abort,quit,close,closed?; genericsendcmd/voidcmd.Net::FTPErrorfamily (FTPReplyError/FTPTempError/FTPPermError/FTPProtoError/FTPConnectionError), re-raised from the codec by class name.Wiring
registerNetFTP()runs afterregisterNetHTTP(theNetmodule) and afterregisterSocket/registerOpenSSL."net/ftp"added toprovidedFeatures;ftpObj/ftpMLSxEntryadded toclassOf.Verification
go tool cover -funcfiltered onnet_ftpreports no line below 100%).internal/vmsuite green;-raceclean;gofmt/go vetclean.rbgobinary:require "net/ftp"returns true,Net::FTP/Net::FTP::MLSxEntry/ the error tree resolve.🤖 Generated with Claude Code