Patchwork D2716: wireprotoserver: check if command available before calling it

login
register
mail settings
Submitter phabricator
Date March 9, 2018, 7:29 p.m.
Message ID <3f531b89ba8e97fa8e0e8d1522c78ba2@localhost.localdomain>
Download mbox | patch
Permalink /patch/29182/
State Not Applicable
Headers show

Comments

phabricator - March 9, 2018, 7:29 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG7574c8173d5e: wireprotoserver: check if command available before calling it (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2716?vs=6710&id=6770

REVISION DETAIL
  https://phab.mercurial-scm.org/D2716

AFFECTED FILES
  mercurial/wireprotoserver.py

CHANGE DETAILS




To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py
--- a/mercurial/wireprotoserver.py
+++ b/mercurial/wireprotoserver.py
@@ -235,14 +235,14 @@ 
         for chunk in gen:
             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 []
 
+    rsp = wireproto.dispatch(repo, proto, cmd)
+
     if isinstance(rsp, bytes):
         req.respond(HTTP_OK, HGTYPE, body=rsp)
         return []