redirect.go — fiber Source File
Architecture documentation for redirect.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR c50a8caf_2773_241c_9f34_49133f549127["redirect.go"] c0b86961_3ef1_0168_52fc_98627566ed27["bytes"] c50a8caf_2773_241c_9f34_49133f549127 --> c0b86961_3ef1_0168_52fc_98627566ed27 style c50a8caf_2773_241c_9f34_49133f549127 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
// 📝 GitHub Repository: https://github.com/gofiber/fiber
// 📌 API Documentation: https://docs.gofiber.io
package fiber
import (
"bytes"
"encoding/hex"
"sync"
"github.com/gofiber/utils/v2"
"github.com/valyala/bytebufferpool"
"github.com/valyala/fasthttp"
"github.com/gofiber/fiber/v3/binder"
)
// Pool for redirection
var (
redirectPool = sync.Pool{
New: func() any {
return &Redirect{
status: StatusSeeOther,
messages: make(redirectionMsgs, 0),
}
},
}
oldInputPool = sync.Pool{
New: func() any {
return make(map[string]string)
},
}
)
const maxPoolableMapSize = 64
// FlashCookieName Cookie name to send flash messages when to use redirection.
const (
FlashCookieName = "fiber_flash"
)
var flashCookieNeedle = []byte(FlashCookieName + "=")
// hasFlashCookie is on the request hot path and runs on every request/response cycle.
// Keep this cheap for users who don't use flash messages:
// 1) a fast raw-header prefilter to avoid unnecessary cookie parsing,
// 2) an exact cookie lookup to avoid prefix false positives (e.g. fiber_flashX).
func hasFlashCookie(header *fasthttp.RequestHeader) bool {
rawHeaders := header.RawHeaders()
if len(rawHeaders) == 0 {
return false
}
if !bytes.Contains(rawHeaders, flashCookieNeedle) {
return false
}
return header.Cookie(FlashCookieName) != nil
}
// ... (373 more lines)
Domain
Subdomains
Types
Dependencies
- bytes
Source
Frequently Asked Questions
What does redirect.go do?
redirect.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Context subdomain.
What functions are defined in redirect.go?
redirect.go defines 5 function(s): AcquireRedirect, ReleaseRedirect, acquireOldInput, hasFlashCookie, releaseOldInput.
What does redirect.go depend on?
redirect.go imports 1 module(s): bytes.
Where is redirect.go in the architecture?
redirect.go is located at redirect.go (domain: FiberCore, subdomain: Context).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free