]> gitweb.ps.run Git - ps-cgit/commitdiff
Merge branch 'lh/parsing'
authorLars Hjemli <hjemli@gmail.com>
Mon, 15 Sep 2008 20:41:25 +0000 (22:41 +0200)
committerLars Hjemli <hjemli@gmail.com>
Mon, 15 Sep 2008 20:41:25 +0000 (22:41 +0200)
* lh/parsing:
  ui-tag: show the taggers email
  parsing.c: be prepared for unexpected content in commit/tag objects

ui-shared.c

index 4818e70983064ac5e1d8d944e530365f240ed63e..c23bc7540b9862bb200afba1bd46b7af7a119896 100644 (file)
@@ -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;
 }