mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-18 09:46:24 +01:00
s3: answer ClientDisconnected for a GET the client aborted before the first byte (#12707)
* s3: answer ClientDisconnected for a GET the client aborted before the first byte Fixes #12706 * s3: tell a gone client on TLS and HTTP/2 too, and not on a connection the server closed
This commit is contained in:
1 parent
c91da3d1f8
commit
91eaabf371
4 files changed
+117
-9
No files matched your search
@@ -293,7 +293,8 @@ func isCanceledStreamingError(err error) bool {
|
||||
// wrote a response. A canceled error is answered too: the idle timeout and a
|
||||
// shared lookup canceled by another request both cancel it while the client is
|
||||
// still connected, and returning silently would send that client an empty 200.
|
||||
// A client that has gone away never sees the write.
|
||||
// A client that has gone away never sees the write; it is answered
|
||||
// ClientDisconnected so that an aborted download does not count as a 5xx.
|
||||
func writeStreamErrorResponse(w http.ResponseWriter, r *http.Request, err error) {
|
||||
var streamErr *StreamError
|
||||
if errors.As(err, &streamErr) && streamErr.ResponseWritten {
|
||||
@@ -303,6 +304,10 @@ func writeStreamErrorResponse(w http.ResponseWriter, r *http.Request, err error)
|
||||
s3err.WriteErrorResponse(w, r, s3err.ErrRequestBytesExceed)
|
||||
return
|
||||
}
|
||||
if isCanceledStreamingError(err) && util.ClientGone(r.Context()) {
|
||||
s3err.WriteErrorResponse(w, r, s3err.ErrClientDisconnected)
|
||||
return
|
||||
}
|
||||
s3err.WriteErrorResponse(w, r, s3err.ErrInternalError)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user