Skip to content

Commit

Permalink
WIP Disable chunking v1 by default (#678)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Petry authored May 6, 2020
1 parent 4da63dd commit 1f678dc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/reva/gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ blacklisted_files = ["foo"]
undelete = true
versioning = true
[http.services.ocssvc.capabilities.capabilities.dav]
chunking = "1.0"
chunking = "" # set to "1.0" for experimental support
[http.services.ocssvc.capabilities.capabilities.files_sharing]
api_enabled = true
resharing = true
Expand Down
10 changes: 10 additions & 0 deletions internal/http/services/owncloud/ocdav/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
)

func isChunked(fn string) (bool, error) {
// FIXME: also need to check whether the OC-Chunked header is set
return regexp.MatchString(`-chunking-\w+-[0-9]+-[0-9]+$`, fn)
}

Expand Down Expand Up @@ -127,6 +128,15 @@ func (s *svc) handlePut(w http.ResponseWriter, r *http.Request, ns string) {
}

if ok {
// TODO: disable if chunking capability is turned off in config
/**
if s.c.Capabilities.Dav.Chunking == "1.0" {
s.handlePutChunked(w, r)
} else {
log.Error().Err(err).Msg("chunking 1.0 is not enabled")
w.WriteHeader(http.StatusBadRequest)
}
*/
s.handlePutChunked(w, r)
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ func (h *Handler) Init(c *config.Config) {
if h.c.Capabilities.Dav == nil {
h.c.Capabilities.Dav = &data.CapabilitiesDav{}
}
if h.c.Capabilities.Dav.Chunking == "" {
h.c.Capabilities.Dav.Chunking = "1.0"
}
if h.c.Capabilities.Dav.Trashbin == "" {
h.c.Capabilities.Dav.Trashbin = "1.0"
}
Expand Down

0 comments on commit 1f678dc

Please sign in to comment.