(rw http.ResponseWriter, req *http.Request)
| 98 | } |
| 99 | |
| 100 | func (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 | |
| 116 | func (hp *HTTPProxy) HTTPHandler(rw http.ResponseWriter, req *http.Request) { |
| 117 | removeProxyHeaders(req) |
nothing calls this directly
no test coverage detected