Mercurial > public > mercurial-scm > hg
comparison mercurial/httppeer.py @ 37556:b77aa48ba690
httppeer: only advertise partial-pull if capabilities are known
We don't need to be advertising client protocol parameters as part
of the capabilities request during the handshake because nothing in
version 1 of the wire protocol will use this data. i.e. the
advertisement is wasteful.
Differential Revision: https://phab.mercurial-scm.org/D3241
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 10 Apr 2018 18:13:28 -0700 |
parents | 930c433eb311 |
children | 8a73132214a3 |
comparison
equal
deleted
inserted
replaced
37555:930c433eb311 | 37556:b77aa48ba690 |
---|---|
208 headers[r'Content-Type'] = r'application/mercurial-0.1' | 208 headers[r'Content-Type'] = r'application/mercurial-0.1' |
209 | 209 |
210 # Tell the server we accept application/mercurial-0.2 and multiple | 210 # Tell the server we accept application/mercurial-0.2 and multiple |
211 # compression formats if the server is capable of emitting those | 211 # compression formats if the server is capable of emitting those |
212 # payloads. | 212 # payloads. |
213 protoparams = {'partial-pull'} | 213 # Note: Keep this set empty by default, as client advertisement of |
214 # protocol parameters should only occur after the handshake. | |
215 protoparams = set() | |
214 | 216 |
215 mediatypes = set() | 217 mediatypes = set() |
216 if caps is not None: | 218 if caps is not None: |
217 mt = capablefn('httpmediatype') | 219 mt = capablefn('httpmediatype') |
218 if mt: | 220 if mt: |
219 protoparams.add('0.1') | 221 protoparams.add('0.1') |
220 mediatypes = set(mt.split(',')) | 222 mediatypes = set(mt.split(',')) |
223 | |
224 protoparams.add('partial-pull') | |
221 | 225 |
222 if '0.2tx' in mediatypes: | 226 if '0.2tx' in mediatypes: |
223 protoparams.add('0.2') | 227 protoparams.add('0.2') |
224 | 228 |
225 if '0.2tx' in mediatypes and capablefn('compression'): | 229 if '0.2tx' in mediatypes and capablefn('compression'): |