reverseproxy: Wait for both ends of websocket to close (#6175)

This commit is contained in:
WeidiDeng
2024-04-16 01:37:37 +08:00
committed by GitHub
parent 81413caea2
commit b40cacf5ce
2 changed files with 9 additions and 3 deletions

View File

@ -922,7 +922,9 @@ func (h *Handler) finalizeResponse(
) error {
// deal with 101 Switching Protocols responses: (WebSocket, h2c, etc)
if res.StatusCode == http.StatusSwitchingProtocols {
h.handleUpgradeResponse(logger, rw, req, res)
var wg sync.WaitGroup
h.handleUpgradeResponse(logger, &wg, rw, req, res)
wg.Wait()
return nil
}