MCPcopy
hub / github.com/caddyserver/caddy / WriteHeader

Method WriteHeader

modules/caddyhttp/push/handler.go:212–224  ·  view source on GitHub ↗
(statusCode int)

Source from the content-addressed store, hash-verified

210}
211
212func (lp linkPusher) WriteHeader(statusCode int) {
213 if links, ok := lp.ResponseWriter.Header()["Link"]; ok {
214 // only initiate these pushes if it hasn't been done yet
215 if val := caddyhttp.GetVar(lp.request.Context(), pushedLink); val == nil {
216 if c := lp.handler.logger.Check(zapcore.DebugLevel, "pushing Link resources"); c != nil {
217 c.Write(zap.Strings("linked", links))
218 }
219 caddyhttp.SetVar(lp.request.Context(), pushedLink, true)
220 lp.handler.servePreloadLinks(lp.pusher, lp.header, links)
221 }
222 }
223 lp.ResponseWriter.WriteHeader(statusCode)
224}
225
226// isRemoteResource returns true if resource starts with
227// a scheme or is a protocol-relative URI.

Calls 6

GetVarFunction · 0.92
SetVarFunction · 0.92
servePreloadLinksMethod · 0.80
HeaderMethod · 0.45
CheckMethod · 0.45
WriteMethod · 0.45