mod_httpserver: Read files in binary mode; fixes issues with serving binary files.

Thu, 10 Dec 2009 16:27:17 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Thu, 10 Dec 2009 16:27:17 +0500
changeset 2358
e05934a5c911
parent 2357
d978e2ae7013
child 2359
0bed4af40bff

mod_httpserver: Read files in binary mode; fixes issues with serving binary files.

plugins/mod_httpserver.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_httpserver.lua	Thu Dec 10 16:25:50 2009 +0500
+++ b/plugins/mod_httpserver.lua	Thu Dec 10 16:27:17 2009 +0500
@@ -47,7 +47,7 @@
 end
 
 function serve_file(path)
-	local f, err = open(http_base..path, "r");
+	local f, err = open(http_base..path, "rb");
 	if not f then return response_404; end
 	local data = f:read("*a");
 	f:close();

mercurial