From: Lars Hjemli Date: Mon, 15 Sep 2008 20:41:25 +0000 (+0200) Subject: Merge branch 'lh/parsing' X-Git-Url: https://gitweb.ps.run/ps-cgit/commitdiff_plain/a30453a5d3f6db4d6e055da2112343e054e7e7d5?hp=a608ff7ba371c2dddf9274de3a438bf74e2560f7 Merge branch 'lh/parsing' * lh/parsing: ui-tag: show the taggers email parsing.c: be prepared for unexpected content in commit/tag objects --- 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; }