From: Patrick Gaubatz Date: Sun, 23 Nov 2014 09:20:59 +0000 (+0100) Subject: minor optimizations in http_get_hostpath() X-Git-Tag: v4.1~698 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d1bdce093d3be9c4dff97554fbf159d6deb25e76;p=thirdparty%2Ftvheadend.git minor optimizations in http_get_hostpath() --- diff --git a/src/webui/webui.c b/src/webui/webui.c index 82ea5f8cf..8d353c7a8 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -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); }