From a9207857cf53d379a1b73a8dfd60ac8e16faecab Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sun, 6 Nov 2022 07:33:56 +0100 Subject: [PATCH] webdav: add a test case for PROPFIND with infinity Depth Signed-off-by: Nicola Murino --- internal/webdavd/webdavd_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/webdavd/webdavd_test.go b/internal/webdavd/webdavd_test.go index bd3d1c08..278a6ef8 100644 --- a/internal/webdavd/webdavd_test.go +++ b/internal/webdavd/webdavd_test.go @@ -2223,6 +2223,17 @@ func TestGETAsPROPFIND(t *testing.T) { files, err = client.ReadDir(subDir1) assert.NoError(t, err) assert.Len(t, files, 1) + // PROPFIND with infinity depth is forbidden + req, err = http.NewRequest(http.MethodGet, rootPath, nil) + if assert.NoError(t, err) { + req.SetBasicAuth(u.Username, u.Password) + req.Header.Set("Depth", "infinity") + resp, err := httpClient.Do(req) + if assert.NoError(t, err) { + assert.Equal(t, http.StatusForbidden, resp.StatusCode) + resp.Body.Close() + } + } _, err = httpdtest.RemoveUser(user, http.StatusOK) assert.NoError(t, err)