mercurial/wireprotoserver.py
changeset 35982 5a56bf4180ad
parent 35976 48a3a9283f09
child 35984 cdc93fe1da77
--- a/mercurial/wireprotoserver.py	Wed Jan 31 14:05:11 2018 -0800
+++ b/mercurial/wireprotoserver.py	Tue Jan 30 18:41:44 2018 -0800
@@ -223,6 +223,13 @@
             yield chunk
 
     rsp = wireproto.dispatch(repo, proto, cmd)
+
+    if not wireproto.commands.commandavailable(cmd, proto):
+        req.respond(HTTP_OK, HGERRTYPE,
+                    body=_('requested wire protocol command is not available '
+                           'over HTTP'))
+        return []
+
     if isinstance(rsp, bytes):
         req.respond(HTTP_OK, HGTYPE, body=rsp)
         return []
@@ -351,7 +358,7 @@
 
     def serve_one(self):
         cmd = self._fin.readline()[:-1]
-        if cmd and cmd in wireproto.commands:
+        if cmd and wireproto.commands.commandavailable(cmd, self):
             rsp = wireproto.dispatch(self._repo, self, cmd)
             self._handlers[rsp.__class__](self, rsp)
         elif cmd: