# HG changeset patch # User Gregory Szorc # Date 1440288517 25200 # Node ID ea489d94e1dc1fc3dc1dcbef1c86c18c49605ed1 # Parent 7c759f1a056fc81fc5d0c9c29cc6a56c41d4696a 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. diff -r 7c759f1a056f -r ea489d94e1dc mercurial/hgweb/hgweb_mod.py --- 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)