From 91fd1eca07f9e48109e8acebc0a92dc4b12ecb50 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 15 Sep 2008 19:47:14 +0000 Subject: Merge branch 'ew/http_host' * ew/http_host: use Host: header to generate cgit_hosturl --- diff --git a/ui-shared.c b/ui-shared.c index 4818e70..c23bc75 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -38,14 +38,19 @@ char *cgit_hosturl() { char *host, *port; - 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 = getenv("HTTP_HOST"); + if (host) { 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; } -- cgit v0.9.0.2