Fix write http status after response sent

This commit is contained in:
世界
2023-04-09 19:31:28 +08:00
parent 50a7295360
commit 0d7aa19cd1
3 changed files with 12 additions and 6 deletions

View File

@@ -92,7 +92,9 @@ func (s *Server) fallbackRequest(ctx context.Context, writer http.ResponseWriter
} else if fErr == os.ErrInvalid {
fErr = nil
}
writer.WriteHeader(statusCode)
if statusCode > 0 {
writer.WriteHeader(statusCode)
}
s.handler.NewError(request.Context(), E.Cause(E.Errors(err, E.Cause(fErr, "fallback connection")), "process connection from ", request.RemoteAddr))
}