]> git.cameronkatri.com Git - cgit.git/blobdiff - ui-shared.c
use cgit_httpscheme() for atom feed
[cgit.git] / ui-shared.c
index 4f2851273418dc9a81c4af942660e4923a149f5e..5ce2bc5d43987cec93bd2e68c5b21e7479cdf93a 100644 (file)
@@ -34,6 +34,17 @@ void cgit_print_error(char *msg)
        html("</div>\n");
 }
 
+char *cgit_httpscheme()
+{
+       char *https;
+
+       https = getenv("HTTPS");
+       if (https != NULL && strcmp(https, "on") == 0)
+               return "https://";
+       else
+               return "http://";
+}
+
 char *cgit_hosturl()
 {
        char *host, *port;
@@ -492,7 +503,8 @@ void cgit_print_docstart(struct cgit_context *ctx)
                html("'/>\n");
        }
        if (host && ctx->repo) {
-               html("<link rel='alternate' title='Atom feed' href='http://");
+               html("<link rel='alternate' title='Atom feed' href='");
+               html(cgit_httpscheme());
                html_attr(cgit_hosturl());
                html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.path,
                                       fmt("h=%s", ctx->qry.head)));
@@ -500,6 +512,8 @@ void cgit_print_docstart(struct cgit_context *ctx)
        }
        html("</head>\n");
        html("<body>\n");
+       if (ctx->cfg.header)
+               html_include(ctx->cfg.header);
 }
 
 void cgit_print_docend()