mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-10 05:48:19 +01:00
s3: drain request body before error response (#11334)
* s3: drain request body before error response * s3: keep oversized request bodies drainable
This commit is contained in:
1 parent
166af06a2b
commit
93d4a6aefd
8 files changed
+157
-13
No files matched your search
@@ -709,10 +709,8 @@ func (s3a *S3ApiServer) UnifiedPostHandler(w http.ResponseWriter, r *http.Reques
|
||||
// Save the body first so we can restore it for STS handler signature verification
|
||||
var bodyBytes []byte
|
||||
if r.Body != nil {
|
||||
// Limit body size to prevent DoS attacks
|
||||
r.Body = http.MaxBytesReader(w, r.Body, iamRequestBodyLimit)
|
||||
var err error
|
||||
bodyBytes, err = io.ReadAll(r.Body)
|
||||
bodyBytes, err = readRequestBody(r, iamRequestBodyLimit)
|
||||
if err != nil {
|
||||
glog.Errorf("failed to read request body: %v", err)
|
||||
s3err.WriteErrorResponse(w, r, s3err.ErrInvalidRequest)
|
||||
|
||||
Reference in new issue
Block a user