MCPcopy Create free account
hub / github.com/M1r0ku/frp-Modify / ServeHTTP

Method ServeHTTP

frp-dev/pkg/plugin/client/http_proxy.go:100–114  ·  view source on GitHub ↗
(rw http.ResponseWriter, req *http.Request)

Source from the content-addressed store, hash-verified

98}
99
100func (hp *HTTPProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
101 if ok := hp.Auth(req); !ok {
102 rw.Header().Set("Proxy-Authenticate", "Basic")
103 rw.WriteHeader(http.StatusProxyAuthRequired)
104 return
105 }
106
107 if req.Method == http.MethodConnect {
108 // deprecated
109 // Connect request is handled in Handle function.
110 hp.ConnectHandler(rw, req)
111 } else {
112 hp.HTTPHandler(rw, req)
113 }
114}
115
116func (hp *HTTPProxy) HTTPHandler(rw http.ResponseWriter, req *http.Request) {
117 removeProxyHeaders(req)

Callers

nothing calls this directly

Calls 4

AuthMethod · 0.95
ConnectHandlerMethod · 0.95
HTTPHandlerMethod · 0.95
SetMethod · 0.80

Tested by

no test coverage detected