Merge branch 'ew/http_host'
* ew/http_host: use Host: header to generate cgit_hosturl
This commit is contained in:
commit
91fd1eca07
19
ui-shared.c
19
ui-shared.c
@ -38,14 +38,19 @@ char *cgit_hosturl()
|
|||||||
{
|
{
|
||||||
char *host, *port;
|
char *host, *port;
|
||||||
|
|
||||||
host = getenv("SERVER_NAME");
|
host = getenv("HTTP_HOST");
|
||||||
if (!host)
|
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);
|
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;
|
return host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user