diff options
author | Lars Hjemli | 2009-07-25 11:40:25 +0200 |
---|---|---|
committer | Lars Hjemli | 2009-07-25 11:41:06 +0200 |
commit | fbe091a716447be496519ce439451d36d5b9fc24 (patch) | |
tree | c6560c6f2ab6b4760ac6eaecda1759321da2746e | |
parent | Return http statuscode 404 on unknown branch (diff) | |
parent | use cgit_httpscheme() for atom feed (diff) | |
download | cgit-fbe091a716447be496519ce439451d36d5b9fc24.tar.gz cgit-fbe091a716447be496519ce439451d36d5b9fc24.zip |
Merge branch 'do/https'
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-atom.c | 6 | ||||
-rw-r--r-- | ui-shared.c | 14 | ||||
-rw-r--r-- | ui-shared.h | 1 |
3 files changed, 18 insertions, 3 deletions
diff --git a/ui-atom.c b/ui-atom.c index a6ea3ee..e5c31d9 100644 --- a/ui-atom.c +++ b/ui-atom.c | |||
@@ -52,7 +52,8 @@ void add_entry(struct commit *commit, char *host) | |||
52 | cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time); | 52 | cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time); |
53 | html("</published>\n"); | 53 | html("</published>\n"); |
54 | if (host) { | 54 | if (host) { |
55 | html("<link rel='alternate' type='text/html' href='http://"); | 55 | html("<link rel='alternate' type='text/html' href='"); |
56 | html(cgit_httpscheme()); | ||
56 | html_attr(host); | 57 | html_attr(host); |
57 | html_attr(cgit_pageurl(ctx.repo->url, "commit", NULL)); | 58 | html_attr(cgit_pageurl(ctx.repo->url, "commit", NULL)); |
58 | if (ctx.cfg.virtual_root) | 59 | if (ctx.cfg.virtual_root) |
@@ -113,7 +114,8 @@ void cgit_print_atom(char *tip, char *path, int max_count) | |||
113 | html_txt(ctx.repo->desc); | 114 | html_txt(ctx.repo->desc); |
114 | html("</subtitle>\n"); | 115 | html("</subtitle>\n"); |
115 | if (host) { | 116 | if (host) { |
116 | html("<link rel='alternate' type='text/html' href='http://"); | 117 | html("<link rel='alternate' type='text/html' href='"); |
118 | html(cgit_httpscheme()); | ||
117 | html_attr(host); | 119 | html_attr(host); |
118 | html_attr(cgit_repourl(ctx.repo->url)); | 120 | html_attr(cgit_repourl(ctx.repo->url)); |
119 | html("'/>\n"); | 121 | html("'/>\n"); |
diff --git a/ui-shared.c b/ui-shared.c index 2630f23..29036d0 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -34,6 +34,17 @@ void cgit_print_error(char *msg) | |||
34 | html("</div>\n"); | 34 | html("</div>\n"); |
35 | } | 35 | } |
36 | 36 | ||
37 | char *cgit_httpscheme() | ||
38 | { | ||
39 | char *https; | ||
40 | |||
41 | https = getenv("HTTPS"); | ||
42 | if (https != NULL && strcmp(https, "on") == 0) | ||
43 | return "https://"; | ||
44 | else | ||
45 | return "http://"; | ||
46 | } | ||
47 | |||
37 | char *cgit_hosturl() | 48 | char *cgit_hosturl() |
38 | { | 49 | { |
39 | char *host, *port; | 50 | char *host, *port; |
@@ -494,7 +505,8 @@ void cgit_print_docstart(struct cgit_context *ctx) | |||
494 | html("'/>\n"); | 505 | html("'/>\n"); |
495 | } | 506 | } |
496 | if (host && ctx->repo) { | 507 | if (host && ctx->repo) { |
497 | html("<link rel='alternate' title='Atom feed' href='http://"); | 508 | html("<link rel='alternate' title='Atom feed' href='"); |
509 | html(cgit_httpscheme()); | ||
498 | html_attr(cgit_hosturl()); | 510 | html_attr(cgit_hosturl()); |
499 | html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.path, | 511 | html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.path, |
500 | fmt("h=%s", ctx->qry.head))); | 512 | fmt("h=%s", ctx->qry.head))); |
diff --git a/ui-shared.h b/ui-shared.h index 5a3821f..bff4826 100644 --- a/ui-shared.h +++ b/ui-shared.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef UI_SHARED_H | 1 | #ifndef UI_SHARED_H |
2 | #define UI_SHARED_H | 2 | #define UI_SHARED_H |
3 | 3 | ||
4 | extern char *cgit_httpscheme(); | ||
4 | extern char *cgit_hosturl(); | 5 | extern char *cgit_hosturl(); |
5 | extern char *cgit_repourl(const char *reponame); | 6 | extern char *cgit_repourl(const char *reponame); |
6 | extern char *cgit_fileurl(const char *reponame, const char *pagename, | 7 | extern char *cgit_fileurl(const char *reponame, const char *pagename, |