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

login
register
mail settings
Submitter phabricator
Date March 8, 2018, 12:24 a.m.
Message ID <differential-rev-PHID-DREV-ngsf3comp3uim5tqphtu-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/29108/
State Superseded
Headers show

Comments

phabricator - March 8, 2018, 12:24 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The previous behavior was just plain wrong. I have no clue how it
  landed. My guess is a merge conflict resolution gone wrong on my
  end a few weeks ago.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/wireprotoserver.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
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 []