Skip to content

Bind net-pop into rbgo: require "net/pop" (Net::POP3 / Net::POPMail) - #200

Closed
tannevaled wants to merge 1 commit into
mainfrom
feat/bind-net-pop
Closed

tannevaled wants to merge 1 commit into
mainfrom
feat/bind-net-pop

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

Wire the pure-Go POP3 protocol codec go-ruby-net-pop/net-pop into the VM so require "net/pop" works with no .rb file, mirroring the redis/pg injected-socket-seam bindings.

Surface

  • Net::POP3.new(address, port = 110, apop = false, connection: io) and the Net::POP3.start(...) { |pop| } convenience.
  • Session: #start (USER/PASS or APOP) / #finish (QUIT) / #mails (LIST) / #each_mail / #each / #delete_all / #n_mails / #n_bytes (STAT) / #reset (RSET) / #set_all_uids (UIDL) / #noop / #stls, plus #address / #port / #apop? / #started? / #active? / #_connection.
  • Net::POPMail: #number / #length / #size / #unique_id / #uidl (UIDL n) / #pop / #mail / #to_s (RETR, dot-unstuffed) / #header / #top (TOP) / #delete / #delete! (DELE) / #deleted?.
  • Errors: Net::POPError / Net::POPBadResponse (< POPError) / Net::POPAuthenticationError.

Seam

The socket is the host seam: rbgo drives the library Transport (Writeline/Readline/ReadRawLine) over an injected Ruby IO-like object (#write / #gets). Tests run against an in-process FakePOP transport — no real network, no leaked goroutines; Ruby callbacks run inline under the GVL.

Wiring

registerNetPOP() runs after registerNetHTTP (creates the Net module) and after registerSocket/registerOpenSSL; "net/pop" added to providedFeatures; POP3Obj/POPMailObj added to classOf.

Verification

  • go build ./internal/vm/ = 0; full repo go build ./... = 0; go vet ./internal/vm/ = 0.
  • 100% statement coverage of both new files (net_pop.go, net_pop_bind.go) — all 30 functions.
  • Full internal/vm suite + whole-repo go test ./... green; -race clean; gofmt -l clean.
  • 6-arch cross-build (amd64/arm64/riscv64/loong64/ppc64le/s390x) all pass. CGO=0, BSD-3-Clause.

🤖 Generated with Claude Code

Wire the pure-Go POP3 protocol codec github.com/go-ruby-net-pop/net-pop
into the VM so `require "net/pop"` works with no .rb file, mirroring the
redis/pg injected-socket-seam bindings.

Surface:
- Net::POP3.new(address, port = 110, apop = false, connection: io) and the
  Net::POP3.start(...) { |pop| } convenience.
- Session: #start (USER/PASS or APOP) / #finish (QUIT) / #mails (LIST) /
  #each_mail / #each / #delete_all / #n_mails / #n_bytes (STAT) / #reset
  (RSET) / #set_all_uids (UIDL) / #noop / #stls, plus #address / #port /
  #apop? / #started? / #active? / #_connection.
- Net::POPMail: #number / #length / #size / #unique_id / #uidl (UIDL n) /
  #pop / #mail / #to_s (RETR, dot-unstuffed) / #header / #top (TOP) /
  #delete / #delete! (DELE) / #deleted?.
- Net::POPError / Net::POPBadResponse (< POPError) / Net::POPAuthenticationError.

The socket is the host seam: rbgo drives the library's Transport over an
injected Ruby IO-like object (#write / #gets), so tests run against an
in-process transport with no real network and no leaked goroutines; Ruby
callbacks run inline under the GVL. CGO=0, builds on all six 64-bit arches.

registerNetPOP() runs after registerNetHTTP (Net module) and
registerSocket/registerOpenSSL; "net/pop" is added to providedFeatures and
POP3Obj/POPMailObj to classOf. New files kept at 100% statement coverage
via net_pop_internal_test.go over a deterministic FakePOP transport.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled

Copy link
Copy Markdown
Contributor Author

Superseded by the net-wave consolidation PR (single merge onto main; shared builtins/require/object_model). Work preserved verbatim; branch kept.

@tannevaled tannevaled closed this Jul 6, 2026
tannevaled added a commit that referenced this pull request Jul 7, 2026
6 pure-Go stdlib bindings (Net:: mail/transfer stack + WEBrick), each 100% cov + full suite + 6-arch. Also fixes net-ftp's Windows basename and guards #198's CGI-proxy test on Windows (case-insensitive env). Supersedes #200-205.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant