[xiph-commits] r19096 - icecast/trunk/icecast/src

dm8tbr at svn.xiph.org dm8tbr at svn.xiph.org
Sun Feb 23 13:29:35 PST 2014


Author: dm8tbr
Date: 2014-02-23 13:29:35 -0800 (Sun, 23 Feb 2014)
New Revision: 19096

Modified:
   icecast/trunk/icecast/src/admin.c
   icecast/trunk/icecast/src/client.c
   icecast/trunk/icecast/src/xslt.c
Log:
Send charset in headers for everything, excluding file-serv and streams.


Modified: icecast/trunk/icecast/src/admin.c
===================================================================
--- icecast/trunk/icecast/src/admin.c	2014-02-18 20:07:16 UTC (rev 19095)
+++ icecast/trunk/icecast/src/admin.c	2014-02-23 21:29:35 UTC (rev 19096)
@@ -278,7 +278,7 @@
         /* 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 @@
 
     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 @@
     {
         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;

Modified: icecast/trunk/icecast/src/client.c
===================================================================
--- icecast/trunk/icecast/src/client.c	2014-02-18 20:07:16 UTC (rev 19095)
+++ icecast/trunk/icecast/src/client.c	2014-02-23 21:29:35 UTC (rev 19096)
@@ -189,7 +189,7 @@
 
     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)

Modified: icecast/trunk/icecast/src/xslt.c
===================================================================
--- icecast/trunk/icecast/src/xslt.c	2014-02-18 20:07:16 UTC (rev 19095)
+++ icecast/trunk/icecast/src/xslt.c	2014-02-23 21:29:35 UTC (rev 19096)
@@ -191,6 +191,7 @@
     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 @@
     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 @@
 
         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);



More information about the commits mailing list