Commit 110a8414 authored by Thomas B. Rücker's avatar Thomas B. Rücker 😊

Send charset in headers for everything, excluding file-serv and streams.

svn path=/icecast/trunk/icecast/; revision=19096
parent c24fcc35
......@@ -278,7 +278,7 @@ void admin_send_response (xmlDocPtr doc, client_t *client,
/* FIXME: in this section we hope no function will ever return -1 */
len = util_http_build_header(client->refbuf->data, buf_len, 0,
0, 200, NULL,
"text/xml", NULL,
"text/xml", "utf-8",
NULL);
len += snprintf (client->refbuf->data + len, buf_len - len, "Content-Length: %d\r\n\r\n%s", xmlStrlen(buff), buff);
......@@ -572,7 +572,7 @@ static void html_success(client_t *client, char *message)
ret = util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0,
0, 200, NULL,
"text/html", NULL,
"text/html", "utf-8",
"");
snprintf(client->refbuf->data + ret, PER_CLIENT_REFBUF_SIZE - ret,
"<html><head><title>Admin request successful</title></head>"
......@@ -1031,7 +1031,7 @@ static void command_list_mounts(client_t *client, int response)
{
util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0,
0, 200, NULL,
"text/plain", NULL,
"text/plain", "utf-8",
"");
client->refbuf->len = strlen (client->refbuf->data);
client->respcode = 200;
......
......@@ -189,7 +189,7 @@ static void client_send_error(client_t *client, int status, int plain, const cha
ret = util_http_build_header(client->refbuf->data, PER_CLIENT_REFBUF_SIZE, 0,
0, status, NULL,
plain ? "text/plain" : "text/html", NULL,
plain ? "text/plain" : "text/html", "utf-8",
plain ? message : "");
if (!plain)
......
......@@ -191,6 +191,7 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
xmlChar *string;
int len, problem = 0;
const char *mediatype = NULL;
const char *charset = NULL;
xmlSetGenericErrorFunc ("", log_parse_failure);
xsltSetGenericErrorFunc ("", log_parse_failure);
......@@ -211,7 +212,10 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
if (xsltSaveResultToString (&string, &len, res, cur) < 0)
problem = 1;
/* lets find out the content type to use */
/* lets find out the content type and character encoding to use */
if (cur->encoding)
charset = (char *)cur->encoding;
if (cur->mediaType)
mediatype = (char *)cur->mediaType;
else
......@@ -234,7 +238,7 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
if (string == NULL)
string = xmlCharStrdup ("");
ret = util_http_build_header(refbuf->data, full_len, 0, 0, 200, NULL, mediatype, NULL, NULL);
ret = util_http_build_header(refbuf->data, full_len, 0, 0, 200, NULL, mediatype, charset, NULL);
snprintf (refbuf->data + ret, full_len - ret,
"Content-Length: %d\r\n\r\n%s",
len, string);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment