func (h *handler) serveStatus(w http.ResponseWriter, r *http.Request) {
status := struct {
cacheStats
+ Version string
}{
cacheStats: h.Config.Cache.Stats(),
+ Version: version,
}
json.NewEncoder(w).Encode(status)
}
var (
writeMethod = map[string]bool{
+ "COPY": true,
"DELETE": true,
"MKCOL": true,
"MOVE": true,
"RMCOL": true,
}
webdavMethod = map[string]bool{
+ "COPY": true,
"DELETE": true,
"MKCOL": true,
"MOVE": true,
return
}
w.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type, Range")
- w.Header().Set("Access-Control-Allow-Methods", "DELETE, GET, MKCOL, MOVE, OPTIONS, POST, PROPFIND, PUT, RMCOL")
+ w.Header().Set("Access-Control-Allow-Methods", "COPY, DELETE, GET, MKCOL, MOVE, OPTIONS, POST, PROPFIND, PUT, RMCOL")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Max-Age", "86400")
statusCode = http.StatusOK
statusCode, statusText = http.StatusInternalServerError, err.Error()
return
}
+
+ targetIsPDH := arvadosclient.PDHMatch(targetID)
+ if targetIsPDH && writeMethod[r.Method] {
+ statusCode, statusText = http.StatusMethodNotAllowed, errReadOnly.Error()
+ return
+ }
+
if webdavMethod[r.Method] {
- writing := !arvadosclient.PDHMatch(targetID) && writeMethod[r.Method]
- if writing {
+ if writeMethod[r.Method] {
// Save the collection only if/when all
// webdav->filesystem operations succeed --
// and send a 500 error if the modified
h := webdav.Handler{
Prefix: "/" + strings.Join(pathParts[:stripParts], "/"),
FileSystem: &webdavFS{
- collfs: fs,
- writing: writing,
+ collfs: fs,
+ writing: writeMethod[r.Method],
+ alwaysReadEOF: r.Method == "PROPFIND",
},
LockSystem: h.webdavLS,
Logger: func(_ *http.Request, err error) {