MCPcopy Index your code
hub / github.com/SenseUnit/dumbproxy / hijack

Function hijack

handler/proxy.go:39–55  ·  view source on GitHub ↗
(hijackable any)

Source from the content-addressed store, hash-verified

37}
38
39func hijack(hijackable any) (net.Conn, *bufio.ReadWriter, error) {
40 hj, ok := hijackable.(http.Hijacker)
41 if !ok {
42 return nil, nil, errors.New("Connection doesn't support hijacking")
43 }
44 conn, rw, err := hj.Hijack()
45 if err != nil {
46 return nil, nil, err
47 }
48 var emptytime time.Time
49 err = conn.SetDeadline(emptytime)
50 if err != nil {
51 conn.Close()
52 return nil, nil, err
53 }
54 return conn, rw, nil
55}
56
57func flush(flusher any) bool {
58 f, ok := flusher.(http.Flusher)

Callers 1

HandleTunnelMethod · 0.85

Calls 2

CloseMethod · 0.65
SetDeadlineMethod · 0.45

Tested by

no test coverage detected