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

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Wed Apr 27 17:50:15 PDT 2005


Author: karl
Date: 2005-04-27 17:50:13 -0700 (Wed, 27 Apr 2005)
New Revision: 9191

Modified:
   icecast/branches/kh/icecast/src/fserve.c
Log:
do file type check late on, when we know that something exists


Modified: icecast/branches/kh/icecast/src/fserve.c
===================================================================
--- icecast/branches/kh/icecast/src/fserve.c	2005-04-27 23:12:19 UTC (rev 9190)
+++ icecast/branches/kh/icecast/src/fserve.c	2005-04-28 00:50:13 UTC (rev 9191)
@@ -395,12 +395,6 @@
         }
         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)
     {
@@ -436,7 +430,6 @@
                     sourceuri
                     );
         }
-        if (bytes > 0) httpclient->con->sent_bytes = bytes;
         client_destroy (httpclient);
         free (sourceuri);
         free (fullpath);
@@ -450,12 +443,18 @@
         httpclient->respcode = 200;
         bytes = sock_write(httpclient->con->sock, 
                 "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n");
-        if(bytes > 0) httpclient->con->sent_bytes = bytes;
         stats_transform_xslt (httpclient, fullpath);
         client_destroy (httpclient);
         free (fullpath);
         return 0;
     }
+    if (S_ISREG (file_buf.st_mode) == 0)
+    {
+        client_send_404 (httpclient, "The file you requested could not be found");
+        INFO1 ("found requested file but there is no handler for it", fullpath);
+        free (fullpath);
+        return 0;
+    }
 
     client = calloc (1, sizeof(fserve_t));
     if (client == NULL)



More information about the commits mailing list