hgweb_mod: respond right away if the client specified 100-continue support
authorAugie Fackler <durin42@gmail.com>
Fri, 07 Jan 2011 15:19:21 -0600
changeset 13571 84bd3fd63afc
parent 13570 617a87cb7eb2
child 13572 1bb2a56a9d73
hgweb_mod: respond right away if the client specified 100-continue support Clients that send 100-continue should make sure they really support continue intelligently. In a later patch we'll introduce a capability so new clients don't pay a performance penalty talking to old servers.
mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Sat Feb 06 04:27:28 2010 -0600
+++ b/mercurial/hgweb/hgweb_mod.py	Fri Jan 07 15:19:21 2011 -0600
@@ -121,7 +121,11 @@
                     self.check_perm(req, perms[cmd])
                 return protocol.call(self.repo, req, cmd)
             except ErrorResponse, inst:
-                if cmd == 'unbundle':
+                # A client that sends unbundle without 100-continue will
+                # break if we respond early.
+                if (cmd == 'unbundle' and
+                    req.env.get('HTTP_EXPECT',
+                                '').lower() != '100-continue'):
                     req.drain()
                 req.respond(inst, protocol.HGTYPE)
                 return '0\n%s\n' % inst.message