Skip to content

Commit

Permalink
Use standard header for checksums (#2921)
Browse files Browse the repository at this point in the history
  • Loading branch information
glpatcern authored Jun 3, 2022
1 parent 317fd69 commit 2f0cee9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
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

0 comments on commit 2f0cee9

Please sign in to comment.