]> git.cameronkatri.com Git - cgit.git/blobdiff - ui-shared.c
use cgit_httpscheme() for atom feed
[cgit.git] / ui-shared.c
index de77bbfadf86dd08e794145395ca1e20e1f63e9c..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)));