Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
Icecast-Server
Commits
2a0c3cde
Commit
2a0c3cde
authored
Aug 11, 2007
by
Karl Heyes
Browse files
Don't hardcode content type of xslt files to html, allow xsl to determine it
svn path=/icecast/trunk/icecast/; revision=13534
parent
b3b2695a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
34 additions
and
14 deletions
+34
-14
admin/listclients.xsl
admin/listclients.xsl
+1
-1
admin/listmounts.xsl
admin/listmounts.xsl
+1
-1
admin/manageauth.xsl
admin/manageauth.xsl
+1
-1
admin/moveclients.xsl
admin/moveclients.xsl
+1
-1
admin/response.xsl
admin/response.xsl
+1
-1
admin/stats.xsl
admin/stats.xsl
+1
-1
admin/updatemetadata.xsl
admin/updatemetadata.xsl
+1
-1
src/xslt.c
src/xslt.c
+27
-7
No files found.
admin/listclients.xsl
View file @
2a0c3cde
<xsl:stylesheet
xmlns:xsl =
"http://www.w3.org/1999/XSL/Transform"
version =
"1.0"
>
<xsl:output
omit-xml-declaration=
"no"
method=
"
x
ml"
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=
"
ht
ml"
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>
...
...
admin/listmounts.xsl
View file @
2a0c3cde
<xsl:stylesheet
xmlns:xsl =
"http://www.w3.org/1999/XSL/Transform"
version =
"1.0"
>
<xsl:output
omit-xml-declaration=
"no"
method=
"
x
ml"
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=
"
ht
ml"
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>
...
...
admin/manageauth.xsl
View file @
2a0c3cde
<xsl:stylesheet
xmlns:xsl =
"http://www.w3.org/1999/XSL/Transform"
version =
"1.0"
>
<xsl:output
omit-xml-declaration=
"no"
method=
"
x
ml"
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=
"
ht
ml"
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>
...
...
admin/moveclients.xsl
View file @
2a0c3cde
<xsl:stylesheet
xmlns:xsl =
"http://www.w3.org/1999/XSL/Transform"
version =
"1.0"
>
<xsl:output
omit-xml-declaration=
"no"
method=
"
x
ml"
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=
"
ht
ml"
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>
...
...
admin/response.xsl
View file @
2a0c3cde
<xsl:stylesheet
xmlns:xsl =
"http://www.w3.org/1999/XSL/Transform"
version =
"1.0"
>
<xsl:output
omit-xml-declaration=
"no"
method=
"
x
ml"
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=
"
ht
ml"
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>
...
...
admin/stats.xsl
View file @
2a0c3cde
<xsl:stylesheet
xmlns:xsl =
"http://www.w3.org/1999/XSL/Transform"
version =
"1.0"
>
<xsl:output
omit-xml-declaration=
"no"
method=
"
x
ml"
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=
"
ht
ml"
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>
...
...
admin/updatemetadata.xsl
View file @
2a0c3cde
<xsl:stylesheet
xmlns:xsl =
"http://www.w3.org/1999/XSL/Transform"
version =
"1.0"
>
<xsl:output
omit-xml-declaration=
"no"
method=
"
x
ml"
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=
"
ht
ml"
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>
...
...
src/xslt.c
View file @
2a0c3cde
...
...
@@ -189,6 +189,7 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
xsltStylesheetPtr
cur
;
xmlChar
*
string
;
int
len
,
problem
=
0
;
const
char
*
mediatype
=
NULL
;
xmlSetGenericErrorFunc
(
""
,
log_parse_failure
);
xsltSetGenericErrorFunc
(
""
,
log_parse_failure
);
...
...
@@ -208,19 +209,37 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
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\n
Content-Type: text/html
\r\n
Content-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\n
Content-Type: %s
\r\n
Content-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 @@ void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client)
WARN1
(
"problem applying stylesheet
\"
%s
\"
"
,
xslfilename
);
client_send_404
(
client
,
"XSLT problem"
);
}
thread_mutex_unlock
(
&
xsltlock
);
xmlFreeDoc
(
res
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment