Skip to content

Commit

Permalink
Upload-Draft-Interop-Version: 6
Browse files Browse the repository at this point in the history
  • Loading branch information
Acconut committed Nov 2, 2024
1 parent b6cc786 commit 496c5e6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/handler/head_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/handler/patch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/handler/post_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions pkg/handler/unrouted_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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 ""
Expand All @@ -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"
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/handler/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 496c5e6

Please sign in to comment.