if not hijacker then also treat as no dig

master
Bel LaPointe 2022-12-26 14:03:16 -05:00
parent e5ba5c9777
commit 3717956a01
1 changed files with 2 additions and 7 deletions

View File

@ -79,7 +79,8 @@ func (s *Server) Connect(w http.ResponseWriter, r *http.Request) {
return return
} }
if host == r.Host { hijacker, ok := w.(http.Hijacker)
if host == r.Host || !ok {
s.connectHTTPReverseProxy(w, r) s.connectHTTPReverseProxy(w, r)
return return
} }
@ -92,12 +93,6 @@ func (s *Server) Connect(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
hijacker, ok := w.(http.Hijacker)
if !ok {
s.Error(r, w, errors.New("hijack not available"))
return
}
client, _, err := hijacker.Hijack() client, _, err := hijacker.Hijack()
if err != nil { if err != nil {
s.Error(r, w, err) s.Error(r, w, err)