Patchwork D2738: hgweb: only recognize wire protocol commands from query string (BC)

login
register
mail settings
Submitter phabricator
Date March 9, 2018, 7:29 p.m.
Message ID <9d77542309b30bfba7d74b6acc2462cc@localhost.localdomain>
Download mbox | patch
Permalink /patch/29194/
State Not Applicable
Headers show

Comments

phabricator - March 9, 2018, 7:29 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGad13301e6479: hgweb: only recognize wire protocol commands from query string (BC) (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2738?vs=6744&id=6782

REVISION DETAIL
  https://phab.mercurial-scm.org/D2738

AFFECTED FILES
  mercurial/hgweb/hgweb_mod.py
  mercurial/wireprotoserver.py

CHANGE DETAILS




To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py
--- a/mercurial/wireprotoserver.py
+++ b/mercurial/wireprotoserver.py
@@ -150,25 +150,26 @@ 
 def iscmd(cmd):
     return cmd in wireproto.commands
 
-def parsehttprequest(rctx, wsgireq, query, checkperm):
+def parsehttprequest(rctx, wsgireq, req, checkperm):
     """Parse the HTTP request for a wire protocol request.
 
     If the current request appears to be a wire protocol request, this
     function returns a dict with details about that request, including
     an ``abstractprotocolserver`` instance suitable for handling the
     request. Otherwise, ``None`` is returned.
 
     ``wsgireq`` is a ``wsgirequest`` instance.
+    ``req`` is a ``parsedrequest`` instance.
     """
     repo = rctx.repo
 
     # HTTP version 1 wire protocol requests are denoted by a "cmd" query
     # string parameter. If it isn't present, this isn't a wire protocol
     # request.
-    if 'cmd' not in wsgireq.form:
+    if 'cmd' not in req.querystringdict:
         return None
 
-    cmd = wsgireq.form['cmd'][0]
+    cmd = req.querystringdict['cmd'][0]
 
     # The "cmd" request parameter is used by both the wire protocol and hgweb.
     # While not all wire protocol commands are available for all transports,
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
@@ -330,7 +330,7 @@ 
 
         # Route it to a wire protocol handler if it looks like a wire protocol
         # request.
-        protohandler = wireprotoserver.parsehttprequest(rctx, wsgireq, query,
+        protohandler = wireprotoserver.parsehttprequest(rctx, wsgireq, req,
                                                         self.check_perm)
 
         if protohandler: