summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
Unidiff
Diffstat (limited to 'ui-shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-shared.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 0dafc83..10be3c0 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -34,6 +34,17 @@ void cgit_print_error(char *msg)
34 html("</div>\n"); 34 html("</div>\n");
35} 35}
36 36
37char *cgit_httpscheme()
38{
39 char *https;
40
41 https = getenv("HTTPS");
42 if (https != NULL && strcmp(https, "on") == 0)
43 return "https://";
44 else
45 return "http://";
46}
47
37char *cgit_hosturl() 48char *cgit_hosturl()
38{ 49{
39 char *host, *port; 50 char *host, *port;
@@ -458,6 +469,8 @@ void cgit_print_http_headers(struct cgit_context *ctx)
458{ 469{
459 const char *method = getenv("REQUEST_METHOD"); 470 const char *method = getenv("REQUEST_METHOD");
460 471
472 if (ctx->page.status)
473 htmlf("Status: %d %s\n", ctx->page.status, ctx->page.statusmsg);
461 if (ctx->page.mimetype && ctx->page.charset) 474 if (ctx->page.mimetype && ctx->page.charset)
462 htmlf("Content-Type: %s; charset=%s\n", ctx->page.mimetype, 475 htmlf("Content-Type: %s; charset=%s\n", ctx->page.mimetype,
463 ctx->page.charset); 476 ctx->page.charset);
@@ -498,7 +511,8 @@ void cgit_print_docstart(struct cgit_context *ctx)
498 html("'/>\n"); 511 html("'/>\n");
499 } 512 }
500 if (host && ctx->repo) { 513 if (host && ctx->repo) {
501 html("<link rel='alternate' title='Atom feed' href='http://"); 514 html("<link rel='alternate' title='Atom feed' href='");
515 html(cgit_httpscheme());
502 html_attr(cgit_hosturl()); 516 html_attr(cgit_hosturl());
503 html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.path, 517 html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.path,
504 fmt("h=%s", ctx->qry.head))); 518 fmt("h=%s", ctx->qry.head)));