|
|
@ -25,6 +25,7 @@ import ( |
|
|
|
"net/textproto" |
|
|
|
"regexp" |
|
|
|
"strings" |
|
|
|
"sync/atomic" |
|
|
|
|
|
|
|
"github.com/minio/madmin-go/v3" |
|
|
|
"github.com/minio/minio/internal/auth" |
|
|
@ -427,9 +428,31 @@ func errorResponseHandler(w http.ResponseWriter, r *http.Request) { |
|
|
|
HTTPStatusCode: http.StatusUpgradeRequired, |
|
|
|
}, r.URL) |
|
|
|
default: |
|
|
|
defer logger.AuditLog(r.Context(), w, r, mustGetClaimsFromToken(r)) |
|
|
|
defer atomic.AddUint64(&globalHTTPStats.rejectedRequestsInvalid, 1) |
|
|
|
|
|
|
|
// When we are not running in S3 Express mode, generate appropriate error
|
|
|
|
// for x-amz-write-offset HEADER specified.
|
|
|
|
if _, ok := r.Header[xhttp.AmzWriteOffsetBytes]; ok { |
|
|
|
tc, ok := r.Context().Value(mcontext.ContextTraceKey).(*mcontext.TraceCtxt) |
|
|
|
if ok { |
|
|
|
tc.FuncName = "s3.AppendObject" |
|
|
|
tc.ResponseRecorder.LogErrBody = true |
|
|
|
} |
|
|
|
|
|
|
|
writeErrorResponse(r.Context(), w, getAPIError(ErrNotImplemented), r.URL) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
tc, ok := r.Context().Value(mcontext.ContextTraceKey).(*mcontext.TraceCtxt) |
|
|
|
if ok { |
|
|
|
tc.FuncName = "s3.ValidRequest" |
|
|
|
tc.ResponseRecorder.LogErrBody = true |
|
|
|
} |
|
|
|
|
|
|
|
writeErrorResponse(r.Context(), w, APIError{ |
|
|
|
Code: "BadRequest", |
|
|
|
Description: fmt.Sprintf("An error occurred when parsing the HTTP request %s at '%s'", |
|
|
|
Description: fmt.Sprintf("An unsupported API call for method: %s at '%s'", |
|
|
|
r.Method, r.URL.Path), |
|
|
|
HTTPStatusCode: http.StatusBadRequest, |
|
|
|
}, r.URL) |
|
|
|