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.
--- 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)