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