mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
protocol: command must be checked before passing in
This commit is contained in:
parent
2b7f042140
commit
1a4105fea1
@ -67,5 +67,5 @@ def iscmd(cmd):
|
||||
|
||||
def call(repo, req, cmd):
|
||||
p = webproto(req)
|
||||
r = wireproto.dispatch(repo, p, cmd)
|
||||
wireproto.dispatch(repo, p, cmd)
|
||||
yield p.response
|
||||
|
@ -93,7 +93,9 @@ class sshserver(object):
|
||||
|
||||
def serve_one(self):
|
||||
cmd = self.fin.readline()[:-1]
|
||||
if cmd and not wireproto.dispatch(self.repo, self, cmd):
|
||||
if cmd and cmd in wireproto.commands:
|
||||
wireproto.dispatch(self.repo, self, cmd)
|
||||
elif cmd:
|
||||
impl = getattr(self, 'do_' + cmd, None)
|
||||
if impl:
|
||||
r = impl()
|
||||
|
@ -134,14 +134,11 @@ class wirerepository(repo.repository):
|
||||
# server side
|
||||
|
||||
def dispatch(repo, proto, command):
|
||||
if command not in commands:
|
||||
return False
|
||||
func, spec = commands[command]
|
||||
args = proto.getargs(spec)
|
||||
r = func(repo, proto, *args)
|
||||
if r != None:
|
||||
proto.respond(r)
|
||||
return True
|
||||
|
||||
def between(repo, proto, pairs):
|
||||
pairs = [decodelist(p, '-') for p in pairs.split(" ")]
|
||||
|
Loading…
Reference in New Issue
Block a user