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

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Tue Apr 26 11:51:01 PDT 2005


Author: karl
Date: 2005-04-26 11:50:58 -0700 (Tue, 26 Apr 2005)
New Revision: 9189

Modified:
   icecast/branches/kh/icecast/src/fserve.c
Log:
send the correct response back for non-regular files, missed from auth
update. 


Modified: icecast/branches/kh/icecast/src/fserve.c
===================================================================
--- icecast/branches/kh/icecast/src/fserve.c	2005-04-26 16:55:47 UTC (rev 9188)
+++ icecast/branches/kh/icecast/src/fserve.c	2005-04-26 18:50:58 UTC (rev 9189)
@@ -87,7 +87,7 @@
     char *type;
 } mime_type;
 
-static int _free_client(void *key);
+static void fserve_client_destroy(fserve_t *fclient);
 static int _delete_mapping(void *mapping);
 static void *fserv_thread_function(void *arg);
 static void create_mime_mappings(const char *fn);
@@ -107,6 +107,7 @@
     thread_mutex_create ("fserve pending", &pending_lock);
 
     run_fserv = 1;
+    stats_event (NULL, "file_connections", "0");
 
     fserv_thread = thread_create("File Serving Thread", 
             fserv_thread_function, NULL, THREAD_ATTACHED);
@@ -265,7 +266,7 @@
                         fserve_t *to_go = fclient;
                         fclient = fclient->next;
                         *trail = fclient;
-                        _free_client (to_go);
+                        fserve_client_destroy (to_go);
                         fserve_clients--;
                         client_tree_changed = 1;
                         continue;
@@ -283,7 +284,7 @@
                     fclient = fclient->next;
                     *trail = fclient;
                     fserve_clients--;
-                    _free_client (to_go);
+                    fserve_client_destroy (to_go);
                     client_tree_changed = 1;
                     continue;
                 }
@@ -300,7 +301,7 @@
         fserve_t *to_go = (fserve_t *)pending_list;
         pending_list = to_go->next;
 
-        _free_client (to_go);
+        fserve_client_destroy (to_go);
     }
     thread_mutex_unlock (&pending_lock);
 
@@ -308,7 +309,7 @@
     {
         fserve_t *to_go = active_list;
         active_list = to_go->next;
-        _free_client (to_go);
+        fserve_client_destroy (to_go);
     }
 
     return NULL;
@@ -394,6 +395,12 @@
         }
         m3u_file_available = 0;
     }
+    if (S_ISREG (file_buf.st_mode) == 0)
+    {
+        client_send_404 (httpclient, "Not found");
+        free (fullpath);
+        return 0;
+    }
 
     if (m3u_requested && m3u_file_available == 0)
     {
@@ -527,8 +534,8 @@
                     client->content_length,
                     fserve_content_type(path));
         }
-        if(bytes > 0) httpclient->con->sent_bytes = bytes;
 
+        stats_event_inc (NULL, "file_connections");
         sock_set_blocking(client->client->con->sock, SOCK_NONBLOCK);
         sock_set_nodelay(client->client->con->sock);
 
@@ -549,15 +556,6 @@
     return 0;
 }
 
-static int _free_client(void *key)
-{
-    fserve_t *client = (fserve_t *)key;
-
-    fserve_client_destroy(client);
-    
-    return 1;
-}
-
 static int _delete_mapping(void *mapping) {
     mime_type *map = mapping;
     free(map->ext);



More information about the commits mailing list