FileSystem: &webdavFS{
collfs: fs,
writing: writeMethod[r.Method],
+ reading: r.Method != "PROPFIND",
},
LockSystem: h.webdavLS,
Logger: func(_ *http.Request, err error) {
"crypto/rand"
"errors"
"fmt"
+ "io"
prand "math/rand"
"os"
"path"
type webdavFS struct {
collfs arvados.CollectionFileSystem
writing bool
+ reading bool
}
func (fs *webdavFS) makeparents(name string) {
// have 405.
f = writeFailer{File: f, err: errReadOnly}
}
+ if !fs.reading {
+ // webdav PROPFIND reads the first few bytes of each
+ // file whose filename extension isn't recognized,
+ // which is prohibitively expensive: we end up
+ // fetching multiple 64MiB blocks. Avoid this by
+ // returning EOF on all reads when handling a
+ // PROPFIND.
+ f = readEOF{File: f}
+ }
return
}
return wf.err
}
+type readEOF struct {
+ webdav.File
+}
+
+func (readEOF) Read(p []byte) (int, error) {
+ return 0, io.EOF
+}
+
// noLockSystem implements webdav.LockSystem by returning success for
// every possible locking operation, even though it has no side
// effects such as actually locking anything. This works for a