##// END OF EJS Templates
protocol: command must be checked before passing in
Dirkjan Ochtman -
r11618:83070a9c default
parent child Browse files
Show More
@@ -67,5 +67,5 b' def iscmd(cmd):'
67
67
68 def call(repo, req, cmd):
68 def call(repo, req, cmd):
69 p = webproto(req)
69 p = webproto(req)
70 r = wireproto.dispatch(repo, p, cmd)
70 wireproto.dispatch(repo, p, cmd)
71 yield p.response
71 yield p.response
@@ -93,7 +93,9 b' class sshserver(object):'
93
93
94 def serve_one(self):
94 def serve_one(self):
95 cmd = self.fin.readline()[:-1]
95 cmd = self.fin.readline()[:-1]
96 if cmd and not wireproto.dispatch(self.repo, self, cmd):
96 if cmd and cmd in wireproto.commands:
97 wireproto.dispatch(self.repo, self, cmd)
98 elif cmd:
97 impl = getattr(self, 'do_' + cmd, None)
99 impl = getattr(self, 'do_' + cmd, None)
98 if impl:
100 if impl:
99 r = impl()
101 r = impl()
@@ -134,14 +134,11 b' class wirerepository(repo.repository):'
134 # server side
134 # server side
135
135
136 def dispatch(repo, proto, command):
136 def dispatch(repo, proto, command):
137 if command not in commands:
138 return False
139 func, spec = commands[command]
137 func, spec = commands[command]
140 args = proto.getargs(spec)
138 args = proto.getargs(spec)
141 r = func(repo, proto, *args)
139 r = func(repo, proto, *args)
142 if r != None:
140 if r != None:
143 proto.respond(r)
141 proto.respond(r)
144 return True
145
142
146 def between(repo, proto, pairs):
143 def between(repo, proto, pairs):
147 pairs = [decodelist(p, '-') for p in pairs.split(" ")]
144 pairs = [decodelist(p, '-') for p in pairs.split(" ")]
General Comments 0
You need to be logged in to leave comments. Login now