[xiph-cvs] cvs commit: icecast/src source.c

Ed oddsock at xiph.org
Wed Feb 26 19:01:12 PST 2003



oddsock     03/02/26 22:01:12

  Modified:    src      source.c
  Log:
  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)

Revision  Changes    Path
1.38      +11 -11    icecast/src/source.c

Index: source.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/source.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- source.c	26 Feb 2003 23:52:23 -0000	1.37
+++ source.c	27 Feb 2003 03:01:12 -0000	1.38
@@ -211,10 +211,10 @@
         stats_event(source->mount, "listeners", "0");
         source->listeners = 0;
         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"))) {
-        _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"))) {
         _add_yp_info(source, "genre", s, YP_SERVER_GENRE);
@@ -223,7 +223,7 @@
         _add_yp_info(source, "bitrate", s, YP_BITRATE);
         }
         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"))) {
                 stats_event(source->mount, "public", s);
@@ -232,7 +232,7 @@
         if ((s = httpp_getvar(source->parser, "ice-audio-info"))) {
         if (_parse_audio_info(source, s)) {
             ai = util_dict_urlencode(source->audio_info, '&');
-            _add_yp_info(source, "audio info", 
+            _add_yp_info(source, "audio_info", 
                     ai,
                     YP_AUDIO_INFO);
         }
@@ -623,10 +623,10 @@
 
 static int _parse_audio_info(source_t *source, char *s)
 {
-    char *token;
-    char *pvar;
-    char *variable;
-    char *value;
+    char *token = NULL;
+    char *pvar = NULL;
+    char *variable = NULL;
+    char *value = NULL;
 
     while ((token = strtok(s,";")) != NULL) {
         pvar = strchr(token, '=');
@@ -641,12 +641,12 @@
                 strncpy(value, pvar, strlen(pvar));	
                 util_dict_set(source->audio_info, variable, value);
                 stats_event(source->mount, variable, value);
+                if (value) {
+                    free(value);
+                }
             }
             if (variable) {
                     free(variable);
-            }
-            if (value) {
-                free(value);
             }
         }
         s = NULL;

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list