Skip to content
CAI
Software that uses CAICheck a score

httprb/http

64.6

Adequate · 19 September 2026

8k

lines of production code

Ruby

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a modern Ruby HTTP client library that provides a session-based API for constructing and executing HTTP requests. It supports advanced capabilities including streaming request and response bodies, automatic compression and decompression, configurable timeouts, and resilient retry logic with backoff strategies. The library also handles content negotiation through MIME type parsing, multipart form data, and JSON serialization, while leveraging a native parser for performance.

How it got here

2011–2014 — HTTP library modernization and refactoring

8 changes.

The project underwent a significant architectural overhaul, rebranding from Http to HTTP and introducing a session-based API with distinct client and request components. Core functionality was enhanced through the integration of the llhttp parser for faster response handling, support for streaming bodies, and new features like multipart form data and JSON MIME type adapters. The codebase was also modernized by upgrading to Ruby 3.2+, switching to Minitest, and implementing comprehensive type checking and mutation testing tooling.

2015–2026 — HTTP client feature expansion and test modernization

17 changes.

The project introduced a modular feature system adding support for compression, caching, authentication, and configurable retry logic with exponential backoff. It also implemented robust timeout handling and standardized header normalization, while shipping RBS type signatures for static analysis. Concurrently, the test suite was migrated from RSpec to Minitest, significantly expanding coverage for core HTTP components and replacing external dependencies with custom test servers.

Features

Add JSON MIME type adapter

Introduces a new JSON adapter for the MIME type system, allowing users to encode Ruby objects to JSON strings and decode JSON strings back into Ruby objects. This includes a base adapter class and a concrete JSON implementation that registers itself for the 'application/json' MIME type and alias.

_lib/http/mime\type · high confidence

Added HTTP status reason phrase mapping

A new \REASONS\ constant has been added to \HTTP::Response::Status\, providing a comprehensive map of HTTP status codes to their standard reason phrases (e.g., 404 maps to "Not Found"). This allows users to programmatically retrieve the human-readable reason associated with a status code.

lib/http/response/status · high confidence

Added development console script

A new \bin/console\ script has been added to simplify local development and experimentation. This executable Ruby script sets up the bundler environment, loads the \http\ library, and launches an IRB session, allowing developers to quickly interact with the gem's code and dependencies without starting a full application.

bin · high confidence

Introduce HTTP::ContentType parsing and HTTP::FormData multipart support

The library now includes an HTTP::ContentType class that parses Content-Type headers to extract the MIME type and charset, and adds support for building multipart/form-data and application/x-www-form-urlencoded request bodies via the new HTTP::FormData module (including FormData::File for file uploads).

lib/http · high confidence

Introduces configurable timeout handlers for HTTP connections

The library now includes a timeout subsystem with three distinct strategies: a global timeout that applies a single time limit to the entire request, per-operation timeouts that allow separate limits for connection, read, and write phases, and a null handler that enforces no timeouts. These handlers manage non-blocking I/O using \IO::Wait\ and support native connect timeouts on Ruby 3.4+ for improved Happy Eyeballs (RFC 8305) compatibility, while also handling SSL handshake timeouts and socket closure gracefully.

lib/http/timeout · high confidence

New HTTP retry logic with configurable delays and Retry-After support

The HTTP library now includes a new retriable feature that automatically retries failed requests based on configurable parameters. This implementation introduces a new \OutOfRetriesError\ that exposes the last response and original cause for better debugging. The retry mechanism supports custom delay strategies, including parsing HTTP \Retry-After\ headers (both numeric seconds and RFC 2822 dates), exponential backoff with jitter, and custom predicates for determining which exceptions or status codes should trigger a retry.

lib/http/retriable · high confidence

New extensible features for HTTP compression, caching, authentication, and error handling

The HTTP client now supports a modular feature system that allows users to enable capabilities like automatic request body compression (AutoDeflate), automatic response decompression (AutoInflate), RFC 7234 HTTP caching, RFC 2617/7616 Digest Authentication, request/response logging, and automatic raising of errors for non-2xx responses. These features are registered with the options system and can be composed using \HTTP.use(:feature\_name)\, providing a cleaner API for common HTTP behaviors without modifying the core client logic.

lib/http/features · high confidence

Ship RBS type signatures for downstream consumers

This release includes RBS type signature files (sig/http.rbs, sig/deps.rbs, sig/llhttp.rbs) and a manifest (sig/manifest.yaml) to support static type checking for the HTTP gem. The signatures define the public API for HTTP, Session, and Client classes, including method signatures for verbs, options, and hooks, while also providing stubs for external dependencies like Addressable and llhttp-ffi, and overrides for standard library classes like StringIO and File to ensure compatibility with the gem's implementation.

sig · high confidence

Behavioural changes

Introduce streamable response body, gzip/deflate inflation, and LLHttp-based parsing

HTTP responses are now handled via a new \HTTP::Response::Body\ class that supports streaming reads via \readpartial\ and preserves content encoding, rather than eagerly loading the entire body. An \HTTP::Response::Inflater\ automatically decompresses gzip/deflate payloads when the connection enables auto-inflation. Under the hood, the library replaces the previous parser with \llhttp\ for faster HTTP response parsing, including a JRuby-specific fix to retain callback procs and prevent intermittent hangs. Additionally, \HTTP::Response::Status\ has been refactored to use \Comparable\ and \Forwardable\ instead of \Delegator\, providing better type safety and comparison capabilities.

lib/http/response · high confidence

Introduces canonical header name constants and a thread-safe normalizer

The library now provides a \HTTP::Headers::Known\ module containing constants for standard HTTP header names (such as \Accept-Encoding\, \Content-Type\, and \Authorization\) and the \CHUNKED\ transfer encoding value, replacing the need for magic strings. Additionally, a new \HTTP::Headers::Normalizer\ class has been added to convert header names into their canonical capitalized form (e.g., \content-type\ to \Content-Title\). This normalizer includes a thread-local cache to optimize performance and ensure thread safety during header processing.

lib/http/headers · high confidence

Library rebranded from Http to HTTP with new session-based API

The library has been renamed from the \Http\ module to \HTTP\ to align with standard naming conventions. This change introduces a new session-based architecture, replacing the previous flat module structure with distinct components like \HTTP::Session\, \HTTP::Client\, and \HTTP::Request\. Users can now utilize a chainable interface, such as \HTTP\[:accept =\> "text/html"\].get(...)\, which returns an \HTTP::Session\ object, marking a significant shift in how requests are constructed and executed.

lib · high confidence

Refactored request body handling and streaming architecture

The request body logic has been extracted into a dedicated \HTTP::Request::Body\ class, enabling explicit streaming support for IO objects and enumerables while ensuring IO streams are rewound after consumption. The \HTTP::Request::Builder\ now centralizes request construction, including the addition of a \Content-Length\ header based on the body's byte size and the neutralization of protocol-relative URIs to prevent resolution issues with base URIs. Additionally, the \HTTP::Request::Writer\ has been updated to handle chunked transfer encoding correctly and to stop writing immediately upon receiving an \EPIPE\ error, improving robustness during request transmission.

lib/http/request · high confidence

Test coverage

Add mutation testing and type-checking tooling; Added Minitest test suite for HTTP timeout handling; Added comprehensive test coverage for HTTP request internals; Added comprehensive test suite for HTTP::Retriable components; Added test coverage for HTTP library features; Added test coverage for HTTP response body, parser, and status components; Added test suites for connection reuse and timeout handling; Added tests for HTTP::Headers::Normalizer thread safety and caching; Expanded test coverage for HTTP client components; Migrate test suite to Minitest; New custom test server implementation for HTTP testing; New test infrastructure for HTTP and SSL testing.

Dependencies

Upgrade to Ruby 3.2+ and modernize dependency stack

The library now requires Ruby 3.2 or later and has significantly updated its development and runtime dependencies. The Gemfile now pins RuboCop to version 1.85 (along with related plugins like rubocop-minitest and rubocop-performance) and switches the test suite to Minitest. Runtime dependencies have been updated to use the native \llhttp\ gem (\~\> 0.6.1) on MRI and \llhttp-ffi\ (\~\> 0.5.1) on JRuby, replacing older parser implementations. The gemspec has also been modernized with explicit license metadata, MFA requirements for publishing, and updated author information.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 65.

Lenses

  • Code Health 100
  • Architecture 65
  • Maturity 56
  • Readiness 69
  • Security 90

Changes since last survey

  • 300 commits — 257 feature/other, 43 fixes

By area

  • (root) — 135 commits
  • lib/http — 119 commits
  • spec/lib — 19 commits
  • .github/workflows — 10 commits
  • test/http — 8 commits
  • test/support — 3 commits
  • (repo) — 2 commits
  • .github/dependabot.yml — 1 commit
  • sig/http.rbs — 1 commit
  • sig/manifest.yaml — 1 commit
  • spec/support — 1 commit

Notable commits

  • fix: Add Feature#on_request hook to fix instrumentation with retries
  • fix: Fix FrozenError exception on Ruby 2.7
  • fix: Fix HTTP 1xx informational response handling regression
  • fix: Fix Instrumentation not inheriting Feature
  • fix: Fix LocalJumpError with unconditionally yielding instrumenters
  • fix: Fix RBS syntax error
  • fix: Fix README for 4.x stable branch
  • fix: Fix RuboCop offenses introduced by a newer release
  • fix: Fix SSL test harness and re-enable skipped HTTPS tests
  • fix: Fix YARD default options
  • fix: Fix Zlib::BufError when auto_inflate encounters non-gzip response body
  • fix: Fix HTTP::Timeout::Global#connect_ssl (#698)
  • fix: Fix chamgelog uri in gemspec
  • fix: Fix cookies extraction (#694)
  • fix: Fix false EndlessRedirectError on cookie-dependent redirect loops
  • fix: Fix links to the documentation in the README
  • fix: Fix logging feature consuming response body and preventing streaming
  • fix: Fix missing request URI on response auto inflate
  • fix: Fix more rubocop offenses
  • fix: Fix non-ASCII related specs
  • …and 280 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

httprb/http was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit a210c0adb724b340121cafcbceccd7424e7e25e4 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.