[xiph-commits] r9452 - icecast/branches/kh/icecast/src

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Tue Jun 14 19:13:48 PDT 2005


Author: karl
Date: 2005-06-14 19:13:43 -0700 (Tue, 14 Jun 2005)
New Revision: 9452

Modified:
   icecast/branches/kh/icecast/src/connection.c
   icecast/branches/kh/icecast/src/fserve.c
   icecast/branches/kh/icecast/src/stats.c
   icecast/branches/kh/icecast/src/stats.h
Log:
minor changes


Modified: icecast/branches/kh/icecast/src/connection.c
===================================================================
--- icecast/branches/kh/icecast/src/connection.c	2005-06-14 13:37:52 UTC (rev 9451)
+++ icecast/branches/kh/icecast/src/connection.c	2005-06-15 02:13:43 UTC (rev 9452)
@@ -804,6 +804,15 @@
         return;
     }
 
+    if (util_check_valid_extension (uri) == XSLT_CONTENT)
+    {
+        /* If the file exists, then transform it, otherwise, write a 404 */
+        DEBUG0("Stats request, sending XSL transformed stats");
+        stats_transform_xslt (client, uri);
+        if (uri != passed_uri) free (uri);
+        return;
+    }
+
     add_client (uri, client);
 
     if (uri != passed_uri) free (uri);

Modified: icecast/branches/kh/icecast/src/fserve.c
===================================================================
--- icecast/branches/kh/icecast/src/fserve.c	2005-06-14 13:37:52 UTC (rev 9451)
+++ icecast/branches/kh/icecast/src/fserve.c	2005-06-15 02:13:43 UTC (rev 9452)
@@ -35,7 +35,7 @@
 #include <winsock2.h>
 #include <windows.h>
 #define snprintf _snprintf
-#define S_ISREG (mode)  ((mode) & _S_IFREG)
+#define S_ISREG(mode)  ((mode) & _S_IFREG)
 #endif
 
 #include "thread/thread.h"
@@ -376,6 +376,7 @@
     int ret = 0;
     char *fullpath;
     int m3u_requested = 0, m3u_file_available = 1;
+    ice_config_t *config;
     FILE *file;
 
     fullpath = util_get_path_from_normalised_uri (path);
@@ -409,7 +410,7 @@
         httpclient->respcode = 200;
         if (host == NULL)
         {
-            ice_config_t *config = config_get_config();
+            config = config_get_config();
             host = strdup (config->hostname);
             port = config->port;
             config_release_config();
@@ -438,17 +439,8 @@
         return 0;
     }
 
-    if (util_check_valid_extension (fullpath) == XSLT_CONTENT)
-    {
-        /* If the file exists, then transform it, otherwise, write a 404 */
-        DEBUG0("Stats request, sending XSL transformed stats");
-        stats_transform_xslt (httpclient, fullpath);
-        free (fullpath);
-        return 0;
-    }
-
     /* on demand file serving check */
-    ice_config_t *config = config_get_config();
+    config = config_get_config();
     if (config->fileserve == 0)
     {
         DEBUG1 ("on demand file \"%s\" refused", fullpath);
@@ -537,6 +529,7 @@
                     fserve_content_type(path));
         }
         httpclient->refbuf->len = bytes;
+        httpclient->pos = 0;
 
         stats_event_inc (NULL, "file_connections");
         fserve_add_client (httpclient, file);
@@ -551,7 +544,9 @@
 }
 
 
-/* Add client */
+/* Add client to fserve thread, client needs to have refbuf set and filled
+ * but may provide a NULL file if no data needs to be read
+ */
 int fserve_add_client (client_t *client, FILE *file)
 {
     fserve_t *fclient = calloc (1, sizeof(fserve_t));

Modified: icecast/branches/kh/icecast/src/stats.c
===================================================================
--- icecast/branches/kh/icecast/src/stats.c	2005-06-14 13:37:52 UTC (rev 9451)
+++ icecast/branches/kh/icecast/src/stats.c	2005-06-15 02:13:43 UTC (rev 9452)
@@ -35,6 +35,7 @@
 #include "client.h"
 #include "stats.h"
 #include "xslt.h"
+#include "util.h"
 #define CATMODULE "stats"
 #include "logging.h"
 
@@ -703,7 +704,7 @@
             (event->source != NULL) ? event->source : "global",
             event->name ? event->name : "null",
             event->value ? event->value : "null");
-    if (len > 0 && len < sizeof (buf))
+    if (len > 0 && len < (int)sizeof (buf))
         ret = client_send_bytes (client, buf, len);
 
     return (ret == -1) ? 0 : 1;
@@ -886,9 +887,10 @@
     return node->node;
 }
 
-void stats_transform_xslt(client_t *client, char *xslpath)
+void stats_transform_xslt(client_t *client, const char *uri)
 {
     xmlDocPtr doc;
+    char *xslpath = util_get_path_from_normalised_uri (uri);
 
     stats_get_xml(&doc, 0);
 

Modified: icecast/branches/kh/icecast/src/stats.h
===================================================================
--- icecast/branches/kh/icecast/src/stats.h	2005-06-14 13:37:52 UTC (rev 9451)
+++ icecast/branches/kh/icecast/src/stats.h	2005-06-15 02:13:43 UTC (rev 9452)
@@ -86,7 +86,7 @@
 void *stats_connection(void *arg);
 void *stats_callback(void *arg);
 
-void stats_transform_xslt(client_t *client, char *xslpath);
+void stats_transform_xslt(client_t *client, const char *xslpath);
 void stats_sendxml(client_t *client);
 void stats_get_xml(xmlDocPtr *doc, int show_hidden);
 char *stats_get_value(char *source, char *name);



More information about the commits mailing list