]> gitweb.ps.run Git - ps-cgit/commitdiff
Merge branch 'do/https'
authorLars Hjemli <hjemli@gmail.com>
Sat, 25 Jul 2009 09:40:25 +0000 (11:40 +0200)
committerLars Hjemli <hjemli@gmail.com>
Sat, 25 Jul 2009 09:41:06 +0000 (11:41 +0200)
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
1  2 
ui-shared.c

diff --combined ui-shared.c
index 2630f23e2bc64aee49d643159b1901c4df60c206,5ce2bc5d43987cec93bd2e68c5b21e7479cdf93a..29036d0a92ba45643e7db53af2671113fcbff7be
@@@ -34,6 -34,17 +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;
@@@ -456,8 -467,6 +467,8 @@@ void cgit_print_age(time_t t, time_t ma
  
  void cgit_print_http_headers(struct cgit_context *ctx)
  {
 +      if (ctx->page.status)
 +              htmlf("Status: %d %s\n", ctx->page.status, ctx->page.statusmsg);
        if (ctx->page.mimetype && ctx->page.charset)
                htmlf("Content-Type: %s; charset=%s\n", ctx->page.mimetype,
                      ctx->page.charset);
@@@ -494,7 -503,8 +505,8 @@@ void cgit_print_docstart(struct cgit_co
                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)));