]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
minor optimizations in http_get_hostpath()
authorPatrick Gaubatz <patrick@gaubatz.at>
Sun, 23 Nov 2014 09:20:59 +0000 (10:20 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sun, 23 Nov 2014 16:53:59 +0000 (17:53 +0100)
src/webui/webui.c

index 82ea5f8cfdfcb05c715d406c14b68414933c7b4f..8d353c7a89b66772a2b58f79245ef0317a9f4e35 100644 (file)
@@ -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);
 }