valyala/fasthttp
69.1
Adequate · 13 November 2026
29.3k
lines of production code
Go
primary language
8
measurements over time
What this system is
Features
Add Let's Encrypt HTTPS example
A new example file (examples/letsencrypt/letsencryptserver.go) demonstrates how to serve an HTTPS server using Let's Encrypt via autocert. The example configures a fasthttp server with TLS, using autocert to automatically obtain and manage certificates for a whitelisted domain (defaulting to example.com) and caching them in a local directory. It specifically listens on port 443 to support the tls-alpn-01 challenge required by Let's Encrypt.
examples/letsencrypt · high confidence
Add client and host\_client usage examples
New example programs have been added to demonstrate how to use the fasthttp client library. The client example shows how to configure a general-purpose client for multiple hosts, including setting timeouts, limiting response body size, and handling JSON payloads. The host\_client example demonstrates a simpler setup for single-host communication, including basic authentication and URI reuse.
examples/client · high confidence
Add expvarhandler for serving expvar metrics as JSON
A new expvarhandler package has been added to provide a fasthttp-compatible request handler that exposes Go's expvar metrics as JSON. The handler supports filtering metrics via an 'r' query parameter using a regular expression, with a default pattern that matches all variables. This allows users to expose and query expvar data directly through HTTP requests in a structured JSON format.
expvarhandler · high confidence
Add fasthttp pprof handler with strict path matching
Introduces a new \pprofhandler\ package that provides a fasthttp-compatible handler for Go runtime profiling data (cmdline, profile, symbol, trace, and named profiles like heap and goroutine). The implementation uses exact path matching instead of prefix matching to prevent debug data exposure, ensuring that paths with trailing slashes or extra characters (e.g., \/debug/pprof/cmdlineFoo\) are rejected or fall through to the index handler rather than leaking sensitive information.
pprofhandler · high confidence
Add reuseport package with platform-specific TCP listener support
Introduces a new \reuseport\ package providing a \net.Listener\ that enables \SO\_REUSEPORT\ on supported platforms (Linux, macOS, BSD) to allow linear scaling of server performance on multi-CPU systems. The implementation uses \github.com/valyala/fasthttp/tcplisten\ for these platforms, enabling \TCP\_DEFER\_ACCEPT\ and \TCP\_FASTOPEN\ by default. Platform-specific files handle AIX, Solaris, and Windows: AIX and Solaris set both \SO\_REUSEADDR\ and \SO\_REUSEPORT\, while Windows falls back to \SO\_REUSEADDR\ only, noting the lack of same-user isolation. The package includes tests for TCP4 and TCP6 listeners and an example usage with \fasthttp\.
reuseport · high confidence
Add zero-allocation HelloWorld server example
A new example server is available in the examples/helloworldserver directory that demonstrates high-performance request handling with zero allocations per operation in the uncompressed path. The example includes a Makefile for building, a .gitignore to exclude binaries, and a test suite (TestZeroAllocation) that verifies the allocation-free claim. It showcases best practices such as using a sync.Pool for buffer reuse, avoiding fmt in the hot path, setting custom headers and cookies, and optionally enabling transparent response compression via a command-line flag.
examples/helloworldserver · high confidence
Introduce fasthttpadaptor for net/http to fasthttp conversion
This change adds the fasthttpadaptor package, providing NewFastHTTPHandler and ConvertRequest to wrap standard net/http handlers for use with the fasthttp server. The implementation supports buffered responses, streaming via Flush, and connection hijacking, while ensuring duplicate headers are preserved and context is forwarded correctly.
fasthttpadaptor · high confidence
Introduce prefork package for multi-process server performance
Adds a new \prefork\ package that wraps a \fasthttp.Server\ to run across multiple child processes, leveraging file descriptor passing or \SO\_REUSEPORT\ to increase performance by avoiding Go's global memory management overhead across cores. The implementation includes a master process that spawns and supervises children, handles graceful shutdowns with configurable grace periods, and detects master process death in children via a configurable callback. It also provides hooks for custom command production, child spawn/recovery notifications, and enforces a warning against using global state (like in-memory caches) in preforked mode.
prefork · high confidence
Introduce stackless package for reducing goroutine stack usage
The new \stackless\ package provides utilities to reduce stack space consumption for high numbers of concurrently running goroutines. It introduces \NewFunc\, which wraps CPU-bound functions to execute them in a dedicated worker pool, allowing callers to proceed without blocking the calling goroutine's stack; this wrapper returns false if the worker pool is under high load. Additionally, it provides a \Writer\ interface and \NewWriter\ function to wrap standard compression writers (like gzip or flate) in a stackless manner, deferring the actual I/O operations to the worker pool to minimize stack usage during concurrent compression tasks.
stackless · high confidence
Introduce unified Dialer with dual-stack and environment variable support
The fasthttpproxy package has been refactored to use a new Dialer struct that embeds fasthttp.TCPDialer and httpproxy.Config, enabling users to configure HTTP, HTTPS, and NO\_PROXY settings directly or via environment variables. This change adds support for dual-stack (IPv4/IPv6) connections through the DialDualStack field and introduces new convenience functions like FasthttpHTTPDialer, FasthttpSocksDialer, and FasthttpProxyHTTPDialer to simplify proxy configuration for fasthttp clients.
fasthttpproxy · high confidence
Migrate valyala/tcplisten into the repository
The \tcplisten\ package, derived from \valyala/tcplisten\, is now included in the repository. It provides a customizable TCP \net.Listener\ that supports performance options such as \SO\_REUSEPORT\ for multi-CPU scaling, \TCP\_DEFER\_ACCEPT\, and \TCP\_FASTOPEN\ (on Linux). The implementation includes platform-specific socket handling for Linux, macOS, BSDs, and z/OS s390x, along with a dummy implementation for JavaScript/WASM targets.
tcplisten · high confidence
New in-memory listener and pipe connections for fast in-process communication
The fasthttputil package now includes InmemoryListener and PipeConns, enabling fast, in-process client-server communication without network stack overhead. InmemoryListener implements net.Listener for use in tests or internal services, while PipeConns provides a bi-directional in-memory connection pipe with support for read/write deadlines and buffered writes. These utilities are designed for high-performance scenarios where network latency is undesirable.
fasthttputil · high confidence
New multidomain TLS example demonstrating per-host routing
Added a new example in the examples/multidomain directory that demonstrates how to serve multiple domains over TLS using fasthttp. The example configures a single server to route requests to different handlers based on the Host header, using generated test certificates for localhost and 127.0.0.1.
examples/multidomain · high confidence
New static file server example with TLS, compression, and stats
Added a new example file server that serves static files from a specified directory. This server supports transparent response compression, byte range requests, and directory index page generation. It also includes TLS (HTTPS) support using provided sample certificates, virtual hosting capabilities, and exports various performance statistics (such as request counts and response sizes) via the /stats endpoint.
examples/fileserver · high confidence
Security
Sanitize cookie setters to prevent CRLF injection
The library now sanitizes values passed to cookie setters to prevent CRLF injection attacks, addressing security issue \#2185.
(repo-wide) · high confidence
Behavioural changes
1 commit (0 fixes) modifying websocket
A change to existing behaviour in websocket — 1 commit, 17 files: “Add a WebSocket package (\#2493)” (refs \#2493).
websocket · medium confidence · unverified
Dependencies
Update Go version and dependencies
The project now requires Go 1.25.0 and updates several key dependencies: github.com/klauspost/compress to v1.20.0, golang.org/x/crypto to v0.55.0, golang.org/x/net to v0.58.0, golang.org/x/sys to v0.47.0, and golang.org/x/text to v0.41.0. Additionally, the Brotli compression library has been switched from github.com/andybalholm/brotli to github.com/molecule-man/go-brrr v1.0.1.
(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 66 → 69 (+3.5)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.3) — scores are not directly comparable.
Lenses
- Code Health 61 → 72 (+11.0)
- Architecture 84 → 95 (+11.4)
- Maturity 59 → 59 (+0.2)
- Readiness 74 → 77 (+3.6)
- Security 86 → 81 (-4.4)
- Performance 97 → 95 (-2.1)
Resolved (9)
- Duplicated block (10–11 lines × 2) (header.go)
- Duplicated block (15 lines × 2) (http.go)
- Edited copy of a member (23 corresponding lines) (fs.go)
- Hotspot: headerscanner.go (headerscanner.go)
- Leaked secret: private-key (examples/fileserver/ssl-cert-snakeoil.key)
- Off-boarding risk: anonymized user #1
- Projects may be oversized for their cohesion
- Secret: private-key (examples/fileserver/ssl-cert-snakeoil.key)
- fasthttp.decodeCookieArg (cyclomatic 16) (cookie.go)
New (59)
- Conn.Read (cognitive 20) (websocket/read.go)
- Conn.discardMessage (cognitive 20) (websocket/read.go)
- Conn.inflate (cognitive 18) (websocket/compress.go)
- Conn.nextFrame (cognitive 58) (websocket/read.go)
- Conn.nextFrame (cyclomatic 31) (websocket/read.go)
- Duplicated block (10–11 lines × 2) (header.go)
- Duplicated block (14 lines × 2) (websocket/read.go)
- Duplicated block (16 lines × 2) (http.go)
- Duplicated block (18 lines × 2) (header.go)
- Edited copies of one member (4 members, 13+ corresponding lines) (brotli.go)
- Edited copies of one member (4 members, 20+ corresponding lines) (brotli.go)
- Edited copies of one member (4 members, 35+ corresponding lines) (http.go)
- Edited copy of a member (10 corresponding lines) (header.go)
- Edited copy of a member (11 corresponding lines) (compress.go)
- Edited copy of a member (11 corresponding lines) (server.go)
- Edited copy of a member (13 corresponding lines) (header.go)
- Edited copy of a member (13 corresponding lines) (server.go)
- Edited copy of a member (14 corresponding lines) (args.go)
- Edited copy of a member (14 corresponding lines) (compress.go)
- Edited copy of a member (14 corresponding lines) (http.go)
- …and 39 more
Changes since last survey
- 34 commits — 10 feature/other, 24 fixes
By area
- (root) — 31 commits
- fasthttpadaptor/adaptor.go — 1 commit
- pprofhandler/pprof.go — 1 commit
- reuseport/reuseport.go — 1 commit
Notable commits
- fix: fix(client): don't follow redirects to non-HTTP schemes (#2506)
- fix: fix(cookie): accept Expires dates in a time zone other than GMT (#2519)
- fix: fix(cookie): ignore a Domain or Path that can't be used instead of failing to parse (#2524)
- fix: fix(cookie): store Set-Cookie without '=' under the key ParseBytes gives it (#2501)
- fix: fix(cookie): trim tabs around cookie names, values and attributes (#2500)
- fix: fix(fasthttpadaptor): don't take a 1xx as the final status (#2516)
- fix: fix(fs): allow compression when Root is a file (#2505)
- fix: fix(fs): send Content-Range with 416 responses (#2502)
- fix: fix(pprofhandler): serve the index at /debug/pprof/ again (#2530)
- fix: fix(reuseport): return ErrNoReusePort again when SO_REUSEPORT is unsupported (#2527)
- fix: fix: clear KeepBodyBuffer before resetting between keep-alive requests (#2508)
- fix: fix: copy a multipart body that was parsed as it was read in Request.CopyTo (#2521)
- fix: fix: decode percent-encoded userinfo in URI.Parse (#2526)
- fix: fix: don't end a multipart/form-data parameter at a ';' inside quotes (#2517)
- fix: fix: don't lose responses on keep-alive and pipelined connections during Shutdown (#2537)
- fix: fix: don't replace a set Authorization header with the URI userinfo (#2529)
- fix: fix: keep redirect URIs that have a scheme but no authority (#2503)
- fix: fix: map zstd level 0 to the default level instead of panicking (#2510)
- fix: fix: match Content-Encoding case-insensitively when decoding bodies (#2509)
- fix: fix: match form media types and the boundary parameter case-insensitively (#2511)
- …and 14 more
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
valyala/fasthttp 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 13 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 13a66f46b032b2c2148ca5f437a6fc87654d8d1d — the exact code this score is about.
- Scored under rubric-2026.11.3 — 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.61+preprod-f3449e6eb431.