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

Use standard header for checksums #2921

Merged
merged 1 commit into from
Jun 3, 2022
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
10 changes: 10 additions & 0 deletions changelog/unreleased/gfal-cksum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Enhancement: Use standard header for checksums

On HEAD requests, we currently expose checksums (when available) using the
ownCloud-specific header, which is typically consumed by the sync clients.

This patch adds the standard Digest header using the standard format
detailed at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Digest.
This is e.g. used by GFAL/Rucio clients in the context of managed transfers of datasets.

https://github.com/cs3org/reva/pull/2921
1 change: 1 addition & 0 deletions internal/http/services/owncloud/ocdav/head.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func (s *svc) handleHead(ctx context.Context, w http.ResponseWriter, r *http.Req
w.Header().Set(HeaderOCETag, info.Etag)
if info.Checksum != nil {
w.Header().Set(HeaderOCChecksum, fmt.Sprintf("%s:%s", strings.ToUpper(string(storageprovider.GRPC2PKGXS(info.Checksum.Type))), info.Checksum.Sum))
w.Header().Set(HeaderChecksum, fmt.Sprintf("%s=%s", strings.ToLower(string(storageprovider.GRPC2PKGXS(info.Checksum.Type))), info.Checksum.Sum))
}
t := utils.TSToTime(info.Mtime).UTC()
lastModifiedString := t.Format(time.RFC1123Z)
Expand Down
1 change: 1 addition & 0 deletions internal/http/services/owncloud/ocdav/webdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const (
HeaderLocation = "Location"
HeaderRange = "Range"
HeaderIfMatch = "If-Match"
HeaderChecksum = "Digest"
)

// Non standard HTTP headers.
Expand Down