Download raw body.
gotwebd: set filename for RSS feeds
a consequence i haven't realized when adding RSS support is that since
gotwebd serves the pages from a path that's lacking a filename part,
the browser call the RSS feed with a random string.
This is not an issue for RSS readers (they extract all the needed info
from the XML), but it's ugly, so let's fix it.
Diff below uses Content-Disposition to 1) make the browser download
the file instead of rendering it and 2) use a reasonable file name
(got.git.rss) instead of the random string the browser will use
otherwise (lHFP5B6d).
ok?
diff /home/op/w/got2
commit - 1b18f4cd75fddf070589d9b045e083ac02d8baba
path + /home/op/w/got2
blob - 6f5a07850b9e8e153830292e5ce4f4d986782eff
file + gotwebd/gotweb.c
--- gotwebd/gotweb.c
+++ gotwebd/gotweb.c
@@ -179,8 +179,13 @@ gotweb_process_request(struct request *c)
}
if (qs->action == RSS) {
- error = gotweb_render_content_type(c,
- "application/rss+xml;charset=utf-8");
+ char feedname[PATH_MAX];
+
+ strlcpy(feedname, repo_dir->name, sizeof(feedname));
+ strlcat(feedname, ".rss", sizeof(feedname));
+
+ error = gotweb_render_content_type_file(c,
+ "application/rss+xml;charset=utf-8", feedname);
if (error) {
log_warnx("%s: %s", __func__, error->msg);
goto err;
gotwebd: set filename for RSS feeds