From 1192c59144b27ed7ec34b95014f91d8a6ecb3be7 Mon Sep 17 00:00:00 2001 From: Mia Date: Mon, 21 Nov 2022 17:25:53 +0100 Subject: [PATCH] fix bug with range headers --- cmd/simple-S3-cache/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/simple-S3-cache/main.go b/cmd/simple-S3-cache/main.go index 00938e3..7b485ef 100644 --- a/cmd/simple-S3-cache/main.go +++ b/cmd/simple-S3-cache/main.go @@ -82,7 +82,7 @@ func (h *Handler) handler(ctx *fasthttp.RequestCtx) { } // HTTP 206 (Partial Content) ctx.Response.SetStatusCode(206) - ctx.Response.Header.Set("Content-Range", fmt.Sprintf("bytes %d-%d/%d", ranges[0].Start, ranges[0].Start+ranges[0].Length, size)) + ctx.Response.Header.Set("Content-Range", fmt.Sprintf("bytes %d-%d/%d", ranges[0].Start, ranges[0].Start+ranges[0].Length-1, size)) ctx.Response.Header.Set("Content-Length", strconv.FormatUint(uint64(ranges[0].Length), 10)) ctx.Response.Header.Set("Content-Type", dataResult.MIME) } else {