Internal

internal/personalheader

import "github.com/gofiber/fiber/v3/internal/personalheader"

Package personalheader names the response headers that belong to the one client a response is for. A middleware that writes such a header, as the session middleware writes the session ID into one, marks it on the request; a middleware that keeps responses to give them to other clients, as the cache does, leaves it out. A stored copy that kept it would hand the session of the client that caused the miss to every client that hits the entry, which is why Set-Cookie is never stored either.

Functions

func Mark(rctx *fasthttp.RequestCtx, names *Names)

Source: internal/personalheader/personalheader.go:70

Mark records that the response to the request of rctx may carry the headers of names for the client that sent it. Marking twice, or several sets, adds up. The first set is stored as it is, so the common case takes no allocation.

func MarkResponse(rctx *fasthttp.RequestCtx)

Source: internal/personalheader/personalheader.go:89

MarkResponse records that the response to the request of rctx is for the client that sent it as a whole, as one that sets a cookie is, although it may set none.

func Marked(rctx *fasthttp.RequestCtx) *Names

Source: internal/personalheader/personalheader.go:105

Marked returns the names that were marked for the request of rctx, or nil.

func New(names ...string) *Names

Source: internal/personalheader/personalheader.go:22

New returns the set of names, or nil when none is left once duplicates are dropped (header names are equal regardless of case) and the empty name is left out.

func ResponseMarked(rctx *fasthttp.RequestCtx) bool

Source: internal/personalheader/personalheader.go:96

ResponseMarked reports whether MarkResponse was called for the request of rctx.

Types

type Names

Source: internal/personalheader/personalheader.go:16

Names is a set of header names. It is built once, shared and never changed, so a request marks it without allocating. The nil set is empty.

type Names struct {
	// contains filtered or unexported fields
}

func (n *Names) Has(name []byte) bool

Source: internal/personalheader/personalheader.go:36

Has reports whether name, in any case, is in the set.