| -rw-r--r-- | ui-shared.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/ui-shared.c b/ui-shared.c index c23bc75..4818e70 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -38,19 +38,14 @@ char *cgit_hosturl() { char *host, *port; - host = getenv("HTTP_HOST"); - if (host) { + host = getenv("SERVER_NAME"); + if (!host) + return NULL; + port = getenv("SERVER_PORT"); + if (port && atoi(port) != 80) + host = xstrdup(fmt("%s:%d", host, atoi(port))); + else host = xstrdup(host); - } else { - host = getenv("SERVER_NAME"); - if (!host) - return NULL; - port = getenv("SERVER_PORT"); - if (port && atoi(port) != 80) - host = xstrdup(fmt("%s:%d", host, atoi(port))); - else - host = xstrdup(host); - } return host; } |