loc = htsbuf_to_string(&hq);
htsbuf_queue_flush(&hq);
} else if (!external && tvheadend_webroot && location[0] == '/') {
- loc = malloc(strlen(location) + strlen(tvheadend_webroot) + 1);
+ loc = alloca(strlen(location) + strlen(tvheadend_webroot) + 1);
strcpy((char *)loc, tvheadend_webroot);
strcat((char *)loc, location);
}
loc, loc);
http_send_reply(hc, HTTP_STATUS_FOUND, "text/html", NULL, loc, 0);
- if (loc != location)
- free((void *)loc);
+}
+
+
+/**
+ * Send an CSS @import
+ */
+void
+http_css_import(http_connection_t *hc, const char *location)
+{
+ const char *loc = location;
+
+ htsbuf_queue_flush(&hc->hc_reply);
+
+ if (tvheadend_webroot && location[0] == '/') {
+ loc = alloca(strlen(location) + strlen(tvheadend_webroot) + 1);
+ strcpy((char *)loc, tvheadend_webroot);
+ strcat((char *)loc, location);
+ }
+
+ htsbuf_qprintf(&hc->hc_reply, "@import url('%s');\r\n", loc);
+
+ http_send_reply(hc, HTTP_STATUS_OK, "text/css", NULL, loc, 0);
}
/**
void http_redirect(http_connection_t *hc, const char *location,
struct http_arg_list *req_args, int external);
+void http_css_import(http_connection_t *hc, const char *location);
+
void http_send_header(http_connection_t *hc, int rc, const char *content,
int64_t contentlen, const char *encoding,
const char *location, int maxage, const char *range,
snprintf(buf, sizeof(buf), "src/webui/static/tvh.%s.css.gz", theme);
if (!http_file_test(buf)) {
snprintf(buf, sizeof(buf), "/static/tvh.%s.css.gz", theme);
- http_redirect(hc, buf, NULL, 0);
+ http_css_import(hc, buf);
return 0;
}
}
snprintf(buf, sizeof(buf), "src/webui/static/extjs/resources/css/xtheme-%s.css", theme);
if (!http_file_test(buf)) {
snprintf(buf, sizeof(buf), "/static/extjs/resources/css/xtheme-%s.css", theme);
- http_redirect(hc, buf, NULL, 0);
+ http_css_import(hc, buf);
return 0;
}
}