From 2f891cb46465e0f9109cbaf74d5fa3f295d21c1c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zo=C3=AB=20Ma?= Date: Mon, 8 Jul 2024 15:15:26 +0800 Subject: [PATCH] 21989: Keepstore: Use comma separator for X-Keep-Storage-Classes-Confirmed header MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When generating the X-Keep-Storage-Classes-Confirmed header, use comma (",") instead of semicolon (";") as the separator for multi-entry value. This is to be consistent with keep-proxy's behavior and the arv-put client's expectation. Plus, it follows RFC 9110 (see sec. 5.2). Without the fix, arv-put wrongly believes that storage classes are not supported on the cluster it is putting to. The spurious warning "X-Keep-Storage-Classes header not supported by the cluster" can be seen in arv-put messages and in Workbench2. Arvados-DCO-1.1-Signed-off-by: Zoë Ma --- services/keepstore/router.go | 2 +- services/keepstore/router_test.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/services/keepstore/router.go b/services/keepstore/router.go index dfb2ace3a7..d3bbc249f9 100644 --- a/services/keepstore/router.go +++ b/services/keepstore/router.go @@ -128,7 +128,7 @@ func (rtr *router) handleBlockWrite(w http.ResponseWriter, req *http.Request) { for k, n := range resp.StorageClasses { if n > 0 { if scc != "" { - scc += "; " + scc += ", " } scc += fmt.Sprintf("%s=%d", k, n) } diff --git a/services/keepstore/router_test.go b/services/keepstore/router_test.go index 215033b48e..29ffa4612d 100644 --- a/services/keepstore/router_test.go +++ b/services/keepstore/router_test.go @@ -214,6 +214,11 @@ func (s *routerSuite) TestBlockWrite_Headers(c *C) { c.Check(resp.Code, Equals, http.StatusOK) c.Check(resp.Header().Get("X-Keep-Replicas-Stored"), Equals, "1") c.Check(resp.Header().Get("X-Keep-Storage-Classes-Confirmed"), Equals, "testclass2=1") + + resp = call(router, "PUT", "http://example/"+fooHash, arvadostest.ActiveTokenV2, []byte("foo"), http.Header{"X-Keep-Storage-Classes": []string{"testclass1, testclass2"}}) + c.Check(resp.Code, Equals, http.StatusOK) + c.Check(resp.Header().Get("X-Keep-Replicas-Stored"), Equals, "2") + c.Check(resp.Header().Get("X-Keep-Storage-Classes-Confirmed"), Equals, "testclass1=1, testclass2=1") } func sortCommaSeparated(s string) string { -- 2.30.2