D2745: hgweb: store and use request method on parsed request
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Mon Mar 12 17:32:11 EDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG16292bbda39c: hgweb: store and use request method on parsed request (authored by indygreg, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D2745?vs=6825&id=6900
REVISION DETAIL
https://phab.mercurial-scm.org/D2745
AFFECTED FILES
mercurial/hgweb/request.py
mercurial/wireprotoserver.py
CHANGE DETAILS
diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py
--- a/mercurial/wireprotoserver.py
+++ b/mercurial/wireprotoserver.py
@@ -324,7 +324,7 @@
# the HTTP response. In other words, it helps prevent deadlocks
# on clients using httplib.
- if (wsgireq.env[r'REQUEST_METHOD'] == r'POST' and
+ if (req.method == 'POST' and
# But not if Expect: 100-continue is being used.
(req.headers.get('Expect', '').lower() != '100-continue')):
wsgireq.drain()
diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py
--- a/mercurial/hgweb/request.py
+++ b/mercurial/hgweb/request.py
@@ -63,6 +63,8 @@
class parsedrequest(object):
"""Represents a parsed WSGI request / static HTTP request parameters."""
+ # Request method.
+ method = attr.ib()
# Full URL for this request.
url = attr.ib()
# URL without any path components. Just <proto>://<host><port>.
@@ -207,7 +209,8 @@
if 'CONTENT_LENGTH' in env and 'HTTP_CONTENT_LENGTH' not in env:
headers['Content-Length'] = env['CONTENT_LENGTH']
- return parsedrequest(url=fullurl, baseurl=baseurl,
+ return parsedrequest(method=env['REQUEST_METHOD'],
+ url=fullurl, baseurl=baseurl,
advertisedurl=advertisedfullurl,
advertisedbaseurl=advertisedbaseurl,
apppath=apppath,
To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list