##// END OF EJS Templates
wireproto: turn client capabilities into sets, sorted on the wire...
Joerg Sonnenberger -
r37429:3e168871 default
parent child Browse files
Show More
@@ -282,17 +282,17 b' class httppeer(wireproto.wirepeer):'
282 # Tell the server we accept application/mercurial-0.2 and multiple
282 # Tell the server we accept application/mercurial-0.2 and multiple
283 # compression formats if the server is capable of emitting those
283 # compression formats if the server is capable of emitting those
284 # payloads.
284 # payloads.
285 protoparams = []
285 protoparams = set()
286
286
287 mediatypes = set()
287 mediatypes = set()
288 if self._caps is not None:
288 if self._caps is not None:
289 mt = self.capable('httpmediatype')
289 mt = self.capable('httpmediatype')
290 if mt:
290 if mt:
291 protoparams.append('0.1')
291 protoparams.add('0.1')
292 mediatypes = set(mt.split(','))
292 mediatypes = set(mt.split(','))
293
293
294 if '0.2tx' in mediatypes:
294 if '0.2tx' in mediatypes:
295 protoparams.append('0.2')
295 protoparams.add('0.2')
296
296
297 if '0.2tx' in mediatypes and self.capable('compression'):
297 if '0.2tx' in mediatypes and self.capable('compression'):
298 # We /could/ compare supported compression formats and prune
298 # We /could/ compare supported compression formats and prune
@@ -300,10 +300,10 b' class httppeer(wireproto.wirepeer):'
300 # For now, send the full list to the server and have it error.
300 # For now, send the full list to the server and have it error.
301 comps = [e.wireprotosupport().name for e in
301 comps = [e.wireprotosupport().name for e in
302 util.compengines.supportedwireengines(util.CLIENTROLE)]
302 util.compengines.supportedwireengines(util.CLIENTROLE)]
303 protoparams.append('comp=%s' % ','.join(comps))
303 protoparams.add('comp=%s' % ','.join(comps))
304
304
305 if protoparams:
305 if protoparams:
306 protoheaders = encodevalueinheaders(' '.join(protoparams),
306 protoheaders = encodevalueinheaders(' '.join(sorted(protoparams)),
307 'X-HgProto',
307 'X-HgProto',
308 headersize or 1024)
308 headersize or 1024)
309 for header, value in protoheaders:
309 for header, value in protoheaders:
@@ -168,10 +168,10 b' def _clientcapabilities():'
168
168
169 Returns a list of capabilities that are supported by this client.
169 Returns a list of capabilities that are supported by this client.
170 """
170 """
171 protoparams = []
171 protoparams = set()
172 comps = [e.wireprotosupport().name for e in
172 comps = [e.wireprotosupport().name for e in
173 util.compengines.supportedwireengines(util.CLIENTROLE)]
173 util.compengines.supportedwireengines(util.CLIENTROLE)]
174 protoparams.append('comp=%s' % ','.join(comps))
174 protoparams.add('comp=%s' % ','.join(comps))
175 return protoparams
175 return protoparams
176
176
177 def _performhandshake(ui, stdin, stdout, stderr):
177 def _performhandshake(ui, stdin, stdout, stderr):
@@ -626,7 +626,8 b' def instance(ui, path, create):'
626 # capabilities.
626 # capabilities.
627 if 'protocaps' in peer.capabilities():
627 if 'protocaps' in peer.capabilities():
628 try:
628 try:
629 peer._call("protocaps", caps=' '.join(_clientcapabilities()))
629 peer._call("protocaps",
630 caps=' '.join(sorted(_clientcapabilities())))
630 except IOError:
631 except IOError:
631 peer._cleanup()
632 peer._cleanup()
632 raise error.RepoError(_('capability exchange failed'))
633 raise error.RepoError(_('capability exchange failed'))
General Comments 0
You need to be logged in to leave comments. Login now