Index: src/daemon/driver/driverCommands.ml
===================================================================
RCS file: /cvsroot/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml,v
retrieving revision 1.98
diff -u -r1.98 driverCommands.ml
--- src/daemon/driver/driverCommands.ml	12 Nov 2005 11:09:39 -0000	1.98
+++ src/daemon/driver/driverCommands.ml	12 Nov 2005 14:33:16 -0000
@@ -2581,7 +2581,7 @@
 				\\<table cellspacing=0 cellpadding=0 width=100%%\\>\\<tr\\>
 				\\<td nowrap class=\\\"fbig\\\"\\>\\<a href=\\\"files\\\"\\>Display all files\\</a\\>\\</td\\>
 				\\<td nowrap class=\\\"fbig\\\"\\>\\<a href=\\\"submit?q=verify_chunks+%d\\\"\\>Verify chunks\\</a\\>\\</td\\>
-				\\<td nowrap class=\\\"fbig\\\"\\>\\<a href=\\\"submit?q=preview+%d\\\"\\>Preview\\</a\\>\\</td\\>
+				\\<td nowrap class=\\\"fbig\\\"\\>\\<a href=\\\"preview_download?q=%d\\\"\\>Preview\\</a\\>\\</td\\>
 				\\<td nowrap class=\\\"fbig pr\\\"\\>\\<a href=\\\"javascript:window.location.reload()\\\"\\>Reload\\</a\\>\\</td\\>
 				\\<td class=downloaded width=100%%\\>\\</td\\>
 				\\</tr\\>\\</table\\>
Index: src/daemon/driver/driverControlers.ml
===================================================================
RCS file: /cvsroot/mldonkey/mldonkey/src/daemon/driver/driverControlers.ml,v
retrieving revision 1.49
diff -u -r1.49 driverControlers.ml
--- src/daemon/driver/driverControlers.ml	30 Oct 2005 21:10:18 -0000	1.49
+++ src/daemon/driver/driverControlers.ml	12 Nov 2005 14:33:18 -0000
@@ -719,7 +719,18 @@
 | JPEG
 | JAVASCRIPT
 | MPEG
+| AVI
+| WMV
+| ASF
+| MOV
+| OGM
+| RM
+| MKV
 | PNG
+| GIF
+| MP3
+| WMA
+| OGG
 | TEXTS
 | UNKN
 | WML
@@ -733,12 +744,32 @@
   | "htm"
   | "html" -> HTMLS
   | "ico" -> ICON
+  | "jpe"
   | "jpeg"
   | "jpg" -> JPEG
   | "js" -> JAVASCRIPT
+  | "mpe"
   | "mpeg"
   | "mpg" -> MPEG
+  | "avi" -> AVI
+  | "wmv" -> WMV
+  | "asf" -> ASF
+  | "mov"
+  | "movie"
+  | "qt" -> MOV
+  | "ogm" -> OGM
+  | "ra"
+  | "ram"
+  | "rm"
+  | "rmvb"
+  | "rv9"
+  | "rt" -> RM
+  | "mkv" -> MKV
   | "png" -> PNG
+  | "gif" -> GIF
+  | "mp3" -> MP3
+  | "wma" -> WMA
+  | "ogg" -> OGG
   | "txt" -> TEXTS
   | "wml" -> WML
   | _ -> UNKN
@@ -753,7 +784,18 @@
   | JAVASCRIPT -> TXT
   | JPEG -> BIN
   | MPEG -> BIN
+  | AVI -> BIN
+  | WMV -> BIN
+  | ASF -> BIN
+  | MOV -> BIN
+  | OGM -> BIN
+  | RM -> BIN
+  | MKV -> BIN
   | PNG -> BIN
+  | GIF -> BIN
+  | MP3 -> BIN
+  | WMA -> BIN
+  | OGG -> BIN
   | TEXTS -> TXT
   | WML -> TXT
 
@@ -767,7 +809,18 @@
   | JAVASCRIPT -> "text/javascript"
   | JPEG -> "image/jpg"
   | MPEG -> "video/mpeg"
+  | AVI -> "video/x-msvideo"
+  | WMV -> "video/x-ms-wmv"
+  | ASF -> "video/x-ms-asf"
+  | MOV -> "video/quicktime"
+  | OGM -> "application/ogg" (* is that correct ? *)
+  | RM -> "audio/x-pn-realaudio"
+  | MKV -> "video/x-matroska" (* is that correct ? *)
   | PNG -> "image/png"
+  | GIF -> "image/gif"
+  | MP3 -> "audio/mpeg"
+  | WMA -> "audio/x-ms-wma"
+  | OGG -> "application/ogg" (* is that correct ? *)
   | TEXTS -> "text/plain"
   | WML -> "text/vnd.wap.wml"
 
@@ -832,6 +885,15 @@
   http_add_bin_info_header r clen;
   add_gzip_headers r
 
+let http_add_bin_stream_header r ext =
+  http_file_type := BIN;
+  http_add_gen_header r;
+  let mime_type = ext_to_mime_type ext in
+  let mime_type = if mime_type <> "" then mime_type
+  else "application/binary" in
+  add_reply_header r "Content-Type" mime_type;
+  add_reply_header r "Accept-Ranges" "bytes"
+
 let http_send_bin r buf filename =
   let file_to_send = File.to_string filename in
   let clen = String.length file_to_send in
@@ -1351,9 +1413,13 @@
                           (Int64.to_string size);
                         zero, size
                   in
-
-                  add_reply_header r "Content-type" "application/binary";
-                  add_reply_header r "Accept-Ranges" "bytes";
+		    
+		  let filename = file_best_name file in
+		  let exten = Filename2.last_extension filename in
+		  let len = String.length exten in
+		  let exten = if len = 0 then exten
+		      else String.lowercase (String.sub exten 1 (len - 1)) in
+		  http_add_bin_stream_header r (extension_to_file_ext exten);
 
                   let s = String.create 200000 in
                   set_max_output_buffer r.sock (String.length s);
@@ -1441,7 +1507,10 @@
     | BIN -> Buffer.contents buf
     | UNK -> "Unknown type for content :" ^ (Buffer.contents buf)
   in
-  r.reply_content <- if !!html_use_gzip then Autoconf.zlib__gzip_string s else s
+  r.reply_content <- 
+    if !http_file_type <> BIN && !!html_use_gzip then 
+      Autoconf.zlib__gzip_string s 
+    else s
 
 let http_options = {
     conn_buf = Buffer.create 10000;
