D2738: hgweb: only recognize wire protocol commands from query string (BC)
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Fri Mar 9 14:29:58 EST 2018
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
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:
To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list