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

Method HTTPHandler

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

Source from the content-addressed store, hash-verified

114}
115
116func (hp *HTTPProxy) HTTPHandler(rw http.ResponseWriter, req *http.Request) {
117 removeProxyHeaders(req)
118
119 resp, err := http.DefaultTransport.RoundTrip(req)
120 if err != nil {
121 http.Error(rw, err.Error(), http.StatusInternalServerError)
122 return
123 }
124 defer resp.Body.Close()
125
126 copyHeaders(rw.Header(), resp.Header)
127 rw.WriteHeader(resp.StatusCode)
128
129 _, err = io.Copy(rw, resp.Body)
130 if err != nil && err != io.EOF {
131 return
132 }
133}
134
135// deprecated
136// Hijack needs to SetReadDeadline on the Conn of the request, but if we use stream compression here,

Callers 1

ServeHTTPMethod · 0.95

Calls 4

removeProxyHeadersFunction · 0.85
copyHeadersFunction · 0.85
ErrorMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected