diff mercurial/wireproto.py @ 30563:e118233172fe

wireproto: only advertise HTTP-specific capabilities to HTTP peers (BC) Previously, the capabilities list was protocol agnostic and we advertised the same capabilities list to all clients, regardless of transport protocol. A few capabilities are specific to HTTP. I see no good reason why we should advertise them to SSH clients. So this patch limits their advertisement to HTTP clients. This patch is BC, but SSH clients shouldn't be using the removed capabilities so there should be no impact.
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 28 Nov 2016 20:46:42 -0800
parents 39d13b8c101d
children 35b516f800e0
line wrap: on
line diff
--- a/mercurial/wireproto.py	Mon Nov 28 20:46:59 2016 -0800
+++ b/mercurial/wireproto.py	Mon Nov 28 20:46:42 2016 -0800
@@ -716,10 +716,13 @@
         capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo))
         caps.append('bundle2=' + urlreq.quote(capsblob))
     caps.append('unbundle=%s' % ','.join(bundle2.bundlepriority))
-    caps.append(
-        'httpheader=%d' % repo.ui.configint('server', 'maxhttpheaderlen', 1024))
-    if repo.ui.configbool('experimental', 'httppostargs', False):
-        caps.append('httppostargs')
+
+    if proto.name == 'http':
+        caps.append('httpheader=%d' %
+                    repo.ui.configint('server', 'maxhttpheaderlen', 1024))
+        if repo.ui.configbool('experimental', 'httppostargs', False):
+            caps.append('httppostargs')
+
     return caps
 
 # If you are writing an extension and consider wrapping this function. Wrap