##// END OF EJS Templates
hgweb: store and use request method on parsed request...
Gregory Szorc -
r36864:16292bbd default
parent child Browse files
Show More
@@ -63,6 +63,8 b' def normalize(form):'
63 class parsedrequest(object):
63 class parsedrequest(object):
64 """Represents a parsed WSGI request / static HTTP request parameters."""
64 """Represents a parsed WSGI request / static HTTP request parameters."""
65
65
66 # Request method.
67 method = attr.ib()
66 # Full URL for this request.
68 # Full URL for this request.
67 url = attr.ib()
69 url = attr.ib()
68 # URL without any path components. Just <proto>://<host><port>.
70 # URL without any path components. Just <proto>://<host><port>.
@@ -207,7 +209,8 b' def parserequestfromenv(env):'
207 if 'CONTENT_LENGTH' in env and 'HTTP_CONTENT_LENGTH' not in env:
209 if 'CONTENT_LENGTH' in env and 'HTTP_CONTENT_LENGTH' not in env:
208 headers['Content-Length'] = env['CONTENT_LENGTH']
210 headers['Content-Length'] = env['CONTENT_LENGTH']
209
211
210 return parsedrequest(url=fullurl, baseurl=baseurl,
212 return parsedrequest(method=env['REQUEST_METHOD'],
213 url=fullurl, baseurl=baseurl,
211 advertisedurl=advertisedfullurl,
214 advertisedurl=advertisedfullurl,
212 advertisedbaseurl=advertisedbaseurl,
215 advertisedbaseurl=advertisedbaseurl,
213 apppath=apppath,
216 apppath=apppath,
@@ -324,7 +324,7 b' def _handlehttperror(e, wsgireq, req, cm'
324 # the HTTP response. In other words, it helps prevent deadlocks
324 # the HTTP response. In other words, it helps prevent deadlocks
325 # on clients using httplib.
325 # on clients using httplib.
326
326
327 if (wsgireq.env[r'REQUEST_METHOD'] == r'POST' and
327 if (req.method == 'POST' and
328 # But not if Expect: 100-continue is being used.
328 # But not if Expect: 100-continue is being used.
329 (req.headers.get('Expect', '').lower() != '100-continue')):
329 (req.headers.get('Expect', '').lower() != '100-continue')):
330 wsgireq.drain()
330 wsgireq.drain()
General Comments 0
You need to be logged in to leave comments. Login now