Added X-Request-CID

This commit is contained in:
DataHoarder 2022-01-16 21:35:43 +01:00
parent 5382255219
commit 566bcaffb9

View file

@ -142,7 +142,8 @@ func handleQueryRequest(ctx *fasthttp.RequestCtx, identifier cid.Cid, extraArgum
mh, _ := multihash.Decode(cacheEntry.Entry.Identifier.Hash())
ctx.Response.Header.Set("Accept-Ranges", "bytes")
ctx.Response.Header.Set("ETag", cacheEntry.Entry.Identifier.String())
ctx.Response.Header.Set("X-Request-CID", identifier.String())
ctx.Response.Header.Set("ETag", fmt.Sprintf("\"%s\"", cacheEntry.Entry.Identifier.String()))
if mh.Code == multihash.SHA2_256 {
ctx.Response.Header.Set("Digest", fmt.Sprintf("sha-256=%s", base64.StdEncoding.EncodeToString(mh.Digest)))
}