Skip to content

Commit

Permalink
On HEAD requests and when available, expose checksum values using the…
Browse files Browse the repository at this point in the history
… standard header on top of the ownCloud-specific one
  • Loading branch information
glpatcern committed Jun 3, 2022
1 parent 317fd69 commit 9c356e5
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 9c356e5

Please sign in to comment.