Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable chunking v1 by default #678

Merged
merged 1 commit into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just remove the code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming you meant remove all the commented out code and don't add a check ? (not remove the chunking code)

/**
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