[ARVADOS] created: 1.3.0-3053-gbc11ee32e
Git user
git at public.arvados.org
Tue Sep 1 14:22:40 UTC 2020
at bc11ee32eeb31c63a3fb99819087d2def0988789 (commit)
commit bc11ee32eeb31c63a3fb99819087d2def0988789
Author: Tom Clegg <tom at tomclegg.ca>
Date: Tue Sep 1 10:16:47 2020 -0400
16790: Avoid returning empty NextMarker tag in list responses.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at tomclegg.ca>
diff --git a/services/keep-web/s3.go b/services/keep-web/s3.go
index 4e8028ae6..52cfede46 100644
--- a/services/keep-web/s3.go
+++ b/services/keep-web/s3.go
@@ -358,6 +358,11 @@ func (h *handler) s3list(w http.ResponseWriter, r *http.Request, fs arvados.Cust
// CommonPrefixes is nil, which confuses some clients.
// Fix by using this nested struct instead.
CommonPrefixes []commonPrefix
+ // Similarly, we need omitempty here, because an empty
+ // tag confuses some clients (e.g.,
+ // github.com/aws/aws-sdk-net never terminates its
+ // paging loop).
+ NextMarker string `xml:"NextMarker,omitempty"`
}
resp := listResp{
ListResp: s3.ListResp{
diff --git a/services/keep-web/s3_test.go b/services/keep-web/s3_test.go
index c6d53238e..1ff19a98b 100644
--- a/services/keep-web/s3_test.go
+++ b/services/keep-web/s3_test.go
@@ -411,6 +411,26 @@ func (s *IntegrationSuite) TestS3ListNoCommonPrefixes(c *check.C) {
c.Check(string(buf), check.Not(check.Matches), `(?ms).*CommonPrefixes.*`)
}
+// If there is no delimiter in the request, or the results are not
+// truncated, the NextMarker XML tag should not appear in the response
+// body.
+func (s *IntegrationSuite) TestS3ListNoNextMarker(c *check.C) {
+ stage := s.s3setup(c)
+ defer stage.teardown(c)
+
+ for _, query := range []string{"prefix=e&delimiter=/", ""} {
+ req, err := http.NewRequest("GET", stage.collbucket.URL("/"), nil)
+ c.Assert(err, check.IsNil)
+ req.Header.Set("Authorization", "AWS "+arvadostest.ActiveTokenV2+":none")
+ req.URL.RawQuery = query
+ resp, err := http.DefaultClient.Do(req)
+ c.Assert(err, check.IsNil)
+ buf, err := ioutil.ReadAll(resp.Body)
+ c.Assert(err, check.IsNil)
+ c.Check(string(buf), check.Not(check.Matches), `(?ms).*NextMarker.*`)
+ }
+}
+
func (s *IntegrationSuite) TestS3CollectionList(c *check.C) {
stage := s.s3setup(c)
defer stage.teardown(c)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list