Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/common.py @ 3244:f045b049a704
Fix static file serving over HTTP on Windows.
Files to be served should be opened in binary mode.
author | Wojciech Milkowski <wmilkowski@interia.pl> |
---|---|
date | Wed, 04 Oct 2006 18:06:03 +0200 |
parents | 345bac2bc4ec |
children | db9d2a624521 |
comparison
equal
deleted
inserted
replaced
3243:1d3aceae87c1 | 3244:f045b049a704 |
---|---|
36 try: | 36 try: |
37 os.stat(path) | 37 os.stat(path) |
38 ct = mimetypes.guess_type(path)[0] or "text/plain" | 38 ct = mimetypes.guess_type(path)[0] or "text/plain" |
39 req.header([('Content-type', ct), | 39 req.header([('Content-type', ct), |
40 ('Content-length', os.path.getsize(path))]) | 40 ('Content-length', os.path.getsize(path))]) |
41 return file(path).read() | 41 return file(path, 'rb').read() |
42 except (TypeError, OSError): | 42 except (TypeError, OSError): |
43 # illegal fname or unreadable file | 43 # illegal fname or unreadable file |
44 return "" | 44 return "" |