Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
minor optimizations in http_get_hostpath()
  • Loading branch information
pgaubatz authored and perexg committed Nov 23, 2014
1 parent 664d243 commit d1bdce0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/webui/webui.c
Expand Up @@ -368,14 +368,10 @@ static char *
http_get_hostpath(http_connection_t *hc)
{
char buf[255];
const char *host = http_arg_get(&hc->hc_args, "Host");
const char *forwarded_host = http_arg_get(&hc->hc_args, "X-Forwarded-Host");
const char *host = http_arg_get(&hc->hc_args, "Host") ?: http_arg_get(&hc->hc_args, "X-Forwarded-Host");
const char *proto = http_arg_get(&hc->hc_args, "X-Forwarded-Proto");

snprintf(buf, sizeof(buf), "%s://%s%s",
proto ? proto : "http",
forwarded_host ? forwarded_host : host,
tvheadend_webroot ? tvheadend_webroot : "");
snprintf(buf, sizeof(buf), "%s://%s%s", proto ?: "http", host, tvheadend_webroot ?: "");

return strdup(buf);
}
Expand Down

0 comments on commit d1bdce0

Please sign in to comment.