From 6b58cd0870f9853fe0738983c4bde6b96a053660 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 31 Aug 2024 08:32:55 +0100 Subject: [PATCH] s3: fix accounting for mulpart transfers after migration to SDKv2 #4989 --- backend/s3/s3.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 2ca9b4fb3..e45a7b299 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -5988,7 +5988,13 @@ func (w *s3ChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, reader if do, ok := reader.(pool.DelayAccountinger); ok { // To figure out this number, do a transfer and if the accounted size is 0 or a // multiple of what it should be, increase or decrease this number. - do.DelayAccounting(3) + // + // For transfers over https the SDK does not sign the body whereas over http it does + if len(w.f.opt.Endpoint) >= 5 && strings.EqualFold(w.f.opt.Endpoint[:5], "http:") { + do.DelayAccounting(3) + } else { + do.DelayAccounting(2) + } } // create checksum of buffer for integrity checking