Show More
@@ -369,18 +369,7 b' class hgweb(object):' | |||
|
369 | 369 | if cmd in perms: |
|
370 | 370 | self.check_perm(rctx, req, perms[cmd]) |
|
371 | 371 | except ErrorResponse as inst: |
|
372 | # A client that sends unbundle without 100-continue will | |
|
373 | # break if we respond early. | |
|
374 | if (cmd == 'unbundle' and | |
|
375 | (req.env.get('HTTP_EXPECT', | |
|
376 | '').lower() != '100-continue') or | |
|
377 | req.env.get('X-HgHttp2', '')): | |
|
378 | req.drain() | |
|
379 | else: | |
|
380 | req.headers.append((r'Connection', r'Close')) | |
|
381 | req.respond(inst, wireprotoserver.HGTYPE, | |
|
382 | body='0\n%s\n' % inst) | |
|
383 | return '' | |
|
372 | return protohandler['handleerror'](inst) | |
|
384 | 373 | |
|
385 | 374 | return protohandler['dispatch']() |
|
386 | 375 |
@@ -242,6 +242,7 b' def parsehttprequest(repo, req, query):' | |||
|
242 | 242 | 'cmd': cmd, |
|
243 | 243 | 'proto': proto, |
|
244 | 244 | 'dispatch': lambda: _callhttp(repo, req, proto, cmd), |
|
245 | 'handleerror': lambda ex: _handlehttperror(ex, req, cmd), | |
|
245 | 246 | } |
|
246 | 247 | |
|
247 | 248 | def _callhttp(repo, req, proto, cmd): |
@@ -303,6 +304,22 b' def _callhttp(repo, req, proto, cmd):' | |||
|
303 | 304 | return [] |
|
304 | 305 | raise error.ProgrammingError('hgweb.protocol internal failure', rsp) |
|
305 | 306 | |
|
307 | def _handlehttperror(e, req, cmd): | |
|
308 | """Called when an ErrorResponse is raised during HTTP request processing.""" | |
|
309 | # A client that sends unbundle without 100-continue will | |
|
310 | # break if we respond early. | |
|
311 | if (cmd == 'unbundle' and | |
|
312 | (req.env.get('HTTP_EXPECT', | |
|
313 | '').lower() != '100-continue') or | |
|
314 | req.env.get('X-HgHttp2', '')): | |
|
315 | req.drain() | |
|
316 | else: | |
|
317 | req.headers.append((r'Connection', r'Close')) | |
|
318 | ||
|
319 | req.respond(e, HGTYPE, body='0\n%s\n' % e) | |
|
320 | ||
|
321 | return '' | |
|
322 | ||
|
306 | 323 | class sshserver(abstractserverproto): |
|
307 | 324 | def __init__(self, ui, repo): |
|
308 | 325 | self._ui = ui |
General Comments 0
You need to be logged in to leave comments.
Login now