mirror of
https://git.zx2c4.com/cgit
synced 2024-11-23 00:48:42 +00:00
Merge branch 'ew/http_host'
* ew/http_host: use Host: header to generate cgit_hosturl
This commit is contained in:
commit
91fd1eca07
@ -38,6 +38,10 @@ char *cgit_hosturl()
|
|||||||
{
|
{
|
||||||
char *host, *port;
|
char *host, *port;
|
||||||
|
|
||||||
|
host = getenv("HTTP_HOST");
|
||||||
|
if (host) {
|
||||||
|
host = xstrdup(host);
|
||||||
|
} else {
|
||||||
host = getenv("SERVER_NAME");
|
host = getenv("SERVER_NAME");
|
||||||
if (!host)
|
if (!host)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -46,6 +50,7 @@ char *cgit_hosturl()
|
|||||||
host = xstrdup(fmt("%s:%d", host, atoi(port)));
|
host = xstrdup(fmt("%s:%d", host, atoi(port)));
|
||||||
else
|
else
|
||||||
host = xstrdup(host);
|
host = xstrdup(host);
|
||||||
|
}
|
||||||
return host;
|
return host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user