diff -r ef683a0fd21f -r 5a56bf4180ad mercurial/wireprotoserver.py --- 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: