Skip to content

Commit 5ff91d4

Browse files
committed
[fix] 'onclick' in stat.xsl works improperly if streams
with the same name are pushed to different virtual hosts.
1 parent c04b6ef commit 5ff91d4

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

ngx_rtmp_stat_module.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,14 +1003,23 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll,
10031003

10041004
static void
10051005
ngx_rtmp_stat_application(ngx_http_request_t *r, ngx_chain_t ***lll,
1006-
ngx_rtmp_core_app_conf_t *cacf)
1006+
ngx_rtmp_core_srv_conf_t *cscf, ngx_rtmp_core_app_conf_t *cacf)
10071007
{
1008+
u_char buf[NGX_INT_T_LEN];
10081009
ngx_rtmp_stat_loc_conf_t *slcf;
10091010

10101011
slcf = ngx_http_get_module_loc_conf(r, ngx_rtmp_stat_module);
10111012

10121013
if (slcf->format & NGX_RTMP_STAT_FORMAT_XML) {
10131014
NGX_RTMP_STAT_L("<application>\r\n");
1015+
NGX_RTMP_STAT_L("<port>");
1016+
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
1017+
"%ui", cscf->port) - buf);
1018+
NGX_RTMP_STAT_L("</port>\r\n");
1019+
NGX_RTMP_STAT_L("<server_index>");
1020+
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
1021+
"%ui", cscf->index) - buf);
1022+
NGX_RTMP_STAT_L("</server_index>\r\n");
10141023
NGX_RTMP_STAT_L("<name>");
10151024
NGX_RTMP_STAT_ES(&cacf->name);
10161025
NGX_RTMP_STAT_L("</name>\r\n");
@@ -1070,7 +1079,7 @@ ngx_rtmp_stat_server(ngx_http_request_t *r, ngx_chain_t ***lll,
10701079

10711080
cacf = cscf->applications.elts;
10721081
for (n = 0; n < cscf->applications.nelts; ++n, ++cacf) {
1073-
ngx_rtmp_stat_application(r, lll, *cacf);
1082+
ngx_rtmp_stat_application(r, lll, cscf, *cacf);
10741083

10751084
if (slcf->format & NGX_RTMP_STAT_FORMAT_JSON &&
10761085
n < cscf->applications.nelts - 1)

stat.xsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
<td>
136136
<a href="">
137137
<xsl:attribute name="onclick">
138-
var d=document.getElementById('<xsl:value-of select="../../name"/>-<xsl:value-of select="name"/>');
138+
var d=document.getElementById('<xsl:value-of select="../../port"/>-<xsl:value-of select="../../server_index"/>-<xsl:value-of select="../../name"/>-<xsl:value-of select="name"/>');
139139
d.style.display=d.style.display=='none'?'':'none';
140140
return false
141141
</xsl:attribute>
@@ -211,7 +211,7 @@
211211
</tr>
212212
<tr style="display:none">
213213
<xsl:attribute name="id">
214-
<xsl:value-of select="../../name"/>-<xsl:value-of select="name"/>
214+
<xsl:value-of select="../../port"/>-<xsl:value-of select="../../server_index"/>-<xsl:value-of select="../../name"/>-<xsl:value-of select="name"/>
215215
</xsl:attribute>
216216
<td colspan="16" ngcolor="#eeeeee">
217217
<table cellspacing="1" cellpadding="5">

0 commit comments

Comments
 (0)