mercurial/wireprotoserver.py
changeset 36642 6e585bca962e
parent 36639 af0d38f015bb
child 36736 2442927cdd96
equal deleted inserted replaced
36641:e89959970a08 36642:6e585bca962e
   118     def client(self):
   118     def client(self):
   119         return 'remote:%s:%s:%s' % (
   119         return 'remote:%s:%s:%s' % (
   120             self._req.env.get('wsgi.url_scheme') or 'http',
   120             self._req.env.get('wsgi.url_scheme') or 'http',
   121             urlreq.quote(self._req.env.get('REMOTE_HOST', '')),
   121             urlreq.quote(self._req.env.get('REMOTE_HOST', '')),
   122             urlreq.quote(self._req.env.get('REMOTE_USER', '')))
   122             urlreq.quote(self._req.env.get('REMOTE_USER', '')))
       
   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
   123 
   141 
   124 # This method exists mostly so that extensions like remotefilelog can
   142 # This method exists mostly so that extensions like remotefilelog can
   125 # disable a kludgey legacy method only over http. As of early 2018,
   143 # disable a kludgey legacy method only over http. As of early 2018,
   126 # there are no other known users, so with any luck we can discard this
   144 # there are no other known users, so with any luck we can discard this
   127 # hook if remotefilelog becomes a first-party extension.
   145 # hook if remotefilelog becomes a first-party extension.
   366 
   384 
   367     def client(self):
   385     def client(self):
   368         client = encoding.environ.get('SSH_CLIENT', '').split(' ', 1)[0]
   386         client = encoding.environ.get('SSH_CLIENT', '').split(' ', 1)[0]
   369         return 'remote:ssh:' + client
   387         return 'remote:ssh:' + client
   370 
   388 
       
   389     def addcapabilities(self, repo, caps):
       
   390         return caps
       
   391 
   371 class sshv2protocolhandler(sshv1protocolhandler):
   392 class sshv2protocolhandler(sshv1protocolhandler):
   372     """Protocol handler for version 2 of the SSH protocol."""
   393     """Protocol handler for version 2 of the SSH protocol."""
   373 
   394 
   374     @property
   395     @property
   375     def name(self):
   396     def name(self):