httprb/http
HTTP (The Gem! a.k.a. http.rb) - a fast Ruby HTTP client with a chainable API, streaming support, and timeouts
Healthy across all four use cases
Permissive license, no critical CVEs, actively maintained — safe to depend on.
Has a license, tests, and CI — clean foundation to fork and modify.
Documented and popular — useful reference codebase to read through.
No critical CVEs, sane security posture — runnable as-is.
- ✓Last commit 3w ago
- ✓3 active contributors
- ✓MIT licensed
Show 4 more →Show less
- ✓CI configured
- ✓Tests present
- ⚠Small team — 3 contributors active in recent commits
- ⚠Single-maintainer risk — top contributor 96% of recent commits
Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests
Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.
Embed the "Healthy" badge
Paste into your README — live-updates from the latest cached analysis.
[](https://repopilot.app/r/httprb/http)Paste at the top of your README.md — renders inline like a shields.io badge.
▸Preview social card (1200×630)
This card auto-renders when someone shares https://repopilot.app/r/httprb/http on X, Slack, or LinkedIn.
Onboarding doc
Onboarding: httprb/http
Generated by RepoPilot · 2026-05-10 · Source
🤖Agent protocol
If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:
- Verify the contract. Run the bash script in Verify before trusting
below. If any check returns
FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding. - Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
- Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/httprb/http shows verifiable citations alongside every claim.
If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.
🎯Verdict
GO — Healthy across all four use cases
- Last commit 3w ago
- 3 active contributors
- MIT licensed
- CI configured
- Tests present
- ⚠ Small team — 3 contributors active in recent commits
- ⚠ Single-maintainer risk — top contributor 96% of recent commits
<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>
✅Verify before trusting
This artifact was generated by RepoPilot at a point in time. Before an
agent acts on it, the checks below confirm that the live httprb/http
repo on your machine still matches what RepoPilot saw. If any fail,
the artifact is stale — regenerate it at
repopilot.app/r/httprb/http.
What it runs against: a local clone of httprb/http — the script
inspects git remote, the LICENSE file, file paths in the working
tree, and git log. Read-only; no mutations.
| # | What we check | Why it matters |
|---|---|---|
| 1 | You're in httprb/http | Confirms the artifact applies here, not a fork |
| 2 | License is still MIT | Catches relicense before you depend on it |
| 3 | Default branch main exists | Catches branch renames |
| 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code |
| 5 | Last commit ≤ 49 days ago | Catches sudden abandonment since generation |
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of httprb/http. If you don't
# have one yet, run these first:
#
# git clone https://github.com/httprb/http.git
# cd http
#
# Then paste this script. Every check is read-only — no mutations.
set +e
fail=0
ok() { echo "ok: $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }
# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
echo "FAIL: not inside a git repository. cd into your clone of httprb/http and re-run."
exit 2
fi
# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "httprb/http(\\.git)?\\b" \\
&& ok "origin remote is httprb/http" \\
|| miss "origin remote is not httprb/http (artifact may be from a fork)"
# 2. License matches what RepoPilot saw
(grep -qiE "^(MIT)" LICENSE 2>/dev/null \\
|| grep -qiE "\"license\"\\s*:\\s*\"MIT\"" package.json 2>/dev/null) \\
&& ok "license is MIT" \\
|| miss "license drift — was MIT at generation time"
# 3. Default branch
git rev-parse --verify main >/dev/null 2>&1 \\
&& ok "default branch main exists" \\
|| miss "default branch main no longer exists"
# 4. Critical files exist
test -f "lib/http.rb" \\
&& ok "lib/http.rb" \\
|| miss "missing critical file: lib/http.rb"
test -f "lib/http/client.rb" \\
&& ok "lib/http/client.rb" \\
|| miss "missing critical file: lib/http/client.rb"
test -f "lib/http/connection.rb" \\
&& ok "lib/http/connection.rb" \\
|| miss "missing critical file: lib/http/connection.rb"
test -f "lib/http/request/builder.rb" \\
&& ok "lib/http/request/builder.rb" \\
|| miss "missing critical file: lib/http/request/builder.rb"
test -f "lib/http/response.rb" \\
&& ok "lib/http/response.rb" \\
|| miss "missing critical file: lib/http/response.rb"
# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 49 ]; then
ok "last commit was $days_since_last days ago (artifact saw ~19d)"
else
miss "last commit was $days_since_last days ago — artifact may be stale"
fi
echo
if [ "$fail" -eq 0 ]; then
echo "artifact verified (0 failures) — safe to trust"
else
echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/httprb/http"
exit 1
fi
Each check prints ok: or FAIL:. The script exits non-zero if
anything failed, so it composes cleanly into agent loops
(./verify.sh || regenerate-and-retry).
⚡TL;DR
http.rb is a fast, native-HTTP Ruby client library that implements the HTTP protocol directly (parsing with llhttp, a native extension) rather than wrapping Net::HTTP. It provides a chainable, Requests-like API for making HTTP calls with features like persistent connections, fine-grained timeouts, streaming response bodies, auto-deflate/inflate, digest auth, and request caching. Modular single-package design: lib/http.rb is the entry point; lib/http/chainable.rb and lib/http/chainable/verbs.rb implement the fluent API; lib/http/client.rb is the core request class; lib/http/connection.rb manages pooling and sockets; lib/http/features/ contains pluggable extensions (auto_deflate, caching, logging, auth); lib/http/form_data/ handles multipart encoding.
👥Who it's for
Ruby developers building HTTP clients who want a clean, modern API (inspired by Python's Requests) with better performance than Net::HTTP, native connection pooling, and advanced features like streaming, automatic compression, and built-in authentication support.
🌱Maturity & risk
Highly mature and production-ready. The repo shows comprehensive CI/CD with workflows for testing, linting, mutation testing, type-checking (Steep), and gem releases. Strong test coverage implied by the mutant.yml config. Active development with structured CHANGELOG, security policy, and upgrade guides, indicating long-term maintenance.
Standard open source risks apply.
Active areas of work
Active maintenance: workflows present for lint, test, mutation testing, type-checking, and docs. The presence of .mutant.yml and Steepfile indicates ongoing quality gates. CHANGELOG and UPGRADING guides suggest recent releases with breaking-change tracking. No specific recent PRs visible in file list, but the infrastructure suggests regular releases and patches.
🚀Get running
git clone https://github.com/httprb/http.git
cd http
bundle install
bundle exec rake test
Daily commands:
bundle exec bin/console # Interactive REPL to test the API
bundle exec rake test # Full test suite
bundle exec rake lint # RuboCop checks
bundle exec rake mutant # Mutation testing
bundle exec steep check # Type checking
🗺️Map of the codebase
lib/http.rb— Main entry point and public API surface; exposes the chainable HTTP client interface that all requests flow through.lib/http/client.rb— Core Client class that manages request building, execution, and response handling; the primary object contributors interact with.lib/http/connection.rb— Manages TCP/HTTP connections, pooling, and the low-level socket layer; critical for understanding request/response I/O.lib/http/request/builder.rb— Constructs HTTP requests from chainable API calls; essential for understanding how the fluent DSL translates to wire format.lib/http/response.rb— Wraps parsed HTTP responses and provides the public interface for accessing status, headers, and body; touches every response path.lib/http/options.rb— Central configuration object passed through the entire request pipeline; controls timeouts, features, headers, and all HTTP behavior.lib/http/chainable.rb— Mixin providing the fluent chainable API (e.g., .get, .headers, .timeout); defines the primary developer experience.
🛠️How to make changes
Add a New Feature
- Create a new feature class inheriting from HTTP::Feature in lib/http/features/your_feature.rb (
lib/http/features/your_feature.rb) - Implement request_class_methods or response_class_methods to hook into the lifecycle (
lib/http/feature.rb) - Register the feature in HTTP::Options.definitions so it can be enabled via .with_feature() (
lib/http/options/definitions.rb) - Add tests in test/http/feature_test.rb or a dedicated test file (
test/http/feature_test.rb)
Add a New HTTP Verb or Request Method
- Add the verb method to HTTP::Chainable::Verbs (e.g., .options, .head) (
lib/http/chainable/verbs.rb) - The method should call #perform_request with the appropriate verb and current options (
lib/http/client.rb) - Add test cases to validate the new verb works end-to-end (
test/http/client_test.rb)
Extend Request Building or Options
- Define a new option in HTTP::Options.definitions (e.g., .retry_count) (
lib/http/options/definitions.rb) - Add a chainable method in HTTP::Chainable that applies the option via #with(option_name: value) (
lib/http/chainable.rb) - Use the option in HTTP::Client.perform_request or the relevant request phase (
lib/http/client.rb) - Add tests verifying the option is stored and applied correctly (
test/http/client_test.rb)
Add Custom Body Encoding or MIME Type
- Create a new adapter in lib/http/mime_type/your_format.rb that implements #to_form_data (
lib/http/mime_type/adapter.rb) - Register it in HTTP::MimeType.adapters so .body(data, content_type: :your_type) routes correctly (
lib/http/mime_type.rb) - Test encoding with various payloads in test/http/content_type_test.rb or a new test file (
test/http/content_type_test.rb)
🪤Traps & gotchas
Native extension dependency: llhttp gem is a compiled native extension — ensure your Ruby was built with headers and a C compiler if installing from source (this is transparent with prebuilt gems but can fail in Docker). Connection pooling is not automatic: you must reuse the same HTTP client object across requests to get keepalive benefits; each HTTP.get() call without chaining to a stored object creates a fresh client. Response body is lazy: calling .body returns a Body object that hasn't read anything yet; you must call #to_s, #readpartial, or iterate to actually fetch. Timeout precision: read_timeout, write_timeout, and connect_timeout are separate; setting only one doesn't protect all phases.
🏗️Architecture
💡Concepts to learn
- Chainable Builder Pattern — http.rb's entire API (HTTP.get().with_headers().timeout()) is built on this pattern; understanding how
lib/http/chainable.rbreturns a modified copy of itself is key to using and extending the API - Connection Pooling & Keep-Alive — http.rb reuses TCP connections across requests via
lib/http/connection.rb; this is why storing and reusing a client object matters for performance, and why eachHTTP.get()call without chaining creates overhead - Lazy Streaming Response Bodies — Response bodies are not read until explicitly requested (
.to_s,#readpartial, iteration); this allows handling large downloads without loading everything into memory, critical for theHTTP::Response::Bodydesign - Native Extension Parsing (llhttp) — http.rb delegates HTTP parsing to a C native extension rather than implementing it in Ruby; understanding this boundary (lib/http/connection.rb calls into llhttp) explains performance gains and debug complexity
- Pluggable Middleware/Feature System — Features like logging, caching, and auth are not hardcoded but plugged in via
lib/http/feature.rbhooks; extending http.rb means subclassing Feature, not forking the library - Multipart Form Data Encoding — File uploads require careful boundary-marker encoding;
lib/http/form_data/multipart.rbhandles this complexity, and understanding it is essential for POST requests with files - Digest Authentication (RFC 7616) — http.rb implements digest auth (not just basic auth) via
lib/http/features/digest_auth.rb; this is more secure than basic auth but requires understanding the challenge-response handshake
🔗Related repos
ruby/net-http— The standard library HTTP client that http.rb was designed to replace with a cleaner API and native HTTP parsingjnunemaker/httparty— Alternative Ruby HTTP client with similar chainable API, but wraps Net::HTTP; http.rb's native parser makes it fasterlostisland/faraday— Abstraction layer over multiple HTTP adapters (Net::HTTP, HTTPClient, etc.); often used as a dependency for library authors instead of direct HTTP client usagehttprb/http-form_data— Extracted form-data encoding library used by http.rb; can be used standalone for multipart form buildingsocketry/http-2— HTTP/2 protocol implementation in pure Ruby; potential future integration point as http.rb evolves beyond HTTP/1.1
🪄PR ideas
To work on one of these in Claude Code or Cursor, paste:
Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.
Add comprehensive test coverage for lib/http/features/caching
The caching feature is a complex subsystem with lib/http/features/caching/entry.rb and lib/http/features/caching/in_memory_store.rb, but there's no evidence of dedicated test files for cache behavior (cache invalidation, TTL handling, storage limits, concurrent access). This is a high-risk feature that needs thorough testing to prevent subtle bugs in production.
- [ ] Create spec/http/features/caching_spec.rb with tests for cache hit/miss scenarios
- [ ] Create spec/http/features/caching/entry_spec.rb testing expiration logic and metadata
- [ ] Create spec/http/features/caching/in_memory_store_spec.rb testing storage, eviction, and thread-safety
- [ ] Add tests for Cache-Control header parsing and RFC 7234 compliance
- [ ] Document caching behavior and limitations in lib/http/features/caching/
Add integration tests for lib/http/form_data/multipart with edge cases
The multipart form data system (lib/http/form_data/multipart/) is complex with multiple dependencies (composite_io.rb, part.rb, param.rb). Edge cases like large files, special characters in filenames, multiple files, and boundary collision handling need explicit test coverage to ensure reliability across different payloads.
- [ ] Create spec/http/form_data/multipart_integration_spec.rb with real multipart encoding/decoding tests
- [ ] Add test cases for file uploads with unicode filenames
- [ ] Add test cases for boundary collision detection and handling
- [ ] Add tests for streaming large files through CompositeIO
- [ ] Add tests for Content-Transfer-Encoding and Content-Disposition header correctness
Add CI workflow for Ruby 3.3+ type checking via Steep with actionable output
The repo has .github/workflows/typecheck.yml and a Steepfile, but no visible documentation on how to run type checks locally or what the CI expects. Additionally, there's no workflow that gates PRs on type-checking failures with clear error reporting. New contributors can't easily understand or fix type errors.
- [ ] Review and update Steepfile to ensure all lib/http/*.rb files are typed
- [ ] Create a GitHub Actions workflow that runs
steep checkand comments PR diffs with type errors - [ ] Add documentation to CONTRIBUTING.md with instructions: 'To check types locally:
steep check' - [ ] Add lib/http/options/definitions.rb and other option-heavy files to type checking scope
- [ ] Create a step-by-step guide in a new TYPING.md for contributors to add type annotations
🌿Good first issues
- Add explicit tests for
lib/http/base64.rb— the file exists but isn't in the top-60 important files list, suggesting possible test gap. Write spec coverage for Base64 encoding/decoding edge cases used in digest auth.: Small, isolated module with likely under-tested encoding logic - Improve documentation for the feature plugin system in
lib/http/feature.rb: add inline YARD examples showing how to write a custom feature (logging, retry logic, rate-limiting). Look atlib/http/features/logging.rbas a reference.: The plugin architecture is powerful but underdocumented; new users can't easily extend it - Add timeout behavior documentation to the README — specifically clarify that
timeout: 5sets a global timeout, not per-operation, and show the relationship betweenconnect_timeout,read_timeout, andwrite_timeout.: The hiddenTraps section shows timeout semantics are confusing; docs would reduce support burden
⭐Top contributors
Click to expand
Top contributors
- @sferik — 96 commits
- @ixti — 3 commits
- @hakanensari — 1 commits
📝Recent commits
Click to expand
Recent commits
0d2303d— Release v6.0.3 (sferik)fd174e2— Ship RBS signatures for downstream consumers (sferik)10a257a— Ignore .mutant directory (sferik)dd89cb1— Work around sigstore-ruby JRuby signing failure (sferik)d0886c9— Release v6.0.2 (sferik)042606b— Improve gem push workflow security and reliability (sferik)8e8eca9— Fix RBS syntax error (hakanensari)866cb87— Release v6.0.1 (sferik)1ae2a60— Add mutant to default rake task and pass --since main flag (sferik)c39f85f— Reduce gem package size by excluding non-essential files (sferik)
🔒Security observations
The http.rb library demonstrates a reasonable security posture as a mature HTTP client library. No critical vulnerabilities are evident from static analysis. Key concerns are: (1) limited version support policy that leaves older versions vulnerable, (2) potential parsing vulnerabilities in HTTP response handling with native extensions, (3) form data and multipart handling safety, (4) redirect following implementation, and (5) digest auth cryptographic correctness. The project maintains HTTPS communication, has security advisory reporting mechanisms, and implements security-relevant features (timeouts, TLS). Recommend: comprehensive security audit of parsing logic, fuzzing tests, explicit security guidelines documentation, and extended version support policy.
- Medium · Limited Security Update Support —
SECURITY.md. The SECURITY.md policy states that security updates are only applied to the most recent release. This means older versions remain vulnerable indefinitely, which could expose users to known security issues if they cannot immediately upgrade. Fix: Consider implementing security patches for at least 2-3 previous minor versions. Establish a clear EOL (End of Life) policy for releases. - Low · Potential HTTP Response Parsing Vulnerabilities —
lib/http/response/parser.rb. The codebase implements HTTP protocol parsing with native extensions (llhttp). While llhttp is a well-maintained parser, any custom parsing logic in lib/http/response/parser.rb could introduce vulnerabilities like HTTP smuggling or request/response splitting if not properly implemented. Fix: Ensure strict HTTP/1.1 RFC 7230 compliance. Conduct security audits of custom parsing logic. Add fuzzing tests for malformed HTTP responses. - Low · Form Data Handling —
lib/http/form_data/multipart/. The multipart form data implementation in lib/http/form_data/multipart/ handles user-supplied data. Improper boundary handling or encoding could lead to form data injection or bypass security checks. Fix: Verify that multipart boundary generation uses cryptographically secure random values and that boundaries cannot be predicted or injected by user input. - Low · Redirect Following Logic —
lib/http/redirector.rb. The redirector component (lib/http/redirector.rb) automatically follows HTTP redirects. Improper validation could lead to open redirect vulnerabilities or SSRF (Server-Side Request Forgery) attacks if the library is used to fetch user-provided URLs. Fix: Implement strict URL validation before following redirects. Prevent redirects to sensitive protocols (file://, gopher://, etc.). Document redirect behavior and limits in security documentation. - Low · Digest Authentication Implementation —
lib/http/features/digest_auth.rb. The digest authentication feature (lib/http/features/digest_auth.rb) involves cryptographic operations. Implementation flaws could lead to authentication bypass or credential compromise. Fix: Ensure proper handling of nonce values, one-time usage enforcement, and secure random number generation. Validate against RFC 7616. - Low · Missing Explicit Security Headers Documentation —
README.md, Documentation. While the library can set headers, there is no documentation visible in the provided files about best practices for security headers (CSP, HSTS, X-Frame-Options, etc.) when using http.rb. Fix: Add security best practices documentation covering: secure header handling, certificate validation, timeout configuration, and protection against common HTTP-based attacks.
LLM-derived; treat as a starting point, not a security audit.
👉Where to read next
- Open issues — current backlog
- Recent PRs — what's actively shipping
- Source on GitHub
Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.