changeset 26211:ea489d94e1dc

hgweb: assign ctype to requestcontext The very existence of ctype is a bit hacky. But we roll with it. Before this patch, there was possibly a race condition between 2 threads handling file requests: 1 thread could set the ctype and another serving a different file would read and use that potentially wrong ctype.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 22 Aug 2015 17:08:37 -0700
parents 7c759f1a056f
children 0d8df1f510c6
files mercurial/hgweb/hgweb_mod.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Sat Aug 22 17:04:24 2015 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Sat Aug 22 17:08:37 2015 -0700
@@ -398,7 +398,8 @@
                 msg = 'no such method: %s' % cmd
                 raise ErrorResponse(HTTP_BAD_REQUEST, msg)
             elif cmd == 'file' and 'raw' in req.form.get('style', []):
-                self.ctype = ctype
+                # TODO convert to regular assignment once app proxy is removed.
+                object.__setattr__(rctx, 'ctype', ctype)
                 content = webcommands.rawfile(rctx, req, tmpl)
             else:
                 content = getattr(webcommands, cmd)(rctx, req, tmpl)