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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Jul 13 15:30:00 CDT 2012


# HG changeset patch
# User Pierre-Yves.David at ens-lyon.org
# Date 1342178480 -7200
# Node ID 70cfa082522cdaf3ccb942d218c83bd6f28c9bbc
# Parent  f8b96a6ba78380af7f4c22f2b345f7f8b4b19c1e
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 -r f8b96a6ba783 -r 70cfa082522c mercurial/httprepo.py
--- a/mercurial/httprepo.py	Fri Jul 13 22:15:11 2012 +0200
+++ b/mercurial/httprepo.py	Fri Jul 13 13:21:20 2012 +0200
@@ -81,6 +81,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