go-ruby-net-http is a pure-Go (no cgo) reimplementation of the deterministic, interpreter-independent core of Ruby's Net::HTTP — the HTTP/1.1 message codec from MRI 4.0.5. It builds request bytes exactly as MRI writes them to the socket (request line, default headers in MRI order, Content-Length / chunked framing, form and basic-auth encoding) and parses a raw response byte stream into MRI's Net::HTTPResponse subclass model (status line, folded multi-value headers, Content-Length and chunked decoding) — without any Ruby runtime, and without performing any I/O itself. The socket and TLS are a host-side seam: hand Request.Bytes to your socket's write, feed everything read back to ParseResponse. It is a standalone, reusable module — the HTTP-message backend for go-embedded-ruby, the same sibling pattern as go-ruby-yaml and go-ruby-regexp — differential-tested against MRI, 100% coverage, CI green across 6 arches and 3 OSes.
Request building ready
NewRequest for Get / Post / Put / Delete / Head / Patch / Options — the request line, MRI’s default headers in exact order and casing, Content-Length vs Transfer-Encoding, the empty-body default, set_form_data and Basic / Proxy-Basic auth — serialised byte-for-byte as MRI writes to the socket.
Response parsing ready
ParseResponse over a raw HTTP/1.1 byte stream: the status-line regex, header lines with obs-fold continuation and repeated multi-value fields, and the body decoded by Content-Length or chunked Transfer-Encoding (chunk extensions and trailers included).
Response subclass model ready
Every status code mapped to its Net::HTTPResponse subclass (HTTPOK, HTTPNotFound, …) and category, generated from MRI’s own CODE_TO_OBJ, with the HAS_BODY rule (1xx, 204, 205, 304 carry no body) and the HTTPUnknownResponse / category fallbacks.
Net::HTTPHeader mixin ready
[] / []= / key? / delete / add_field / get_fields / each_header / each_capitalized, plus content_type / content_length / chunked? / connection_close? and the URI.encode_www_form component encoder.
Socket / TLS seam ready
The transport is the host’s, by design: DNS, the TCPSocket and the TLS handshake stay outside. Hand Request.Bytes to your socket’s write and feed everything read back to ParseResponse — the codec touches no network, file, or clock.
Differential oracle & coverage ready
Request bytes, response parse, the subclass over MRI’s whole table and form encoding computed here and checked byte-for-byte against the system ruby (gated on Ruby ≥ 4.0); 100% coverage, gofmt + go vet clean, green across 6 arches and 3 OSes.
- ready capability complete (exit criteria met, nothing material left)
- active in progress (substantial work shipped, not yet finished)
- planned not started yet (or downstream by design)
A faithful pure-Go port of Ruby's `Net::HTTP` message codec, cgo disabled, so it cross-compiles and embeds anywhere. Validated differentially against the system ruby binary, byte-for-byte. It is a standalone, reusable module — the HTTP-message backend bound by rbgo into the sibling org github.com/go-embedded-ruby.