mercurial/wireprotoserver.py
changeset 36536 3cd245945ef3
parent 36526 7cc4a9b9732a
child 36610 af0d38f015bb
equal deleted inserted replaced
36535:1c16324fdf05 36536:3cd245945ef3
    31 
    31 
    32 HGTYPE = 'application/mercurial-0.1'
    32 HGTYPE = 'application/mercurial-0.1'
    33 HGTYPE2 = 'application/mercurial-0.2'
    33 HGTYPE2 = 'application/mercurial-0.2'
    34 HGERRTYPE = 'application/hg-error'
    34 HGERRTYPE = 'application/hg-error'
    35 
    35 
    36 # Names of the SSH protocol implementations.
    36 SSHV1 = wireprototypes.SSHV1
    37 SSHV1 = 'ssh-v1'
    37 SSHV2 = wireprototypes.SSHV2
    38 # This is advertised over the wire. Incremental the counter at the end
       
    39 # to reflect BC breakages.
       
    40 SSHV2 = 'exp-ssh-v2-0001'
       
    41 
    38 
    42 def decodevaluefromheaders(req, headerprefix):
    39 def decodevaluefromheaders(req, headerprefix):
    43     """Decode a long value from multiple HTTP request headers.
    40     """Decode a long value from multiple HTTP request headers.
    44 
    41 
    45     Returns the value as a bytes, not a str.
    42     Returns the value as a bytes, not a str.
   322         self._fin = fin
   319         self._fin = fin
   323         self._fout = fout
   320         self._fout = fout
   324 
   321 
   325     @property
   322     @property
   326     def name(self):
   323     def name(self):
   327         return SSHV1
   324         return wireprototypes.SSHV1
   328 
   325 
   329     def getargs(self, args):
   326     def getargs(self, args):
   330         data = {}
   327         data = {}
   331         keys = args.split()
   328         keys = args.split()
   332         for n in xrange(len(keys)):
   329         for n in xrange(len(keys)):
   490 
   487 
   491         elif state == 'upgrade-initial':
   488         elif state == 'upgrade-initial':
   492             # We should never transition into this state if we've switched
   489             # We should never transition into this state if we've switched
   493             # protocols.
   490             # protocols.
   494             assert not protoswitched
   491             assert not protoswitched
   495             assert proto.name == SSHV1
   492             assert proto.name == wireprototypes.SSHV1
   496 
   493 
   497             # Expected: upgrade <token> <capabilities>
   494             # Expected: upgrade <token> <capabilities>
   498             # If we get something else, the request is malformed. It could be
   495             # If we get something else, the request is malformed. It could be
   499             # from a future client that has altered the upgrade line content.
   496             # from a future client that has altered the upgrade line content.
   500             # We treat this as an unknown command.
   497             # We treat this as an unknown command.