MCPcopy
hub / github.com/coder/websocket / hijacker

Function hijacker

hijack.go:22–33  ·  view source on GitHub ↗

hijacker returns the Hijacker interface of the http.ResponseWriter. It follows the Unwrap method of the http.ResponseWriter if available, matching the behavior of http.ResponseController. If the Hijacker interface is not found, it returns false. Since the http.ResponseController is not available in

(rw http.ResponseWriter)

Source from the content-addressed store, hash-verified

20// this function is used to provide a consistent way to check for the
21// Hijacker interface across Go versions.
22func hijacker(rw http.ResponseWriter) (http.Hijacker, bool) {
23 for {
24 switch t := rw.(type) {
25 case http.Hijacker:
26 return t, true
27 case rwUnwrapper:
28 rw = t.Unwrap()
29 default:
30 return nil, false
31 }
32 }
33}

Callers 2

acceptFunction · 0.85

Calls 1

UnwrapMethod · 0.65

Used in the wild real call sites across dependent graphs

searching dependent graphs…