]> granicus.if.org Git - cgit/commitdiff
add cgit_httpscheme() -> http:// or https://
authorDiego Ongaro <ongardie@gmail.com>
Wed, 10 Jun 2009 23:09:55 +0000 (18:09 -0500)
committerDiego Ongaro <ongardie@gmail.com>
Thu, 11 Jun 2009 05:00:35 +0000 (00:00 -0500)
ui-shared.c
ui-shared.h

index de77bbfadf86dd08e794145395ca1e20e1f63e9c..749ea35c58d5cab7647620d94b570e3501bd9017 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;
index 5a3821f20e1e973f1446845d2641f5e5bc13f5a1..bff482604428c201e3a3c4c2d07d2642923a23f3 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef UI_SHARED_H
 #define UI_SHARED_H
 
+extern char *cgit_httpscheme();
 extern char *cgit_hosturl();
 extern char *cgit_repourl(const char *reponame);
 extern char *cgit_fileurl(const char *reponame, const char *pagename,