Author: Diego Ongaro <ongardie@gmail.com>
add cgit_httpscheme() -> http:// or https://
ui-shared.c | 11 +++++++++++ ui-shared.h | 1 +
diff --git a/ui-shared.c b/ui-shared.c index de77bbfadf86dd08e794145395ca1e20e1f63e9c..749ea35c58d5cab7647620d94b570e3501bd9017 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -34,6 +34,17 @@ html_txt(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; diff --git a/ui-shared.h b/ui-shared.h index 5a3821f20e1e973f1446845d2641f5e5bc13f5a1..bff482604428c201e3a3c4c2d07d2642923a23f3 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -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,