Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop

This commit is contained in:
laodaming 2023-09-22 12:05:17 +08:00
commit c9af4fb420

View File

@ -209,22 +209,22 @@ func NewBackend(mux *http.ServeMux, httpAddress string, muxPaths ...string) *Bac
target := url.URL{Scheme: "ws", Host: strings.Split(backend.HttpAddress, "//")[1], Path: r.URL.Path}
var transfer = func(src, dest *websocket.Conn) {
defer src.Close()
defer dest.Close()
// TODO: 可以做错误处理
for {
mType, msg, err := src.ReadMessage()
if err != nil {
log.Println(err)
break
return
}
err = dest.WriteMessage(mType, msg)
if err != nil {
log.Println(err)
break
return
}
}
src.Close()
dest.Close()
}
header := r.Header.Clone()