comparison mercurial/wireprotoserver.py @ 36849:0bc771bba220

wireprotoserver: remove unused argument from _handlehttperror() Differential Revision: https://phab.mercurial-scm.org/D2746
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 08 Mar 2018 17:17:48 -0800
parents 16292bbda39c
children d6cd1451212e
comparison
equal deleted inserted replaced
36848:16292bbda39c 36849:0bc771bba220
190 # like ``/blah?cmd=foo`` are not allowed. So don't recognize the request 190 # like ``/blah?cmd=foo`` are not allowed. So don't recognize the request
191 # in this case. We send an HTTP 404 for backwards compatibility reasons. 191 # in this case. We send an HTTP 404 for backwards compatibility reasons.
192 if req.dispatchpath: 192 if req.dispatchpath:
193 res = _handlehttperror( 193 res = _handlehttperror(
194 hgwebcommon.ErrorResponse(hgwebcommon.HTTP_NOT_FOUND), wsgireq, 194 hgwebcommon.ErrorResponse(hgwebcommon.HTTP_NOT_FOUND), wsgireq,
195 req, cmd) 195 req)
196 196
197 return True, res 197 return True, res
198 198
199 proto = httpv1protocolhandler(wsgireq, req, repo.ui, 199 proto = httpv1protocolhandler(wsgireq, req, repo.ui,
200 lambda perm: checkperm(rctx, wsgireq, perm)) 200 lambda perm: checkperm(rctx, wsgireq, perm))
204 # exception here. So consider refactoring into a exception type that 204 # exception here. So consider refactoring into a exception type that
205 # is associated with the wire protocol. 205 # is associated with the wire protocol.
206 try: 206 try:
207 res = _callhttp(repo, wsgireq, req, proto, cmd) 207 res = _callhttp(repo, wsgireq, req, proto, cmd)
208 except hgwebcommon.ErrorResponse as e: 208 except hgwebcommon.ErrorResponse as e:
209 res = _handlehttperror(e, wsgireq, req, cmd) 209 res = _handlehttperror(e, wsgireq, req)
210 210
211 return True, res 211 return True, res
212 212
213 def _httpresponsetype(ui, req, prefer_uncompressed): 213 def _httpresponsetype(ui, req, prefer_uncompressed):
214 """Determine the appropriate response type and compression settings. 214 """Determine the appropriate response type and compression settings.
311 rsp = rsp.message 311 rsp = rsp.message
312 wsgireq.respond(HTTP_OK, HGERRTYPE, body=rsp) 312 wsgireq.respond(HTTP_OK, HGERRTYPE, body=rsp)
313 return [] 313 return []
314 raise error.ProgrammingError('hgweb.protocol internal failure', rsp) 314 raise error.ProgrammingError('hgweb.protocol internal failure', rsp)
315 315
316 def _handlehttperror(e, wsgireq, req, cmd): 316 def _handlehttperror(e, wsgireq, req):
317 """Called when an ErrorResponse is raised during HTTP request processing.""" 317 """Called when an ErrorResponse is raised during HTTP request processing."""
318 318
319 # Clients using Python's httplib are stateful: the HTTP client 319 # Clients using Python's httplib are stateful: the HTTP client
320 # won't process an HTTP response until all request data is 320 # won't process an HTTP response until all request data is
321 # sent to the server. The intent of this code is to ensure 321 # sent to the server. The intent of this code is to ensure