Add missing callback on close of hijacked connections

This commit is contained in:
ravilr 2019-05-23 00:40:04 -07:00 committed by Traefiker Bot
parent 8a5db8a3ee
commit 63c3ed3931
2 changed files with 8 additions and 3 deletions

4
Gopkg.lock generated
View file

@ -1582,7 +1582,7 @@
[[projects]]
branch = "master"
digest = "1:c878a802780168c80738d74607d14e7cb8765706990ae1260a3fd271c2c3b133"
digest = "1:86f14aadf288fe3ad8ac060bcb2b5083cec3829dd883803486ec834d031060c9"
name = "github.com/vulcand/oxy"
packages = [
"buffer",
@ -1595,7 +1595,7 @@
"utils",
]
pruneopts = "NUT"
revision = "c34b0c501e43223bc816ac9b40b0ac29c44c8952"
revision = "0d102f45103cf49a95b5c6e810e092973cbcb68c"
[[projects]]
digest = "1:ca6bac407fedc14fbeeba861dd33a821ba3a1624c10126ec6003b0a28d4139c5"

View file

@ -363,7 +363,12 @@ func (f *httpForwarder) serveWebSocket(w http.ResponseWriter, req *http.Request,
ctx.errHandler.ServeHTTP(w, req, errHijack)
return
}
defer conn.Close()
defer func() {
conn.Close()
if f.websocketConnectionClosedHook != nil {
f.websocketConnectionClosedHook(req, conn)
}
}()
errWrite := resp.Write(conn)
if errWrite != nil {