Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/mtc/mirror/internal/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func addEntries(m *MirrorMux) http.HandlerFunc {
http.Error(w, "Failed to add entries", http.StatusInternalServerError)
return

case nextEntry == pendingSize:
case nextEntry >= req.uploadEnd:
// SPEC: If next_entry == upload_end, and no cosignatures are provided by the mirror,
// the mirror MUST respond with a "200 OK" status code and an empty response body.
// If next_entry == upload_end, and cosignatures are provided by the mirror,
Expand Down
10 changes: 10 additions & 0 deletions cmd/mtc/mirror/internal/handler/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ func TestAddEntries_StatusCodes(t *testing.T) {
},
wantStatus: http.StatusOK,
wantBody: testCosig,
}, {
name: "200 ok (uploadEnd reached before pendingSize)",
origin: testOrigin,
mockTarget: &mockTarget{
addEntriesFunc: func(ctx context.Context, uploadStart, uploadEnd uint64, ticket []byte, next func() (*tessera.MirrorPackage, error)) (uint64, uint64, []byte, []byte, error) {
return testUploadEnd, testPendingSize, []byte(testNewTicket), nil, nil
},
},
wantStatus: http.StatusOK,
wantBody: "",
}, {
name: "202 partial upload",
origin: testOrigin,
Expand Down
Loading