diff mercurial/httppeer.py @ 50675:60f9602b413e

clonebundles: add support for inline (streaming) clonebundles The idea behind inline clonebundles is to send them through the ssh or https connection to the Mercurial server. We've been using this specifically for streaming clonebundles, although it works for 'regular' clonebundles as well (but is less relevant, since pullbundles exist). We've had this enabled for around 9 months for a part of our users. A few benefits are: - no need to secure an external system, since everything goes through the same Mercurial server - easier scaling (in our case: no risk of inconsistencies between multiple mercurial-server mirrors and nginx clonebundles hosts) Remaining topics/questions right now: - The inline clonebundles don't work for https yet. This is because httppeer doesn't seem to support sending client capabilities. I didn't focus on that as my main goal was to get this working for ssh.
author Mathias De Mare <mathias.de_mare@nokia.com>
date Wed, 08 Mar 2023 14:23:43 +0100
parents b23b3ef38ba1
children 758e40b9a8af d718eddf01d9
line wrap: on
line diff
--- a/mercurial/httppeer.py	Wed May 31 18:08:56 2023 +0100
+++ b/mercurial/httppeer.py	Wed Mar 08 14:23:43 2023 +0100
@@ -441,6 +441,13 @@
     def capabilities(self):
         return self._caps
 
+    def _finish_inline_clone_bundle(self, stream):
+        # HTTP streams must hit the end to process the last empty
+        # chunk of Chunked-Encoding so the connection can be reused.
+        chunk = stream.read(1)
+        if chunk:
+            self._abort(error.ResponseError(_(b"unexpected response:"), chunk))
+
     # End of ipeercommands interface.
 
     def _callstream(self, cmd, _compressible=False, **args):