about summary refs log tree commit diff
path: root/ui-shared.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2007-02-08 13:53:13 +0100
committerLars Hjemli <hjemli@gmail.com>2007-02-08 13:58:58 +0100
commitab2ab95f09994560f62fd631f07d3b6e3577aa6e (patch)
tree846763c1bcb78bd27dc37c99e5f6d703ca5ab179 /ui-shared.c
parentcgit v0.2 (diff)
downloadcgit-pink-ab2ab95f09994560f62fd631f07d3b6e3577aa6e.tar.gz
cgit-pink-ab2ab95f09994560f62fd631f07d3b6e3577aa6e.zip
Add support for snapshots
Make a link from the commit viewer to a snapshot of the corresponding tree.

Currently only zip-format is supported.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to '')
-rw-r--r--ui-shared.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 3322561..172499c 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -144,3 +144,14 @@ void cgit_print_pageheader(char *title, int show_search)
 		html("</a>");
 	html("</td></tr><tr><td id='content'>");
 }
+
+void cgit_print_snapshot_start(const char *mimetype, const char *filename, 
+			       struct cacheitem *item)
+{
+	htmlf("Content-Type: %s\n", mimetype);
+	htmlf("Content-Disposition: inline; filename=\"%s\"\n", filename);
+	htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime));
+	htmlf("Expires: %s\n", http_date(item->st.st_mtime +
+					 ttl_seconds(item->ttl)));
+	html("\n");
+}