Patchwork [4,of,5,hgweb-thread-isolation] hgweb: don't access self.repo during request processing

login
register
mail settings
Submitter Gregory Szorc
Date Sept. 3, 2015, 11:16 p.m.
Message ID <7d9878e5f7ad2d36bf50.1441322179@gps-mbp.local>
Download mbox | patch
Permalink /patch/10390/
State Superseded
Commit 7917746c9a670349808400b35fe6e6fafe622d71
Headers show

Comments

Gregory Szorc - Sept. 3, 2015, 11:16 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1440287692 25200
#      Sat Aug 22 16:54:52 2015 -0700
# Node ID 7d9878e5f7ad2d36bf5099a73955a46e5ead694b
# Parent  a8cb273c131b506667b26114d31eb4f5d7fc0680
hgweb: don't access self.repo during request processing

We want all repository accesses to go through requestcontext.repo
so the request is isolated from the application.

Patch

diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -322,9 +322,9 @@  class hgweb(object):
                 if query:
                     raise ErrorResponse(HTTP_NOT_FOUND)
                 if cmd in perms:
                     self.check_perm(rctx, req, perms[cmd])
-                return protocol.call(self.repo, req, cmd)
+                return protocol.call(rctx.repo, req, cmd)
             except ErrorResponse as inst:
                 # A client that sends unbundle without 100-continue will
                 # break if we respond early.
                 if (cmd == 'unbundle' and