Skip to content
This repository was archived by the owner on Feb 27, 2020. It is now read-only.

Commit 4e9b126

Browse files
committed
Ensure we always send Content-Length to S3
1 parent 9e26102 commit 4e9b126

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

worker/workertest/fakequeue/fakequeue.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,16 @@ func (q *FakeQueue) internalPutArtifact(taskID string, runID int, name string, p
529529
// Real S3/azure is slow, let's add a bit of jitter to get some intermittent bugs
530530
time.Sleep(time.Duration(rand.Intn(15)) * time.Millisecond) // sleep 0 - 15ms
531531

532+
// S3 always requires a content-length, if it's not present we have bug
533+
if r.Header.Get("Content-Length") == "" {
534+
debug(" s3/azure expects Content-Length")
535+
return restError{
536+
StatusCode: http.StatusBadRequest,
537+
Code: "ContentLengthMissing",
538+
Message: "S3/azure always expects a content-length even if it's zero",
539+
}
540+
}
541+
532542
// Find task
533543
t, ok := q.tasks[taskID]
534544
if !ok || len(t.status.Runs) <= runID {

0 commit comments

Comments
 (0)