[xiph-commits] r13534 - in icecast/trunk/icecast: admin src
karl at svn.xiph.org
karl at svn.xiph.org
Fri Aug 10 17:24:51 PDT 2007
Author: karl
Date: 2007-08-10 17:24:51 -0700 (Fri, 10 Aug 2007)
New Revision: 13534
Modified:
icecast/trunk/icecast/admin/listclients.xsl
icecast/trunk/icecast/admin/listmounts.xsl
icecast/trunk/icecast/admin/manageauth.xsl
icecast/trunk/icecast/admin/moveclients.xsl
icecast/trunk/icecast/admin/response.xsl
icecast/trunk/icecast/admin/stats.xsl
icecast/trunk/icecast/admin/updatemetadata.xsl
icecast/trunk/icecast/src/xslt.c
Log:
Don't hardcode content type of xslt files to html, allow xsl to determine it
Modified: icecast/trunk/icecast/admin/listclients.xsl
===================================================================
--- icecast/trunk/icecast/admin/listclients.xsl 2007-08-10 21:33:16 UTC (rev 13533)
+++ icecast/trunk/icecast/admin/listclients.xsl 2007-08-11 00:24:51 UTC (rev 13534)
@@ -1,5 +1,5 @@
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
-<xsl:output omit-xml-declaration="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
+<xsl:output omit-xml-declaration="no" method="html" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<html>
<head>
Modified: icecast/trunk/icecast/admin/listmounts.xsl
===================================================================
--- icecast/trunk/icecast/admin/listmounts.xsl 2007-08-10 21:33:16 UTC (rev 13533)
+++ icecast/trunk/icecast/admin/listmounts.xsl 2007-08-11 00:24:51 UTC (rev 13534)
@@ -1,5 +1,5 @@
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
-<xsl:output omit-xml-declaration="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
+<xsl:output omit-xml-declaration="no" method="html" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<html>
<head>
Modified: icecast/trunk/icecast/admin/manageauth.xsl
===================================================================
--- icecast/trunk/icecast/admin/manageauth.xsl 2007-08-10 21:33:16 UTC (rev 13533)
+++ icecast/trunk/icecast/admin/manageauth.xsl 2007-08-11 00:24:51 UTC (rev 13534)
@@ -1,5 +1,5 @@
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
-<xsl:output omit-xml-declaration="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
+<xsl:output omit-xml-declaration="no" method="html" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<html>
<head>
Modified: icecast/trunk/icecast/admin/moveclients.xsl
===================================================================
--- icecast/trunk/icecast/admin/moveclients.xsl 2007-08-10 21:33:16 UTC (rev 13533)
+++ icecast/trunk/icecast/admin/moveclients.xsl 2007-08-11 00:24:51 UTC (rev 13534)
@@ -1,5 +1,5 @@
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
-<xsl:output omit-xml-declaration="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
+<xsl:output omit-xml-declaration="no" method="html" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<html>
<head>
Modified: icecast/trunk/icecast/admin/response.xsl
===================================================================
--- icecast/trunk/icecast/admin/response.xsl 2007-08-10 21:33:16 UTC (rev 13533)
+++ icecast/trunk/icecast/admin/response.xsl 2007-08-11 00:24:51 UTC (rev 13534)
@@ -1,5 +1,5 @@
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
-<xsl:output omit-xml-declaration="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
+<xsl:output omit-xml-declaration="no" method="html" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
<xsl:template match = "/iceresponse" >
<html>
<head>
Modified: icecast/trunk/icecast/admin/stats.xsl
===================================================================
--- icecast/trunk/icecast/admin/stats.xsl 2007-08-10 21:33:16 UTC (rev 13533)
+++ icecast/trunk/icecast/admin/stats.xsl 2007-08-11 00:24:51 UTC (rev 13534)
@@ -1,5 +1,5 @@
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
-<xsl:output omit-xml-declaration="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
+<xsl:output omit-xml-declaration="no" method="html" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<html>
<head>
Modified: icecast/trunk/icecast/admin/updatemetadata.xsl
===================================================================
--- icecast/trunk/icecast/admin/updatemetadata.xsl 2007-08-10 21:33:16 UTC (rev 13533)
+++ icecast/trunk/icecast/admin/updatemetadata.xsl 2007-08-11 00:24:51 UTC (rev 13534)
@@ -1,5 +1,5 @@
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
-<xsl:output omit-xml-declaration="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
+<xsl:output omit-xml-declaration="no" method="html" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<html>
<head>
Modified: icecast/trunk/icecast/src/xslt.c
===================================================================
--- icecast/trunk/icecast/src/xslt.c 2007-08-10 21:33:16 UTC (rev 13533)
+++ icecast/trunk/icecast/src/xslt.c 2007-08-11 00:24:51 UTC (rev 13534)
@@ -189,6 +189,7 @@
xsltStylesheetPtr cur;
xmlChar *string;
int len, problem = 0;
+ const char *mediatype = NULL;
xmlSetGenericErrorFunc ("", log_parse_failure);
xsltSetGenericErrorFunc ("", log_parse_failure);
@@ -208,19 +209,37 @@
if (xsltSaveResultToString (&string, &len, res, cur) < 0)
problem = 1;
- thread_mutex_unlock(&xsltlock);
+
+ /* lets find out the content type to use */
+ if (cur->mediaType)
+ mediatype = (char *)cur->mediaType;
+ else
+ {
+ /* check method for the default, a missing method assumes xml */
+ if (cur->method && xmlStrcmp (cur->method, "html") == 0)
+ mediatype = "text/html";
+ else
+ if (cur->method && xmlStrcmp (cur->method, "text") == 0)
+ mediatype = "text/plain";
+ else
+ mediatype = "text/xml";
+ }
if (problem == 0)
{
- const char *http = "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nContent-Length: ";
- int buf_len = strlen (http) + 20 + len;
+ /* the 100 is to allow for the hardcoded headers */
+ unsigned int full_len = strlen (mediatype) + len + 100;
+ refbuf_t *refbuf = refbuf_new (full_len);
if (string == NULL)
- string = xmlStrdup ("");
+ string = xmlCharStrdup ("");
+ snprintf (refbuf->data, full_len,
+ "HTTP/1.0 200 OK\r\nContent-Type: %s\r\nContent-Length: %d\r\n\r\n%s",
+ mediatype, len, string);
+
client->respcode = 200;
client_set_queue (client, NULL);
- client->refbuf = refbuf_new (buf_len);
- len = snprintf (client->refbuf->data, buf_len, "%s%d\r\n\r\n%s", http, len, string);
- client->refbuf->len = len;
+ client->refbuf = refbuf;
+ refbuf->len = strlen (refbuf->data);
fserve_add_client (client, NULL);
xmlFree (string);
}
@@ -229,6 +248,7 @@
WARN1 ("problem applying stylesheet \"%s\"", xslfilename);
client_send_404 (client, "XSLT problem");
}
+ thread_mutex_unlock (&xsltlock);
xmlFreeDoc(res);
}
More information about the commits
mailing list