author | Lars Hjemli <hjemli@gmail.com> | 2008-09-15 19:47:14 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-09-15 19:47:14 (UTC) |
commit | 91fd1eca07f9e48109e8acebc0a92dc4b12ecb50 (patch) (unidiff) | |
tree | db8c084d617c8e02899f358a42631646b7c1b766 | |
parent | b28765135dd6f52635977454eaf95d0e6c7e7271 (diff) | |
parent | 9c931b1e6e68f8dc891a5653035c3d70038ae3c0 (diff) | |
download | cgit-91fd1eca07f9e48109e8acebc0a92dc4b12ecb50.zip cgit-91fd1eca07f9e48109e8acebc0a92dc4b12ecb50.tar.gz cgit-91fd1eca07f9e48109e8acebc0a92dc4b12ecb50.tar.bz2 |
Merge branch 'ew/http_host'
* ew/http_host:
use Host: header to generate cgit_hosturl
-rw-r--r-- | ui-shared.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c index 4818e70..c23bc75 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -38,6 +38,10 @@ char *cgit_hosturl() | |||
38 | { | 38 | { |
39 | char *host, *port; | 39 | char *host, *port; |
40 | 40 | ||
41 | host = getenv("HTTP_HOST"); | ||
42 | if (host) { | ||
43 | host = xstrdup(host); | ||
44 | } else { | ||
41 | host = getenv("SERVER_NAME"); | 45 | host = getenv("SERVER_NAME"); |
42 | if (!host) | 46 | if (!host) |
43 | return NULL; | 47 | return NULL; |
@@ -46,6 +50,7 @@ char *cgit_hosturl() | |||
46 | host = xstrdup(fmt("%s:%d", host, atoi(port))); | 50 | host = xstrdup(fmt("%s:%d", host, atoi(port))); |
47 | else | 51 | else |
48 | host = xstrdup(host); | 52 | host = xstrdup(host); |
53 | } | ||
49 | return host; | 54 | return host; |
50 | } | 55 | } |
51 | 56 | ||