Show More
@@ -819,23 +819,7 b' def _capabilities(repo, proto):' | |||
|
819 | 819 | caps.append('bundle2=' + urlreq.quote(capsblob)) |
|
820 | 820 | caps.append('unbundle=%s' % ','.join(bundle2.bundlepriority)) |
|
821 | 821 | |
|
822 | if proto.name == 'http-v1': | |
|
823 | caps.append('httpheader=%d' % | |
|
824 | repo.ui.configint('server', 'maxhttpheaderlen')) | |
|
825 | if repo.ui.configbool('experimental', 'httppostargs'): | |
|
826 | caps.append('httppostargs') | |
|
827 | ||
|
828 | # FUTURE advertise 0.2rx once support is implemented | |
|
829 | # FUTURE advertise minrx and mintx after consulting config option | |
|
830 | caps.append('httpmediatype=0.1rx,0.1tx,0.2tx') | |
|
831 | ||
|
832 | compengines = supportedcompengines(repo.ui, util.SERVERROLE) | |
|
833 | if compengines: | |
|
834 | comptypes = ','.join(urlreq.quote(e.wireprotosupport().name) | |
|
835 | for e in compengines) | |
|
836 | caps.append('compression=%s' % comptypes) | |
|
837 | ||
|
838 | return caps | |
|
822 | return proto.addcapabilities(repo, caps) | |
|
839 | 823 | |
|
840 | 824 | # If you are writing an extension and consider wrapping this function. Wrap |
|
841 | 825 | # `_capabilities` instead. |
@@ -121,6 +121,24 b' class httpv1protocolhandler(wireprototyp' | |||
|
121 | 121 | urlreq.quote(self._req.env.get('REMOTE_HOST', '')), |
|
122 | 122 | urlreq.quote(self._req.env.get('REMOTE_USER', ''))) |
|
123 | 123 | |
|
124 | def addcapabilities(self, repo, caps): | |
|
125 | caps.append('httpheader=%d' % | |
|
126 | repo.ui.configint('server', 'maxhttpheaderlen')) | |
|
127 | if repo.ui.configbool('experimental', 'httppostargs'): | |
|
128 | caps.append('httppostargs') | |
|
129 | ||
|
130 | # FUTURE advertise 0.2rx once support is implemented | |
|
131 | # FUTURE advertise minrx and mintx after consulting config option | |
|
132 | caps.append('httpmediatype=0.1rx,0.1tx,0.2tx') | |
|
133 | ||
|
134 | compengines = wireproto.supportedcompengines(repo.ui, util.SERVERROLE) | |
|
135 | if compengines: | |
|
136 | comptypes = ','.join(urlreq.quote(e.wireprotosupport().name) | |
|
137 | for e in compengines) | |
|
138 | caps.append('compression=%s' % comptypes) | |
|
139 | ||
|
140 | return caps | |
|
141 | ||
|
124 | 142 | # This method exists mostly so that extensions like remotefilelog can |
|
125 | 143 | # disable a kludgey legacy method only over http. As of early 2018, |
|
126 | 144 | # there are no other known users, so with any luck we can discard this |
@@ -368,6 +386,9 b' class sshv1protocolhandler(wireprototype' | |||
|
368 | 386 | client = encoding.environ.get('SSH_CLIENT', '').split(' ', 1)[0] |
|
369 | 387 | return 'remote:ssh:' + client |
|
370 | 388 | |
|
389 | def addcapabilities(self, repo, caps): | |
|
390 | return caps | |
|
391 | ||
|
371 | 392 | class sshv2protocolhandler(sshv1protocolhandler): |
|
372 | 393 | """Protocol handler for version 2 of the SSH protocol.""" |
|
373 | 394 |
@@ -137,3 +137,12 b' class baseprotocolhandler(object):' | |||
|
137 | 137 | @abc.abstractmethod |
|
138 | 138 | def client(self): |
|
139 | 139 | """Returns a string representation of this client (as bytes).""" |
|
140 | ||
|
141 | @abc.abstractmethod | |
|
142 | def addcapabilities(self, repo, caps): | |
|
143 | """Adds advertised capabilities specific to this protocol. | |
|
144 | ||
|
145 | Receives the list of capabilities collected so far. | |
|
146 | ||
|
147 | Returns a list of capabilities. The passed in argument can be returned. | |
|
148 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now