[PATCH] ui-snapshot: add Link type immutable

1 reply

[PATCH] ui-snapshot: add Link type immutable

From: 6f6ce944663ab5-lists
Cc: klea
From: klea <klea@iwnp.org>

I tested this by applying this patch on v1.4.1, i hope it passes the
other tests.

---
 ui-snapshot.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ui-snapshot.c b/ui-snapshot.c
index 2801393..6062683 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -172,6 +172,7 @@ static int make_snapshot(const struct cgit_snapshot_format *format,
 	ctx.page.etag = oid_to_hex(&oid);
 	ctx.page.mimetype = xstrdup(format->mimetype);
 	ctx.page.filename = xstrdup(filename);
+	htmlf("Link: <%s%s/snapshot/%s%s>, rel=\"immutable\"\n", cgit_rooturl(), ctx.repo->url, oid_to_hex(&oid), format->suffix);
 	cgit_print_http_headers();
 	init_archivers();
 	format->write_func(hex, prefix);
-- 
2.51.0

1 reply

[PATCH v2] ui-snapshot: add Link type immutable

From: klea
Cc: klea
---
I was stupid last time and put the message before all the ---

I tested this by applying this patch on v1.4.1, but i haven't run the
test suite.

 ui-snapshot.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ui-snapshot.c b/ui-snapshot.c
index 2801393..6062683 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -172,6 +172,7 @@ static int make_snapshot(const struct cgit_snapshot_format *format,
 	ctx.page.etag = oid_to_hex(&oid);
 	ctx.page.mimetype = xstrdup(format->mimetype);
 	ctx.page.filename = xstrdup(filename);
+	htmlf("Link: <%s%s/snapshot/%s%s>, rel=\"immutable\"\n", cgit_rooturl(), ctx.repo->url, oid_to_hex(&oid), format->suffix);
 	cgit_print_http_headers();
 	init_archivers();
 	format->write_func(hex, prefix);
-- 
2.51.0