webdav: add a test case for PROPFIND with infinity Depth

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2022-11-06 07:33:56 +01:00
parent 37ffa3b55a
commit a9207857cf
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF

View file

@ -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)