mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-14 12:29:36 +03:00
SplitHTTP: Fix connection leaks and crashes (#3710)
This commit is contained in:
@ -222,8 +222,12 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req
|
||||
h.ln.addConn(stat.Connection(&conn))
|
||||
|
||||
// "A ResponseWriter may not be used after [Handler.ServeHTTP] has returned."
|
||||
<-downloadDone.Wait()
|
||||
select {
|
||||
case <-request.Context().Done():
|
||||
case <-downloadDone.Wait():
|
||||
}
|
||||
|
||||
conn.Close()
|
||||
} else {
|
||||
writer.WriteHeader(http.StatusMethodNotAllowed)
|
||||
}
|
||||
|
Reference in New Issue
Block a user