mercurial/wireprotoserver.py
changeset 36021 5a56bf4180ad
parent 36015 48a3a9283f09
child 36023 cdc93fe1da77
equal deleted inserted replaced
36020:ef683a0fd21f 36021:5a56bf4180ad
   221 
   221 
   222         for chunk in gen:
   222         for chunk in gen:
   223             yield chunk
   223             yield chunk
   224 
   224 
   225     rsp = wireproto.dispatch(repo, proto, cmd)
   225     rsp = wireproto.dispatch(repo, proto, cmd)
       
   226 
       
   227     if not wireproto.commands.commandavailable(cmd, proto):
       
   228         req.respond(HTTP_OK, HGERRTYPE,
       
   229                     body=_('requested wire protocol command is not available '
       
   230                            'over HTTP'))
       
   231         return []
       
   232 
   226     if isinstance(rsp, bytes):
   233     if isinstance(rsp, bytes):
   227         req.respond(HTTP_OK, HGTYPE, body=rsp)
   234         req.respond(HTTP_OK, HGTYPE, body=rsp)
   228         return []
   235         return []
   229     elif isinstance(rsp, wireproto.streamres_legacy):
   236     elif isinstance(rsp, wireproto.streamres_legacy):
   230         gen = rsp.gen
   237         gen = rsp.gen
   349         wireproto.ooberror: _sendooberror,
   356         wireproto.ooberror: _sendooberror,
   350     }
   357     }
   351 
   358 
   352     def serve_one(self):
   359     def serve_one(self):
   353         cmd = self._fin.readline()[:-1]
   360         cmd = self._fin.readline()[:-1]
   354         if cmd and cmd in wireproto.commands:
   361         if cmd and wireproto.commands.commandavailable(cmd, self):
   355             rsp = wireproto.dispatch(self._repo, self, cmd)
   362             rsp = wireproto.dispatch(self._repo, self, cmd)
   356             self._handlers[rsp.__class__](self, rsp)
   363             self._handlers[rsp.__class__](self, rsp)
   357         elif cmd:
   364         elif cmd:
   358             self._sendresponse("")
   365             self._sendresponse("")
   359         return cmd != ''
   366         return cmd != ''