From 496c5e6d1fccb07601190cd12c9b403655a2cd09 Mon Sep 17 00:00:00 2001 From: Marius Kleidl Date: Sat, 2 Nov 2024 12:23:04 +0000 Subject: [PATCH] `Upload-Draft-Interop-Version: 6` --- pkg/handler/head_test.go | 2 +- pkg/handler/patch_test.go | 2 +- pkg/handler/post_test.go | 2 +- pkg/handler/unrouted_handler.go | 7 ++++--- pkg/handler/utils_test.go | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/handler/head_test.go b/pkg/handler/head_test.go index 7b645e16d..f8e12b2d5 100644 --- a/pkg/handler/head_test.go +++ b/pkg/handler/head_test.go @@ -145,7 +145,7 @@ func TestHead(t *testing.T) { }) SubTest(t, "ExperimentalProtocol", func(t *testing.T, _ *MockFullDataStore, _ *StoreComposer) { - for _, interopVersion := range []string{"3", "4", "5"} { + for _, interopVersion := range []string{"3", "4", "5", "6"} { SubTest(t, "InteropVersion"+interopVersion, func(t *testing.T, _ *MockFullDataStore, _ *StoreComposer) { SubTest(t, "IncompleteUpload", func(t *testing.T, store *MockFullDataStore, composer *StoreComposer) { ctrl := gomock.NewController(t) diff --git a/pkg/handler/patch_test.go b/pkg/handler/patch_test.go index a78c5e429..509dc98f9 100644 --- a/pkg/handler/patch_test.go +++ b/pkg/handler/patch_test.go @@ -816,7 +816,7 @@ func TestPatch(t *testing.T) { }) SubTest(t, "ExperimentalProtocol", func(t *testing.T, _ *MockFullDataStore, _ *StoreComposer) { - for _, interopVersion := range []string{"3", "4", "5"} { + for _, interopVersion := range []string{"3", "4", "5", "6"} { SubTest(t, "InteropVersion"+interopVersion, func(t *testing.T, _ *MockFullDataStore, _ *StoreComposer) { SubTest(t, "CompleteUploadWithKnownSize", func(t *testing.T, store *MockFullDataStore, composer *StoreComposer) { ctrl := gomock.NewController(t) diff --git a/pkg/handler/post_test.go b/pkg/handler/post_test.go index c08b10276..8ac9567c4 100644 --- a/pkg/handler/post_test.go +++ b/pkg/handler/post_test.go @@ -546,7 +546,7 @@ func TestPost(t *testing.T) { }) SubTest(t, "ExperimentalProtocol", func(t *testing.T, _ *MockFullDataStore, _ *StoreComposer) { - for _, interopVersion := range []string{"3", "4", "5"} { + for _, interopVersion := range []string{"3", "4", "5", "6"} { SubTest(t, "InteropVersion"+interopVersion, func(t *testing.T, _ *MockFullDataStore, _ *StoreComposer) { SubTest(t, "CompleteUpload", func(t *testing.T, store *MockFullDataStore, _ *StoreComposer) { ctrl := gomock.NewController(t) diff --git a/pkg/handler/unrouted_handler.go b/pkg/handler/unrouted_handler.go index 02f59c8d5..7fefd68e1 100644 --- a/pkg/handler/unrouted_handler.go +++ b/pkg/handler/unrouted_handler.go @@ -28,6 +28,7 @@ const ( interopVersion3 draftVersion = "3" // From draft version -01 interopVersion4 draftVersion = "4" // From draft version -02 interopVersion5 draftVersion = "5" // From draft version -03 + interopVersion6 draftVersion = "6" // From draft version -04 and -05 ) var ( @@ -1381,7 +1382,7 @@ func (handler UnroutedHandler) usesIETFDraft(r *http.Request) bool { func getIETFDraftInteropVersion(r *http.Request) draftVersion { version := draftVersion(r.Header.Get("Upload-Draft-Interop-Version")) switch version { - case interopVersion3, interopVersion4, interopVersion5: + case interopVersion3, interopVersion4, interopVersion5, interopVersion6: return version default: return "" @@ -1393,7 +1394,7 @@ func getIETFDraftInteropVersion(r *http.Request) draftVersion { func isIETFDraftUploadComplete(r *http.Request) bool { currentUploadDraftInteropVersion := getIETFDraftInteropVersion(r) switch currentUploadDraftInteropVersion { - case interopVersion4, interopVersion5: + case interopVersion4, interopVersion5, interopVersion6: return r.Header.Get("Upload-Complete") == "?1" case interopVersion3: return r.Header.Get("Upload-Incomplete") == "?0" @@ -1414,7 +1415,7 @@ func setIETFDraftUploadComplete(r *http.Request, resp HTTPResponse, isComplete b } else { resp.Header["Upload-Incomplete"] = "?1" } - case interopVersion4, interopVersion5: + case interopVersion4, interopVersion5, interopVersion6: if isComplete { resp.Header["Upload-Complete"] = "?1" } else { diff --git a/pkg/handler/utils_test.go b/pkg/handler/utils_test.go index a29d47732..0624f7551 100644 --- a/pkg/handler/utils_test.go +++ b/pkg/handler/utils_test.go @@ -142,7 +142,7 @@ func addIETFUploadCompleteHeader(header map[string]string, isComplete bool, inte } else { header["Upload-Incomplete"] = "?1" } - case "4", "5": + case "4", "5", "6": if isComplete { header["Upload-Complete"] = "?1" } else {