[PATCH 3 of 4 full-series] httprepo: ensure Content-Type header exist when pushing data

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Jul 17 22:27:38 CDT 2012


# HG changeset patch
# User Pierre-Yves.David at ens-lyon.org
# Date 1342178480 -7200
# Node ID 227fb128b2be11ef030856b14390a069c9c4f94b
# Parent  75f5e974a01250f06d5e827f2df8e77f4192b8be
httprepo: ensure Content-Type header exist when pushing data

Otherwise the wireprotocol just hang while trying to send data. (And nothing is
received at the other side)

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -79,6 +79,9 @@
         elif data is not None:
             size = len(data)
         headers = args.pop('headers', {})
+        if data is not None and 'Content-Type' not in headers:
+            headers['Content-Type'] = 'application/mercurial-0.1'
+
 
         if size and self.ui.configbool('ui', 'usehttp2', False):
             headers['Expect'] = '100-Continue'


More information about the Mercurial-devel mailing list