Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/common.py @ 5930:c301f15c965a
send conservatively capitalized HTTP headers
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Wed, 23 Jan 2008 14:28:25 +0100 |
parents | e9f68860d5ed |
children | 948a41e77902 |
line wrap: on
line diff
--- a/mercurial/hgweb/common.py Wed Jan 16 19:14:54 2008 +0330 +++ b/mercurial/hgweb/common.py Wed Jan 23 14:28:25 2008 +0100 @@ -36,11 +36,11 @@ return os.stat(store_path).st_mtime def staticfile(directory, fname, req): - """return a file inside directory with guessed content-type header + """return a file inside directory with guessed Content-Type header fname always uses '/' as directory separator and isn't allowed to contain unusual path components. - Content-type is guessed using the mimetypes module. + Content-Type is guessed using the mimetypes module. Return an empty string if fname is illegal or file not found. """ @@ -54,8 +54,10 @@ try: os.stat(path) ct = mimetypes.guess_type(path)[0] or "text/plain" - req.header([('Content-type', ct), - ('Content-length', str(os.path.getsize(path)))]) + req.header([ + ('Content-Type', ct), + ('Content-Length', str(os.path.getsize(path))) + ]) return file(path, 'rb').read() except TypeError: raise ErrorResponse(500, 'illegal file name')