Commit ce167cc6 authored by Ed "oddsock" Zaleski's avatar Ed "oddsock" Zaleski

whoops...stats can't have spaces in them, since XML can't have spaces in the tags

also, handle case where a client sends a bad ice-audio-info string (variable but no value)

svn path=/trunk/icecast/; revision=4380
parent 1658f171
...@@ -211,10 +211,10 @@ void *source_main(void *arg) ...@@ -211,10 +211,10 @@ void *source_main(void *arg)
stats_event(source->mount, "listeners", "0"); stats_event(source->mount, "listeners", "0");
source->listeners = 0; source->listeners = 0;
if ((s = httpp_getvar(source->parser, "ice-name"))) { if ((s = httpp_getvar(source->parser, "ice-name"))) {
_add_yp_info(source, "server name", s, YP_SERVER_NAME); _add_yp_info(source, "server_name", s, YP_SERVER_NAME);
} }
if ((s = httpp_getvar(source->parser, "ice-url"))) { if ((s = httpp_getvar(source->parser, "ice-url"))) {
_add_yp_info(source, "server url", s, YP_SERVER_URL); _add_yp_info(source, "server_url", s, YP_SERVER_URL);
} }
if ((s = httpp_getvar(source->parser, "ice-genre"))) { if ((s = httpp_getvar(source->parser, "ice-genre"))) {
_add_yp_info(source, "genre", s, YP_SERVER_GENRE); _add_yp_info(source, "genre", s, YP_SERVER_GENRE);
...@@ -223,7 +223,7 @@ void *source_main(void *arg) ...@@ -223,7 +223,7 @@ void *source_main(void *arg)
_add_yp_info(source, "bitrate", s, YP_BITRATE); _add_yp_info(source, "bitrate", s, YP_BITRATE);
} }
if ((s = httpp_getvar(source->parser, "ice-description"))) { if ((s = httpp_getvar(source->parser, "ice-description"))) {
_add_yp_info(source, "server description", s, YP_SERVER_DESC); _add_yp_info(source, "server_description", s, YP_SERVER_DESC);
} }
if ((s = httpp_getvar(source->parser, "ice-private"))) { if ((s = httpp_getvar(source->parser, "ice-private"))) {
stats_event(source->mount, "public", s); stats_event(source->mount, "public", s);
...@@ -232,7 +232,7 @@ void *source_main(void *arg) ...@@ -232,7 +232,7 @@ void *source_main(void *arg)
if ((s = httpp_getvar(source->parser, "ice-audio-info"))) { if ((s = httpp_getvar(source->parser, "ice-audio-info"))) {
if (_parse_audio_info(source, s)) { if (_parse_audio_info(source, s)) {
ai = util_dict_urlencode(source->audio_info, '&'); ai = util_dict_urlencode(source->audio_info, '&');
_add_yp_info(source, "audio info", _add_yp_info(source, "audio_info",
ai, ai,
YP_AUDIO_INFO); YP_AUDIO_INFO);
} }
...@@ -623,10 +623,10 @@ static int _free_client(void *key) ...@@ -623,10 +623,10 @@ static int _free_client(void *key)
static int _parse_audio_info(source_t *source, char *s) static int _parse_audio_info(source_t *source, char *s)
{ {
char *token; char *token = NULL;
char *pvar; char *pvar = NULL;
char *variable; char *variable = NULL;
char *value; char *value = NULL;
while ((token = strtok(s,";")) != NULL) { while ((token = strtok(s,";")) != NULL) {
pvar = strchr(token, '='); pvar = strchr(token, '=');
...@@ -641,13 +641,13 @@ static int _parse_audio_info(source_t *source, char *s) ...@@ -641,13 +641,13 @@ static int _parse_audio_info(source_t *source, char *s)
strncpy(value, pvar, strlen(pvar)); strncpy(value, pvar, strlen(pvar));
util_dict_set(source->audio_info, variable, value); util_dict_set(source->audio_info, variable, value);
stats_event(source->mount, variable, value); stats_event(source->mount, variable, value);
if (value) {
free(value);
}
} }
if (variable) { if (variable) {
free(variable); free(variable);
} }
if (value) {
free(value);
}
} }
s = NULL; s = NULL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment