dart-lang/shelf
62.4
Adequate · 5 November 2026
5.8k
lines of production code
Dart
primary language
4
measurements over time
What this system is
Features
Add CI automation script for multi-package testing
The repository now includes a new \tool/ci.sh\ script generated by mono\_repo v6.7.2 to standardize continuous integration workflows. This script automates the execution of analysis, formatting, and testing tasks across multiple packages defined in the \PKGS\ environment variable. It intelligently detects whether the repository is a Flutter or Dart project to use the appropriate SDK commands and supports various test configurations, including running tests in Chrome and with the Dart2Wasm compiler.
tool · high confidence
Add HTTP/1.1 compliance testing package
A new vendor submodule (Http11Probe) has been added to the repository, providing the baseline package for HTTP/1.1 compliance testing.
vendor · high confidence
Add HTTP/1.1 compliance testing package for shelf
A new \pkgs/\_shelf\_compliance\ package has been added to provide HTTP/1.1 compliance and hardening tests for \package:shelf\. This package uses the vendored \Http11Probe\ tool to validate the server's behavior against RFC requirements and common edge cases. It includes a test harness, an echo server implementation for testing, and a set of golden reports that establish a baseline for compliance across categories like capabilities, cookies, and general compliance. Also in this area: 2 commits (0 fixes) modifying pkgs, pkgs/\_shelf\_compliance.
_pkgs/\_shelf\compliance · medium confidence · unverified
Add example application for shelf\_router\_generator
The example directory now includes a runnable Dart application demonstrating how to use the shelf\_router\_generator. It shows how to define HTTP handlers using annotations like @Route.get and @Route.mount, and how the generator produces the corresponding router code (main.g.dart) to wire these routes into a Shelf server.
_pkgs/shelf\_router\generator/example · high confidence
Add shelf\_router usage examples
The example application now demonstrates how to use the shelf\_router package, including defining routes with URL parameters, handling asynchronous requests, mounting nested routers, and setting up middleware pipelines.
_pkgs/shelf\router/example · high confidence
Initial release of shelf\_packages\_handler
This entry introduces the \shelf\_packages\_handler\ package, which provides a Shelf handler for serving virtual \packages/\ directories. It includes \packagesHandler\ to serve package assets based on a provided map or the current isolate's resolution logic, and \packagesDirHandler\ to mount this behavior at any \/packages/\ segment in the URL. The package requires Dart ^3.9.0 and includes comprehensive tests for both handlers.
_pkgs/shelf\_packages\handler · high confidence
Initial release of shelf\_packages\_handler
This entry introduces the \shelf\_packages\_handler\ package, which provides a Shelf handler for serving virtual \packages/\ directories. It includes \packagesHandler\ to serve package assets based on a provided map or the current isolate's resolution logic, and \packagesDirHandler\ to mount this behavior at any \/packages/\ segment in the URL. The package requires Dart ^3.9.0 and includes comprehensive tests for both handlers.
_pkgs/shelf\_router\generator/lib · high confidence
Initial release of shelf\_test\_handler for testing HTTP interactions
This change introduces the \shelf\_test\_handler\ package, providing utilities to test HTTP interactions with Shelf handlers. It includes \ShelfTestHandler\ for defining expected request sequences and \ShelfTestServer\ for wrapping the handler in a local HTTP server, allowing developers to assert on request methods, paths, and bodies during unit tests. The package requires Dart 3.9.0 and is configured to run tests on Chrome and Dart2Wasm.
_pkgs/shelf\_test\handler · high confidence
Initial release of shelf\_web\_socket package
The shelf\_web\_socket package is introduced, providing a Shelf handler that upgrades HTTP requests to WebSocket connections. The core \webSocketHandler\ function accepts a connection callback and optional configuration for supported subprotocols, allowed origins (to prevent cross-origin attacks), and ping intervals for disconnect detection. An example application is included to demonstrate serving the handler on localhost.
_pkgs/shelf\_web\socket/lib · high confidence
Introduce shelf\_router package for request routing
Adds the \shelf\_router\ library, providing a \Router\ class to route HTTP requests to handlers based on method and path patterns. It supports defining routes programmatically or via annotations using the \shelf\_router\_generator\ package to automatically generate router methods for handler classes.
_pkgs/shelf\router/lib · high confidence
Introduce shelf\_router with Trie-based routing and annotation support
This change introduces the shelf\_router package, providing a new HTTP router for Shelf applications. It features a Trie-based routing engine that optimizes performance by filtering route candidates based on static path prefixes before applying regular expressions. The router supports standard HTTP verbs (GET, POST, etc.), route parameter extraction (accessible via request.params), and automatic HEAD request handling for GET routes. It also includes a @Route annotation class designed for use with shelf\_router\_generator to automatically generate routing code from annotated class methods.
_pkgs/shelf\router/lib/src · high confidence
Introduce shelf\_router\_generator for automatic router code generation
Added the \shelf\_router\_generator\ package, which provides a code generator that scans Dart classes for methods annotated with \shelf\router.Route\. The generator automatically produces \\$\<ClassName\>Router\ factory methods that configure a \shelf\_router.Router\ instance by mapping annotated handlers to their respective HTTP verbs and routes, simplifying the setup of HTTP routing logic.
_pkgs/shelf\_router\generator/lib/src · high confidence
Behavioural changes
Add 401 Unauthorized response constructor and fix Cookie header joining
The \Response\ class now includes a \Response.unauthorized\ constructor for creating 401 status responses, providing a convenient way to signal missing or invalid authentication credentials. Additionally, the library now correctly joins multiple \Cookie\ header values with \; \ instead of \,\, adhering to RFC 6265 and RFC 9113 specifications to ensure proper cookie handling in HTTP messages.
pkgs/shelf/lib/src · high confidence
Bump minimum Dart SDK to 3.9.0
The shelf\_proxy package now requires Dart 3.9.0 or higher. This change updates the package's minimum SDK constraint, meaning users must upgrade their Dart environment to use this version of the library.
_pkgs/shelf\proxy · high confidence
Configurable X-Powered-By response header
The \serve\ and \serveRequests\ functions in \shelf\_io.dart\ now accept a \poweredByHeader\ argument, allowing users to customize or omit the default 'X-Powered-By' response header. By default, the header is set to 'Dart with package:shelf', but passing \null\ removes it entirely, giving users control over server technology disclosure.
pkgs/shelf/lib · high confidence
Lazy connection info resolution and RFC-compliant cookie header joining
The \shelf\_io\ adapter now resolves the \shelf.io.connection\_info\ context value lazily, caching the result on first access to avoid unnecessary \getpeername\ system calls for requests that do not inspect connection details. Additionally, when multiple \Cookie\ headers are present in a request, they are now joined with \'; '\ instead of \','\ in the single-value headers map, aligning with the cookie-string grammar defined in RFC 6265.
pkgs/shelf · high confidence
Removal of library tag in shelf\_static.dart
The library tag declaration has been removed from lib/shelf\_static.dart. This change cleans up the source file by eliminating the explicit library identifier, which is no longer required for the package's structure.
lib · high confidence
WebSocket handler now requires HTTP/1.1 and dart:io sockets
The \webSocketHandler\ has been updated to enforce stricter protocol requirements: it now rejects requests that do not use HTTP/1.1 and requires the underlying server to support request hijacking via \dart:io\ sockets. This change removes support for WebSocket connections initiated through non-standard or non-IO sockets, ensuring that only valid, hijackable HTTP/1.1 upgrade requests are processed.
_pkgs/shelf\_web\socket/lib/src · high confidence
shelf\_static 1.2.0: Async file I/O, ETag support, and range request fixes
The \shelf\_static\ handler now uses asynchronous file system operations (replacing blocking calls like \statSync\) to prevent blocking the Dart isolate event loop, significantly improving performance under high concurrency. It adds support for HTTP caching via \generateETag\ and \maxAge\ parameters on \createStaticHandler\ and \createFileHandler\, and fixes handling of oversized integer values in HTTP \Range\ headers to prevent unhandled \FormatException\ errors.
_pkgs/shelf\static · high confidence
Test coverage
Added router performance benchmarks; Added test coverage for shelf\_proxy forwarding and header handling; Added test fixtures for shelf\_router\_generator code generation; Added tests for ShelfTestHandler and ShelfTestServer; Added tests for WebSocket handler functionality; Added tests for route entry matching, router behavior, and trie-based routing; Added tests for shelf\_router\_generator build verification and server routing.
Dependencies
Shelf ecosystem packages updated to Dart 3.9+ and modern dependency versions
The shelf ecosystem (shelf, shelf\_router, shelf\_static, shelf\_proxy, shelf\_web\_socket, shelf\_packages\_handler, shelf\_test\_handler, and shelf\_router\_generator) has been updated to require Dart SDK ^3.9.0 and upgraded to use modern versions of core dependencies such as http, test, and analyzer. This ensures compatibility with the latest Dart runtime and standardizes linting across the packages via dart\_flutter\_team\_lints.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 64 → 62 (-1.8)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 96 → 96 (-0.0)
- Architecture 98 → 94 (-3.5)
- Maturity 57 → 60 (+3.3)
- Readiness 62 → 54 (-7.1)
- Security 72 → 70 (-1.9)
- Performance 77 → 77 (+0.0)
Resolved (6)
- Documentation: no installation or build instructions (README.md)
- Documentation: no project overview (README.md)
- Documentation: no usage examples (README.md)
- Off-boarding risk: anonymized user #1
- TodoComment (pkgs/shelf/test/shelf_io_test.dart)
- WebSocketHandler.handle (cyclomatic 16) (pkgs/shelf_web_socket/lib/src/web_socket_handler.dart)
New (5)
- Leaked secret: private-key (pkgs/_shelf_compliance/lib/src/adapter/ssl_certs.dart)
- Off-boarding risk: anonymized user #1
- Orphaned file (pkgs/_shelf_compliance/lib/src/adapter/ssl_certs.dart)
- Secret: private-key (pkgs/_shelf_compliance/lib/src/adapter/ssl_certs.dart)
- TodoComment (pkgs/_shelf_compliance/lib/src/adapter/adapter_tests.dart)
Changes since last survey
- 6 commits — 6 feature/other, 0 fixes
By area
- pkgs/_shelf_compliance — 3 commits
- .github/workflows — 2 commits
- pkgs/shelf_router_generator — 1 commit
Notable commits
- change: Add a LICENSE to _shelf_compliance (#552)
- change: Share shelf_io's tests as an adapter conformance suite (#547)
- change: Tighten pull_request_label workflow permissions (#550)
- change: _shelf_compliance: generalize harness for additional adapters (#549)
- change: build(deps): bump the github-actions group with 3 updates (#554)
- change: shelf_router_generator: ignore invalid_use_of_internal_member on RouterEntry (#548)
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
dart-lang/shelf 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 5 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 9946de555f1eb3abd8ae5054848b9c3c2bd36e4d — the exact code this score is about.
- Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.