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 ://. @@ -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, 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()