diff -r eff102facb15 -r 14f3795a5ed7 mercurial/hgweb/common.py --- a/mercurial/hgweb/common.py Fri Feb 11 22:24:10 2011 +0800 +++ b/mercurial/hgweb/common.py Fri Dec 24 15:23:01 2010 +0100 @@ -119,7 +119,10 @@ os.stat(path) ct = mimetypes.guess_type(path)[0] or "text/plain" req.respond(HTTP_OK, ct, length = os.path.getsize(path)) - return open(path, 'rb').read() + fp = open(path, 'rb') + data = fp.read() + fp.close() + return data except TypeError: raise ErrorResponse(HTTP_SERVER_ERROR, 'illegal filename') except OSError, err: