1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-06-23 06:25:24 +00:00

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

svn path=/icecast/trunk/icecast/; revision=19096
This commit is contained in:
Thomas B. "dm8tbr" Ruecker 2014-02-23 21:29:35 +00:00
parent c24fcc3581
commit 110a84146d
3 changed files with 10 additions and 6 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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);