Documentation
¶
Overview ¶
Package handler provides the core HTTP file-serving handler and middleware composition for the static web server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildHandler ¶
func BuildHandler(cfg *config.Config, c *cache.Cache, pc ...*security.PathCache) fasthttp.RequestHandler
BuildHandler composes the full middleware chain and returns a ready-to-use fasthttp.RequestHandler. The chain is (outer to inner):
recovery → logging → security → compress → file handler
An optional *security.PathCache may be provided to cache path validation results and skip per-request filesystem syscalls for repeated URL paths.
func BuildHandlerQuiet ¶
func BuildHandlerQuiet(cfg *config.Config, c *cache.Cache, pc ...*security.PathCache) fasthttp.RequestHandler
BuildHandlerQuiet is like BuildHandler but suppresses per-request access logging. Use this when the --quiet flag is set.
Types ¶
type FileHandler ¶
type FileHandler struct {
// contains filtered or unexported fields
}
FileHandler serves static files from disk with caching and compression support.
func NewFileHandler ¶
NewFileHandler creates a new FileHandler. absRoot is resolved via filepath.Abs so per-request path arithmetic is free of OS syscalls. An optional *PathCache allows cache-hit requests to resolve the safe filesystem path without a context allocation (PERF-001).
func (*FileHandler) HandleRequest ¶ added in v1.3.0
func (h *FileHandler) HandleRequest(ctx *fasthttp.RequestCtx)
HandleRequest handles a fasthttp request by resolving and serving the requested file.