Closed cs-charles closed 3 years ago
https://github.com/Allenxuxu/gev/blob/631f7252a9ca88315d327ed4a26d0f97947abdad/plugins/websocket/ws/ws.go#L305 由于在遍历请求头时,触发对请求头Connection校验的错误,之后触发onHost或者onHeader方法,但是由于onHost或者onHeader方法返回nil,导致原本err=ErrHandshakeBadConnection被nil覆盖。建议用临时变量接收onHost和onHeader返回的错误,只有错误不为空才赋值给err变量。 if onHost := u.OnHost; onHost != nil { if e := onHost(c, v);e != nil; { err = e } }
if onHeader := u.OnHeader; onHeader != nil { if e := onHeader(c, k, v);e != nil { err = e } }
https://github.com/Allenxuxu/gev/pull/88
https://github.com/Allenxuxu/gev/blob/631f7252a9ca88315d327ed4a26d0f97947abdad/plugins/websocket/ws/ws.go#L305 由于在遍历请求头时,触发对请求头Connection校验的错误,之后触发onHost或者onHeader方法,但是由于onHost或者onHeader方法返回nil,导致原本err=ErrHandshakeBadConnection被nil覆盖。建议用临时变量接收onHost和onHeader返回的错误,只有错误不为空才赋值给err变量。 if onHost := u.OnHost; onHost != nil { if e := onHost(c, v);e != nil; { err = e } }
if onHeader := u.OnHeader; onHeader != nil { if e := onHeader(c, k, v);e != nil { err = e } }