Fix static file serving over HTTP on Windows.
authorWojciech Milkowski <wmilkowski@interia.pl>
Wed, 04 Oct 2006 18:06:03 +0200
changeset 3244 f045b049a704
parent 3243 1d3aceae87c1
child 3245 3bdeca8946a6
Fix static file serving over HTTP on Windows. Files to be served should be opened in binary mode.
mercurial/hgweb/common.py
--- a/mercurial/hgweb/common.py
+++ b/mercurial/hgweb/common.py
@@ -38,7 +38,7 @@ def staticfile(directory, fname, req):
         ct = mimetypes.guess_type(path)[0] or "text/plain"
         req.header([('Content-type', ct),
                     ('Content-length', os.path.getsize(path))])
-        return file(path).read()
+        return file(path, 'rb').read()
     except (TypeError, OSError):
         # illegal fname or unreadable file
         return ""